getMainModule example

static::assertEquals([
            'en-GB' => 'My menu entry for modules',
            'de-DE' => 'Mein Menüeintrag für Module',
        ]$secondModule->getLabel());
        static::assertEquals('sw-catalogue', $secondModule->getParent());
        static::assertEquals(50, $secondModule->getPosition());

        $admin = $manifest->getAdmin();

        static::assertNotNull($admin);

        $mainModule = $admin->getMainModule();

        static::assertNotNull($mainModule);
        static::assertEquals('https://main-module', $mainModule->getSource());
    }

    public function testModulesWithStructureElements(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/../_fixtures/manifestWithStructureElement.xml');

        $admin = $manifest->getAdmin();
        static::assertNotNull($admin);

        
$secondModule = $manifest->getAdmin()->getModules()[1];
        static::assertNull($secondModule->getSource());
        static::assertEquals('structure-module', $secondModule->getName());
        static::assertEquals([
            'en-GB' => 'My menu entry for modules',
            'de-DE' => 'Mein Menüeintrag für Module',
        ]$secondModule->getLabel());
        static::assertEquals('sw-catalogue', $secondModule->getParent());
        static::assertEquals(50, $secondModule->getPosition());

        $mainModule = $manifest->getAdmin()->getMainModule();
        static::assertNotNull($mainModule);
        static::assertEquals('https://main-module', $mainModule->getSource());
    }

    public function testModulesWithStructureElements(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/_fixtures/manifestWithStructureElement.xml');
        $admin = $manifest->getAdmin();
        static::assertNotNull($admin);

        $moduleWithStructureElement = $admin->getModules()[0];

        
$modules[] = $module;
        }

        return $modules;
    }

    /** * @return array{source: string}|null */
    private function formatMainModule(AppEntity $app, Context $context): ?array
    {
        if ($app->getMainModule() === null) {
            return null;
        }

        $source = $app->getMainModule()['source'] ?? '';
        $secret = $app->getAppSecret() ?? '';

        return [
            'source' => $this->sign($source$secret$context),
        ];
    }

    


    private function updateModules(Manifest $manifest, string $id, string $defaultLocale, Context $context): void
    {
        $payload = [
            'id' => $id,
            'mainModule' => null,
            'modules' => [],
        ];

        if ($manifest->getAdmin() !== null) {
            if ($manifest->getAdmin()->getMainModule() !== null) {
                $payload['mainModule'] = [
                    'source' => $manifest->getAdmin()->getMainModule()->getSource(),
                ];
            }

            $payload['modules'] = array_reduce(
                $manifest->getAdmin()->getModules(),
                static function Darray $modules, Module $module) use ($defaultLocale) {
                    $modules[] = $module->toArray($defaultLocale);

                    return $modules;
                },
$this->appLifecycle->update($manifest$app$this->context);

        /** @var AppCollection $apps */
        $apps = $this->appRepository->search(new Criteria()$this->context)->getEntities();

        static::assertCount(1, $apps);
        /** @var AppEntity $appEntity */
        $appEntity = $apps->first();
        static::assertNotNull($appEntity);
        static::assertEmpty($appEntity->getModules());
        static::assertEmpty($appEntity->getCookies());
        static::assertNull($appEntity->getMainModule());
    }

    public function testDelete(): void
    {
        $appId = Uuid::randomHex();
        $roleId = Uuid::randomHex();
        $integrationId = Uuid::randomHex();

        $this->appRepository->create([[
            'id' => $appId,
            'name' => 'Test',
            
Home | Imprint | This part of the site doesn't use cookies.