Skip to content

Commit

Permalink
Removed PHPUnit attributes that ignored code coverage in favor of ann…
Browse files Browse the repository at this point in the history
…otations (#299)
  • Loading branch information
davidbyoung committed Oct 7, 2023
1 parent 3143949 commit d68b534
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/Drivers/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions src/Drivers/UnixLikeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function readHiddenInput(IOutput $output): ?string

/**
* @inheritdoc
* @codeCoverageIgnore
*/
protected function getCliDimensionsFromOS(): ?array
{
Expand Down
3 changes: 3 additions & 0 deletions src/Drivers/WindowsDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
{
Expand All @@ -65,6 +67,7 @@ protected function getCliDimensionsFromConsoleMode(): ?array

/**
* @inheritdoc
* @codeCoverageIgnore
*/
protected function getCliDimensionsFromOS(): ?array
{
Expand Down
6 changes: 0 additions & 6 deletions tests/Drivers/UnixLikeDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions tests/Drivers/WindowsDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d68b534

Please sign in to comment.