-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,49 @@ | ||
<?php | ||
|
||
namespace KevinGH\Box\Parallelization; | ||
|
||
use Humbug\PhpScoper\Symbol\SymbolsRegistry; | ||
use PhpParser\Node\Name\FullyQualified; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \KevinGH\Box\Parallelization\BatchResult | ||
*/ | ||
final class BatchResultTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider batchResultProvider | ||
*/ | ||
public function test_it_can_be_serialized_and_deserialized(BatchResult $batchResult): void | ||
{ | ||
$unserializedBatchResult = BatchResult::unserialize($batchResult->serialize()); | ||
|
||
self::assertEquals($batchResult, $unserializedBatchResult); | ||
} | ||
|
||
public static function batchResultProvider(): iterable | ||
{ | ||
yield 'empty' => [ | ||
new BatchResult( | ||
[], | ||
new SymbolsRegistry(), | ||
), | ||
]; | ||
|
||
$symbolsRegistry = new SymbolsRegistry(); | ||
$symbolsRegistry->recordClass( | ||
new FullyQualified('Box\Func'), | ||
new FullyQualified('Scoped\Box\Func'), | ||
); | ||
|
||
yield 'nominal' => [ | ||
new BatchResult( | ||
[ | ||
'/path/to/file.php', | ||
'<?php echo "Hello world!";' | ||
], | ||
$symbolsRegistry, | ||
), | ||
]; | ||
} | ||
} |
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,49 @@ | ||
<?php | ||
|
||
namespace KevinGH\Box\Parallelization; | ||
|
||
use Humbug\PhpScoper\Symbol\SymbolsRegistry; | ||
use PhpParser\Node\Name\FullyQualified; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \KevinGH\Box\Parallelization\Configuration | ||
*/ | ||
final class ConfigurationTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider configurationProvider | ||
*/ | ||
public function test_it_can_be_serialized_and_deserialized(Configuration $configuration): void | ||
{ | ||
$unserializedBatchResult = BatchResult::unserialize($configuration->serialize()); | ||
|
||
self::assertEquals($configuration, $unserializedBatchResult); | ||
} | ||
|
||
public static function configurationProvider(): iterable | ||
{ | ||
yield 'empty' => [ | ||
new BatchResult( | ||
[], | ||
new SymbolsRegistry(), | ||
), | ||
]; | ||
|
||
$symbolsRegistry = new SymbolsRegistry(); | ||
$symbolsRegistry->recordClass( | ||
new FullyQualified('Box\Func'), | ||
new FullyQualified('Scoped\Box\Func'), | ||
); | ||
|
||
yield 'nominal' => [ | ||
new BatchResult( | ||
[ | ||
'/path/to/file.php', | ||
'<?php echo "Hello world!";' | ||
], | ||
$symbolsRegistry, | ||
), | ||
]; | ||
} | ||
} |
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