• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

move-elevator / composer-translation-validator / 15945289433

28 Jun 2025 02:50PM UTC coverage: 89.647%. First build
15945289433

push

github

web-flow
Merge pull request #10 from move-elevator/unit-testing

test: add unit tests

31 of 44 new or added lines in 6 files covered. (70.45%)

381 of 425 relevant lines covered (89.65%)

2.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/src/Utility/PathUtility.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace MoveElevator\ComposerTranslationValidator\Utility;
6

7
class PathUtility
8
{
9
    public static function normalizeFolderPath(string $path): string
7✔
10
    {
11
        $realPath = realpath($path);
7✔
12
        if (false === $realPath) {
7✔
13
            // If realpath fails, it might be a non-existent path, return as is but normalized
14
            $normalizedPath = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
4✔
15
            if (str_starts_with($normalizedPath, './')) {
4✔
16
                $normalizedPath = substr($normalizedPath, 2);
1✔
17
            }
18

19
            return $normalizedPath;
4✔
20
        }
21

22
        $cwd = realpath(getcwd()).DIRECTORY_SEPARATOR;
3✔
23
        $normalizedPath = rtrim($realPath, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
3✔
24

25
        if (str_starts_with($normalizedPath, $cwd)) {
3✔
26
            $relativePath = substr($normalizedPath, strlen($cwd));
3✔
27

28
            return $relativePath;
3✔
29
        }
30

NEW
31
        return $normalizedPath;
×
32
    }
33
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc