public function testInstall(): void
{ $manifest = Manifest::
createFromXmlFile(__DIR__ . '/../Manifest/_fixtures/test/manifest.xml'
);
$eventWasReceived = false;
$appId = null;
$onAppInstalled =
function DAppInstalledEvent
$event) use (&
$eventWasReceived, &
$appId,
$manifest): void
{ $eventWasReceived = true;
$appId =
$event->
getApp()->
getId();
static::
assertEquals($manifest,
$event->
getManifest());
};
$this->eventDispatcher->
addListener(AppInstalledEvent::
class,
$onAppInstalled);
$this->appLifecycle->
install($manifest, true,
$this->context
);
$traces =
$this->
getContainer()->
get(ScriptTraces::
class)->
getTraces();
static::
assertArrayHasKey(AppInstalledHook::HOOK_NAME,
$traces);
static::
assertEquals('installed',
$traces[AppInstalledHook::HOOK_NAME
][0
]['output'
][0
]);
static::
assertTrue($eventWasReceived);
$this->eventDispatcher->
removeListener(AppInstalledEvent::
class,
$onAppInstalled);