| Conditions | 1 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 15 | 17 | public static function withExpectedExtension(string $filePath, string $expectedExtension): OutputFilePath |
|
| 16 | { |
||
| 17 | 17 | $path = new SplFileInfo(trim($filePath)); |
|
| 18 | 17 | $extension = $path->getExtension(); |
|
| 19 | 17 | $directory = realpath($path->getPath()); |
|
| 20 | 17 | Assert::true($directory !== false, "Directory '{$path->getPath()}' does not exist"); |
|
| 21 | 16 | Assert::eq( |
|
| 22 | $extension, |
||
| 23 | $expectedExtension, |
||
| 24 | 16 | "Output file is expected to have extension '.{$expectedExtension}', '.{$extension}' given" |
|
| 25 | ); |
||
| 26 | |||
| 27 | 15 | return new OutputFilePath(new SplFileInfo($directory . '/' . $path->getBasename())); |
|
| 28 | } |
||
| 39 |