getSnippets example

'allowDisable' => true,
                ],
            ],
        ];

        $manifest = Manifest::createFromXmlFile(__DIR__ . '/../_fixtures/manifest.xml');

        $appRepository = $this->getAppRepositoryMock($appEntities);
        $appLifecycle = $this->getAppLifecycle(
            $appRepository,
            $languageRepository,
            $this->getAppAdministrationSnippetPersisterMock($appEntities[2]$this->getSnippets()),
            $this->getAppLoaderMock($this->getSnippets())
        );

        $appLifecycle->install($manifest, false, Context::createDefaultContext());

        static::assertCount(1, $appRepository->upserts[0]);
        static::assertSame('test', $appRepository->upserts[0][0]['name']);
    }

    public function testInstallSavesNoSnippetsGiven(): void
    {
        
$expectedSnippet['en-GB'] = file_get_contents(__DIR__ . '/../_fixtures/Resources/app/administration/snippet/en-GB.json');

        $appLoader = new AppLoader(
            __DIR__,
            __DIR__,
            new ConfigReader()
        );

        $appEntity = new AppEntity();
        $appEntity->setPath('../_fixtures/');

        $snippets = $appLoader->getSnippets($appEntity);
        static::assertEquals($expectedSnippet$snippets);
    }

    public function testSnippetsMissing(): void
    {
        $appLoader = new AppLoader(
            __DIR__,
            __DIR__,
            new ConfigReader()
        );

        


        $updatePayload = [
            'id' => $app->getId(),
            'configurable' => $this->handleConfigUpdates($app$manifest$install$context),
            'allowDisable' => $this->doesAllowDisabling($app$context),
        ];
        $this->updateMetadata($updatePayload$context);

        // updates the snippets if the administration bundle is available         if ($this->appAdministrationSnippetPersister !== null) {
            $snippets = $this->appLoader->getSnippets($app);
            $this->appAdministrationSnippetPersister->updateSnippets($app$snippets$context);
        }

        return $app;
    }

    private function removeAppAndRole(AppEntity $app, Context $context, bool $keepUserData = false, bool $softDelete = false): void
    {
        // throw event before deleting app from db as it may be delivered via webhook to the deleted app         $event = new AppDeletedEvent($app->getId()$context$keepUserData);
        $this->eventDispatcher->dispatch($event);
        
Home | Imprint | This part of the site doesn't use cookies.