static::
expectException(AppNotFoundException::
class);
$this->appStateService->
deactivateApp(Uuid::
randomHex(), Context::
createDefaultContext());
} public function testActivate(): void
{ $manifest = Manifest::
createFromXmlFile(__DIR__ . '/Manifest/_fixtures/test/manifest.xml'
);
$this->appLifecycle->
install($manifest, false,
$this->context
);
$appId =
$this->appRepository->
searchIds(new Criteria(),
$this->context
)->
firstId();
static::
assertNotNull($appId);
$this->
assertAppState($appId, false
);
$eventWasReceived = false;
$onAppInstalled =
function DAppActivatedEvent
$event) use ($appId, &
$eventWasReceived): void
{ $eventWasReceived = true;
static::
assertSame($appId,
$event->
getApp()->
getId());
};
$this->eventDispatcher->
addListener(AppActivatedEvent::
class,
$onAppInstalled);
$this->appStateService->
activateApp($appId,
$this->context
);
$traces =
$this->
getContainer()->
get(ScriptTraces::
class)->
getTraces();
static::
assertArrayHasKey(AppActivatedHook::HOOK_NAME,
$traces);