generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the dummy core finder from the test to the source directory (#51)
- Loading branch information
Showing
5 changed files
with
104 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Finder; | ||
|
||
/** | ||
* This finder returns whatever value you gave to it. This is useful for testing. | ||
*/ | ||
final class NullCpuCoreFinder implements CpuCoreFinder | ||
{ | ||
public function find(): ?int | ||
{ | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Test\Finder; | ||
|
||
use Fidry\CpuCoreCounter\Finder\DummyCpuCoreFinder; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \Fidry\CpuCoreCounter\Finder\DummyCpuCoreFinder | ||
* | ||
* @internal | ||
*/ | ||
final class DummyCpuCoreFinderTest extends TestCase | ||
{ | ||
public function test_it_returns_the_number_of_cores_given(): void | ||
{ | ||
$finder = new DummyCpuCoreFinder(5); | ||
|
||
self::assertSame(5, $finder->find()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Fidry CPUCounter Config package. | ||
* | ||
* (c) Théo FIDRY <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Fidry\CpuCoreCounter\Test\Finder; | ||
|
||
use Fidry\CpuCoreCounter\Finder\NullCpuCoreFinder; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \Fidry\CpuCoreCounter\Finder\NullCpuCoreFinder | ||
* | ||
* @internal | ||
*/ | ||
final class NullCpuCoreFinderTest extends TestCase | ||
{ | ||
public function test_it_returns_null(): void | ||
{ | ||
$finder = new NullCpuCoreFinder(); | ||
|
||
self::assertNull($finder->find()); | ||
} | ||
} |