Skip to content

Instantly share code, notes, and snippets.

@dgafka
Last active December 17, 2022 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgafka/585b96fa7c04d54aa25b58967fefd39b to your computer and use it in GitHub Desktop.
Save dgafka/585b96fa7c04d54aa25b58967fefd39b to your computer and use it in GitHub Desktop.
testing-message-driven-architecture-in-php-07.php
<?php
$ecotoneTestSupport = EcotoneLite::bootstrapForTesting(
[OrderService::class, OrderNotifier::class],
$dependencyContainer,
ServiceConfiguration::createWithDefaults()
// We disable asynchronous module, so our asynchronous code becomes synchronous
->withSkippedModulePackageNames([ModulePackageList::ASYNCHRONOUS_PACKAGE]),
);
$ecotoneTestSupport->getCommandBus()->send(PlaceOrder::create($orderId));
// This means we don't need to run our consumer anymore, because Event Handler is triggered synchronously.
Assert::assertEquals(1, $ecotoneTestSupport->sendQueryWithRouting("notificationService.getSentNotificationsCount"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment