From d68b53461ef1cbc10358241ff586e71289e7d49f Mon Sep 17 00:00:00 2001 From: David Young Date: Sat, 7 Oct 2023 10:21:49 -0500 Subject: [PATCH] Removed PHPUnit attributes that ignored code coverage in favor of annotations (#299) --- src/Drivers/Driver.php | 3 +++ src/Drivers/UnixLikeDriver.php | 1 + src/Drivers/WindowsDriver.php | 3 +++ tests/Drivers/UnixLikeDriverTest.php | 6 ------ tests/Drivers/WindowsDriverTest.php | 8 -------- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Drivers/Driver.php b/src/Drivers/Driver.php index 2390726..f2dda90 100644 --- a/src/Drivers/Driver.php +++ b/src/Drivers/Driver.php @@ -89,6 +89,7 @@ abstract protected function getCliDimensionsFromOS(): ?array; * Gets the CLI dimensions from STTY as a tuple * * @return array|null The dimensions (width x height) as a tuple if found, otherwise null + * @codeCoverageIgnore */ protected function getCliDimensionsFromStty(): ?array { @@ -113,6 +114,7 @@ protected function getCliDimensionsFromStty(): ?array * * @param string $command The command to run in the process * @return string|null The output of the process + * @codeCoverageIgnore */ protected function runProcess(string $command): ?string { @@ -141,6 +143,7 @@ protected function runProcess(string $command): ?string * Gets whether or not this driver supports stty * * @return bool Whether or not STTY is supported + * @codeCoverageIgnore */ protected function supportsStty(): bool { diff --git a/src/Drivers/UnixLikeDriver.php b/src/Drivers/UnixLikeDriver.php index 9316db8..46b8453 100644 --- a/src/Drivers/UnixLikeDriver.php +++ b/src/Drivers/UnixLikeDriver.php @@ -46,6 +46,7 @@ public function readHiddenInput(IOutput $output): ?string /** * @inheritdoc + * @codeCoverageIgnore */ protected function getCliDimensionsFromOS(): ?array { diff --git a/src/Drivers/WindowsDriver.php b/src/Drivers/WindowsDriver.php index f824883..0fc63c0 100644 --- a/src/Drivers/WindowsDriver.php +++ b/src/Drivers/WindowsDriver.php @@ -24,6 +24,7 @@ class WindowsDriver extends Driver /** * @inheritdoc + * @codeCoverageIgnore * @psalm-suppress ForbiddenCode We purposely are running an external executable */ public function readHiddenInput(IOutput $output): ?string @@ -48,6 +49,7 @@ public function readHiddenInput(IOutput $output): ?string * Gets the CLI dimensions from the console mode as a tuple * * @return array|null The dimensions (width x height) as a tuple if found, otherwise null + * @codeCoverageIgnore */ protected function getCliDimensionsFromConsoleMode(): ?array { @@ -65,6 +67,7 @@ protected function getCliDimensionsFromConsoleMode(): ?array /** * @inheritdoc + * @codeCoverageIgnore */ protected function getCliDimensionsFromOS(): ?array { diff --git a/tests/Drivers/UnixLikeDriverTest.php b/tests/Drivers/UnixLikeDriverTest.php index 24ed000..091575c 100644 --- a/tests/Drivers/UnixLikeDriverTest.php +++ b/tests/Drivers/UnixLikeDriverTest.php @@ -12,18 +12,12 @@ namespace Aphiria\Console\Tests\Drivers; -use Aphiria\Console\Drivers\Driver; use Aphiria\Console\Drivers\HiddenInputNotSupportedException; use Aphiria\Console\Drivers\UnixLikeDriver; use Aphiria\Console\Output\IOutput; use Aphiria\Console\StatusCode; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; use PHPUnit\Framework\TestCase; -#[IgnoreMethodForCodeCoverage(UnixLikeDriver::class, 'getCliDimensionsFromOS')] -#[IgnoreMethodForCodeCoverage(Driver::class, 'getCliDimensionsFromStty')] -#[IgnoreMethodForCodeCoverage(Driver::class, 'runProcess')] -#[IgnoreMethodForCodeCoverage(Driver::class, 'supportsStty')] class UnixLikeDriverTest extends TestCase { private string|bool $ansicon; diff --git a/tests/Drivers/WindowsDriverTest.php b/tests/Drivers/WindowsDriverTest.php index 8604d7f..252f0be 100644 --- a/tests/Drivers/WindowsDriverTest.php +++ b/tests/Drivers/WindowsDriverTest.php @@ -12,18 +12,10 @@ namespace Aphiria\Console\Tests\Drivers; -use Aphiria\Console\Drivers\Driver; use Aphiria\Console\Drivers\WindowsDriver; use Aphiria\Console\StatusCode; -use PHPUnit\Framework\Attributes\IgnoreMethodForCodeCoverage; use PHPUnit\Framework\TestCase; -#[IgnoreMethodForCodeCoverage(WindowsDriver::class, 'getCliDimensionsFromOS')] -#[IgnoreMethodForCodeCoverage(WindowsDriver::class, 'readHiddenInput')] -#[IgnoreMethodForCodeCoverage(WindowsDriver::class, 'getCliDimensionsFromConsoleMode')] -#[IgnoreMethodForCodeCoverage(Driver::class, 'getCliDimensionsFromStty')] -#[IgnoreMethodForCodeCoverage(Driver::class, 'runProcess')] -#[IgnoreMethodForCodeCoverage(Driver::class, 'supportsStty')] class WindowsDriverTest extends TestCase { private string|bool $ansicon;