Skip to content

Commit

Permalink
Make ProcOpenBasedFinderTest extend ProcOpenBasedFinderTestCase (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Dec 16, 2022
1 parent 79261cc commit bc4d88b
Showing 1 changed file with 4 additions and 67 deletions.
71 changes: 4 additions & 67 deletions tests/Finder/ProcOpenBasedFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,80 +13,17 @@

namespace Fidry\CpuCoreCounter\Test\Finder;

use PHPUnit\Framework\TestCase;
use Fidry\CpuCoreCounter\Finder\ProcOpenBasedFinder;

/**
* @covers \Fidry\CpuCoreCounter\Finder\ProcOpenBasedFinder
*
* @internal
*/
final class ProcOpenBasedFinderTest extends TestCase
final class ProcOpenBasedFinderTest extends ProcOpenBasedFinderTestCase
{
/**
* @dataProvider popenFgetsProvider
*/
public function test_it_can_count_the_number_of_cpu_cores(
string $nproc,
?int $expected
): void {
$actual = DummyProcOpenBasedFinder::countCpuCores($nproc);

self::assertSame($expected, $actual);
}

public static function popenFgetsProvider(): iterable
protected function getFinder(): ProcOpenBasedFinder
{
yield 'empty' => [
<<<'EOF'

EOF
,
null,
];

yield 'whitespace' => [
<<<'EOF'

EOF
,
null,
];

yield 'example from a Windows machine' => [
<<<'EOF'
3

EOF
,
3,
];

yield 'example from a Windows machine with extra spaces' => [
<<<'EOF'
3

EOF
,
3,
];

yield 'no processor' => [
<<<'EOF'
0

EOF
,
null,
];
}

public function test_it_can_describe_itself(): void
{
$finder = new DummyProcOpenBasedFinder();

self::assertSame(
FinderShortClassName::get($finder),
$finder->toString()
);
return new DummyProcOpenBasedFinder();
}
}

0 comments on commit bc4d88b

Please sign in to comment.