From f37fee7e648a05d26877e8f71408a5d9c2e25eb2 Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Tue, 3 Dec 2024 12:38:05 +1300 Subject: [PATCH] Fix ltinig issue --- src/AsyncEventDispatcher.php | 6 ++++-- tests/AsyncEventDispatcherTest.php | 12 +++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/AsyncEventDispatcher.php b/src/AsyncEventDispatcher.php index 4023ab8..ac2d628 100644 --- a/src/AsyncEventDispatcher.php +++ b/src/AsyncEventDispatcher.php @@ -5,11 +5,13 @@ namespace ArchiPro\EventDispatcher; use function Amp\async; -use function Amp\Future\await; use Amp\Cancellation; + use Amp\Future; +use function Amp\Future\await; + use function Amp\Future\awaitAll; use Amp\NullCancellation; @@ -28,7 +30,7 @@ */ class AsyncEventDispatcher implements EventDispatcherInterface { - const THROW_ON_ERROR = 0b0001; + public const THROW_ON_ERROR = 0b0001; /** * @param ListenerProviderInterface $listenerProvider The provider of event listeners diff --git a/tests/AsyncEventDispatcherTest.php b/tests/AsyncEventDispatcherTest.php index c84aac6..cada4cd 100644 --- a/tests/AsyncEventDispatcherTest.php +++ b/tests/AsyncEventDispatcherTest.php @@ -13,11 +13,9 @@ use ArchiPro\EventDispatcher\Event\AbstractStoppableEvent; use ArchiPro\EventDispatcher\ListenerProvider; use ArchiPro\EventDispatcher\Tests\Fixture\TestEvent; +use ColinODell\PsrTestLogger\TestLogger; use Exception; use PHPUnit\Framework\TestCase; -use Revolt\EventLoop; -use ColinODell\PsrTestLogger\TestLogger; -use Throwable; /** * Test cases for AsyncEventDispatcher. @@ -163,14 +161,14 @@ public function testDispatchesFailureInOneListenerDoesNotAffectOthers(): void $futureEvent = $this->dispatcher->dispatch($event); - $futureEvent = $futureEvent->await(); + $futureEvent->await(); $this->assertTrue( - $futureEvent->calledOnce, + $event->calledOnce, 'The first listener should have been called' ); $this->assertTrue( - $futureEvent->calledTwice, + $event->calledTwice, 'The second listener should have been called despite the failure of the first listener' ); @@ -235,7 +233,7 @@ public function testThrowsErrors(): void $this->listenerProvider->addListener(get_class($event), function ($event) { throw new Exception('This exception will bubble up because we set the THROW_ON_ERROR option'); }); - + $this->expectException(Exception::class); $this->expectExceptionMessage('This exception will bubble up because we set the THROW_ON_ERROR option');