From f7b5ab54be4190587019a16cb3b61cf6474ac9dd Mon Sep 17 00:00:00 2001 From: Anton Smirnov Date: Mon, 1 Nov 2021 03:42:46 +0200 Subject: [PATCH] Improve coverage --- src/FilesystemPath.php | 3 +++ src/RelativePath.php | 3 +++ tests/FilesystemPathTest.php | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 tests/FilesystemPathTest.php diff --git a/src/FilesystemPath.php b/src/FilesystemPath.php index ffde96d..2a2ae6e 100644 --- a/src/FilesystemPath.php +++ b/src/FilesystemPath.php @@ -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 === '\\') { diff --git a/src/RelativePath.php b/src/RelativePath.php index 062ae73..d2da998 100644 --- a/src/RelativePath.php +++ b/src/RelativePath.php @@ -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 === '\\'); diff --git a/tests/FilesystemPathTest.php b/tests/FilesystemPathTest.php new file mode 100644 index 0000000..30b80c3 --- /dev/null +++ b/tests/FilesystemPathTest.php @@ -0,0 +1,24 @@ +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 + } + }; + } +}