Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test suite to use new reactphp/async package instead of clue/reactphp-block #110

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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