-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
7899776
commit 82cc5c4
Showing
5 changed files
with
35 additions
and
57 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
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 |
---|---|---|
|
@@ -8,9 +8,7 @@ | |
use Patchlevel\EventSourcing\EventBus\AttributeListenerProvider; | ||
use Patchlevel\EventSourcing\EventBus\ListenerDescriptor; | ||
use Patchlevel\EventSourcing\EventBus\Message; | ||
use Patchlevel\EventSourcing\Tests\Unit\Fixture\Email; | ||
use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileCreated; | ||
use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileId; | ||
use Patchlevel\EventSourcing\Tests\Unit\Fixture\ProfileVisited; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
|
@@ -19,13 +17,8 @@ final class AttributeListenerProviderTest extends TestCase | |
{ | ||
public function testProvideNothing(): void | ||
{ | ||
$event = new ProfileCreated( | ||
ProfileId::fromString('1'), | ||
Email::fromString('[email protected]'), | ||
); | ||
|
||
$eventBus = new AttributeListenerProvider([]); | ||
$listeners = $eventBus->listenersForEvent($event); | ||
$listeners = $eventBus->listenersForEvent(ProfileCreated::class); | ||
|
||
self::assertSame([], $listeners); | ||
} | ||
|
@@ -44,13 +37,8 @@ public function bar(Message $message): void | |
} | ||
}; | ||
|
||
$event = new ProfileCreated( | ||
ProfileId::fromString('1'), | ||
Email::fromString('[email protected]'), | ||
); | ||
|
||
$eventBus = new AttributeListenerProvider([$listener]); | ||
$listeners = $eventBus->listenersForEvent($event); | ||
$listeners = $eventBus->listenersForEvent(ProfileCreated::class); | ||
|
||
self::assertEquals([new ListenerDescriptor($listener->foo(...))], $listeners); | ||
} | ||
|
@@ -69,13 +57,8 @@ public function bar(Message $message): void | |
} | ||
}; | ||
|
||
$event = new ProfileCreated( | ||
ProfileId::fromString('1'), | ||
Email::fromString('[email protected]'), | ||
); | ||
|
||
$eventBus = new AttributeListenerProvider([$listener]); | ||
$listeners = $eventBus->listenersForEvent($event); | ||
$listeners = $eventBus->listenersForEvent(ProfileCreated::class); | ||
|
||
self::assertEquals([ | ||
new ListenerDescriptor($listener->foo(...)), | ||
|
@@ -99,13 +82,8 @@ public function __invoke(Message $message): void | |
} | ||
}; | ||
|
||
$event = new ProfileCreated( | ||
ProfileId::fromString('1'), | ||
Email::fromString('[email protected]'), | ||
); | ||
|
||
$eventBus = new AttributeListenerProvider([$listener1, $listener2]); | ||
$listeners = $eventBus->listenersForEvent($event); | ||
$listeners = $eventBus->listenersForEvent(ProfileCreated::class); | ||
|
||
self::assertEquals([ | ||
new ListenerDescriptor($listener1->__invoke(...)), | ||
|
@@ -122,13 +100,8 @@ public function __invoke(Message $message): void | |
} | ||
}; | ||
|
||
$event = new ProfileCreated( | ||
ProfileId::fromString('1'), | ||
Email::fromString('[email protected]'), | ||
); | ||
|
||
$eventBus = new AttributeListenerProvider([$listener]); | ||
$listeners = $eventBus->listenersForEvent($event); | ||
$listeners = $eventBus->listenersForEvent(ProfileCreated::class); | ||
|
||
self::assertEquals([ | ||
new ListenerDescriptor($listener->__invoke(...)), | ||
|
@@ -149,13 +122,8 @@ public function bar(Message $message): void | |
} | ||
}; | ||
|
||
$event = new ProfileCreated( | ||
ProfileId::fromString('1'), | ||
Email::fromString('[email protected]'), | ||
); | ||
|
||
$eventBus = new AttributeListenerProvider([$listener]); | ||
$listeners = $eventBus->listenersForEvent($event); | ||
$listeners = $eventBus->listenersForEvent(ProfileCreated::class); | ||
|
||
self::assertEquals([ | ||
new ListenerDescriptor($listener->bar(...)), | ||
|
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