Skip to content

Commit

Permalink
Update test suite to use new reactphp/async package instead of clue/r…
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Aug 25, 2022
1 parent 41fefa4 commit 18401db
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 132 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"wyrihaximus/react-child-process-promise-closure": "^1.0"
},
"require-dev": {
"clue/block-react": "^1.4",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"react/async": "^4 || ^3"
},
"autoload": {
"psr-4": {
Expand Down
203 changes: 105 additions & 98 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions tests/AbstractFilesystemTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
use React\EventLoop\LoopInterface;
use React\Filesystem\Factory;
use React\Filesystem\AdapterInterface;
use React\Promise\PromiseInterface;
use function Clue\React\Block\await;

abstract class AbstractFilesystemTestCase extends TestCase
{
Expand All @@ -35,9 +33,4 @@ final public function provideFilesystems(): iterable

yield 'factory' => [Factory::create()];
}

public function await(PromiseInterface $promise)
{
return await($promise, EventLoop\Loop::get(), 30);
}
}
6 changes: 3 additions & 3 deletions tests/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use React\Filesystem\Node\FileInterface;
use React\Filesystem\Stat;
use React\Promise\PromiseInterface;
use function Clue\React\Block\await;
use function React\Async\await;

final class DirectoryTest extends AbstractFilesystemTestCase
{
Expand All @@ -19,7 +19,7 @@ final class DirectoryTest extends AbstractFilesystemTestCase
*/
public function stat(AdapterInterface $filesystem): void
{
$stat = $this->await($filesystem->detect(__DIR__)->then(static function (DirectoryInterface $directory): PromiseInterface {
$stat = await($filesystem->detect(__DIR__)->then(static function (DirectoryInterface $directory): PromiseInterface {
return $directory->stat();
}));

Expand Down Expand Up @@ -48,7 +48,7 @@ public function ls(AdapterInterface $filesystem): void

ksort($expectedListing);

$directoryListing = $this->await($filesystem->detect(__DIR__)->then(static function (DirectoryInterface $directory): PromiseInterface {
$directoryListing = await($filesystem->detect(__DIR__)->then(static function (DirectoryInterface $directory): PromiseInterface {
return $directory->ls();
}));

Expand Down
4 changes: 2 additions & 2 deletions tests/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use React\Filesystem\AdapterInterface;
use React\Filesystem\Node\DirectoryInterface;
use React\Filesystem\Node\FileInterface;
use function Clue\React\Block\await;
use function React\Async\await;

final class FactoryTest extends AbstractFilesystemTestCase
{
Expand All @@ -17,7 +17,7 @@ final class FactoryTest extends AbstractFilesystemTestCase
*/
public function factory(): void
{
$node = $this->await(Factory::create()->detect(__FILE__));
$node = await(Factory::create()->detect(__FILE__));

self::assertInstanceOf(FileInterface::class, $node);
}
Expand Down
Loading

0 comments on commit 18401db

Please sign in to comment.