Improve coverage

master
Anton Smirnov 2 years ago
parent f94d565bb0
commit f7b5ab54be

@ -16,6 +16,9 @@ abstract class FilesystemPath extends AbstractAbsolutePath
throw new \LogicException('The class is not meant to be extended externally');
}
/**
* @codeCoverageIgnore OS specific
*/
public static function parse(string $path, bool $strict = false): self
{
if (DIRECTORY_SEPARATOR === '\\') {

@ -25,6 +25,9 @@ final class RelativePath extends AbstractPath implements RelativePathInterface
return new self($path, true);
}
/**
* @codeCoverageIgnore OS specific
*/
public static function currentOS(string $path): self
{
return new self($path, DIRECTORY_SEPARATOR === '\\');

@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace Arokettu\Path\Tests;
use Arokettu\Path\FilesystemPath;
use PHPUnit\Framework\TestCase;
class FilesystemPathTest extends TestCase
{
public function testDoNotAllowExtending(): void
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('The class is not meant to be extended externally');
new class ('') extends FilesystemPath {
protected function parsePath(string $path, bool $strict): void
{
// whatever
}
};
}
}
Loading…
Cancel
Save