/** @var string $appId */
$appId =
$this->appRepo->
searchIds($criteria,
$context)->
firstId();
$eventWasReceived = false;
$onAppActivation =
function DAppActivatedEvent
$event) use (&
$eventWasReceived,
$appId,
$context): void
{ $eventWasReceived = true;
static::
assertEquals($appId,
$event->
getApp()->
getId());
static::
assertEquals($context,
$event->
getContext());
};
$this->eventDispatcher->
addListener(AppActivatedEvent::
class,
$onAppActivation);
$this->appStateService->
activateApp($appId,
$context);
static::
assertTrue($eventWasReceived);
$criteria =
new Criteria();
$criteria->
addFilter(new EqualsFilter('appId',
$appId));
$criteria->
addFilter(new EqualsFilter('active', true
));
// We expect 1 storefront twig template and svg image to be stored in the DB
$expectedTemplates = 2;
if (!
$this->themeService
) { // if the storefront is not installed we only expect the storefront twig template