-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test scenario using Ecotone Lite
- Loading branch information
1 parent
ea1482c
commit 97e54e8
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
packages/PdoEventSourcing/tests/Integration/AggregateAndProjectionTriggerTest.php
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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Test\Ecotone\EventSourcing\Integration; | ||
|
||
use Ecotone\Lite\EcotoneLite; | ||
use Ecotone\Messaging\Config\ModulePackageList; | ||
use Ecotone\Messaging\Config\ServiceConfiguration; | ||
use Enqueue\Dbal\DbalConnectionFactory; | ||
use Test\Ecotone\EventSourcing\EventSourcingMessagingTest; | ||
use Test\Ecotone\EventSourcing\Fixture\Ticket\Command\CloseTicket; | ||
use Test\Ecotone\EventSourcing\Fixture\Ticket\Command\RegisterTicket; | ||
use Test\Ecotone\EventSourcing\Fixture\Ticket\TicketEventConverter; | ||
use Test\Ecotone\EventSourcing\Fixture\TicketProjectionState\CounterStateGateway; | ||
use Test\Ecotone\EventSourcing\Fixture\TicketProjectionState\NotificationService; | ||
use Test\Ecotone\EventSourcing\Fixture\TicketProjectionState\StateAndEventConverter; | ||
use Test\Ecotone\EventSourcing\Fixture\TicketProjectionState\TicketCounterProjection; | ||
|
||
final class AggregateAndProjectionTriggerTest extends EventSourcingMessagingTest | ||
{ | ||
public function test_triggering_projection_with_state_synchronously() | ||
{ | ||
$ecotoneLite = EcotoneLite::bootstrapFlowTesting( | ||
[], [new TicketEventConverter(), new StateAndEventConverter(), new NotificationService(), new TicketCounterProjection(), DbalConnectionFactory::class => $this->getConnectionFactory()], | ||
ServiceConfiguration::createWithDefaults() | ||
->withSkippedModulePackageNames(ModulePackageList::allPackagesExcept([ModulePackageList::EVENT_SOURCING_PACKAGE, ModulePackageList::DBAL_PACKAGE])) | ||
->withNamespaces(['Test\Ecotone\EventSourcing\Fixture\Ticket', 'Test\Ecotone\EventSourcing\Fixture\TicketProjectionState']), | ||
pathToRootCatalog: __DIR__ . "/../../", | ||
addEventSourcedRepository: false | ||
); | ||
|
||
$this->assertEquals( | ||
1, | ||
$ecotoneLite | ||
->sendCommand(new RegisterTicket('123', 'johny', 'alert')) | ||
->sendCommand(new CloseTicket('123')) | ||
->getGateway(CounterStateGateway::class) | ||
->fetchState() | ||
->closedTicketCount | ||
); | ||
} | ||
} |