AppCollection example

$pluginRepository = new StaticEntityRepository([
            $this->createPluginSearchResult($context[
                ['name' => $plugin1Name],
            ]),
        ]);

        $appRepository = new StaticEntityRepository([
            new EntitySearchResult(
                AppEntity::class,
                0,
                new AppCollection(),
                null,
                new Criteria(),
                $context
            ),
        ]);

        $this->firstRunWizardService->expects(static::once())
            ->method('getLanguagePlugins')
            ->willReturn([
                (new StorePluginStruct())->assign(['name' => $plugin1Name]),
            ]);

        
protected function tearDown(): void
    {
        $this->removePlugin(__DIR__ . '/../_fixtures/AppStoreTestPlugin');
        $this->removeApp(__DIR__ . '/../_fixtures/TestApp');
    }

    public function testAppNotInstalledDetectedAsTheme(): void
    {
        $this->installApp(__DIR__ . '/../_fixtures/TestAppTheme', false);
        $extensions = $this->extensionLoader->loadFromAppCollection(
            Context::createDefaultContext(),
            new AppCollection([])
        );

        /** @var ExtensionStruct $extension */
        $extension = $extensions->get('TestAppTheme');
        static::assertTrue($extension->isTheme());
        $this->removeApp(__DIR__ . '/../_fixtures/TestAppTheme');
    }

    public function testLocalUpdateShouldSetLatestVersion(): void
    {
        $appManifestPath = $this->getContainer()->getParameter('kernel.app_dir') . '/TestApp/manifest.xml';
        

        $entities = [];

        foreach ($appEntities as $entity) {
            $appEntity = new AppEntity();
            $appEntity->assign($entity);
            $appEntity->setUniqueIdentifier($entity['id']);

            $entities[] = $appEntity;
        }

        return new AppCollection($entities);
    }

    /** * @param array<int, array<string, mixed>> $appEntities * @param array<string, array<string, string>> $expectedSnippets */
    private function getAppAdministrationSnippetPersisterMock(array $appEntities, array $expectedSnippets = []): AppAdministrationSnippetPersister
    {
        $appEntities = $this->getAppCollection($appEntities)->first();

        $persister = $this->createMock(AppAdministrationSnippetPersister::class);

        
$configService->getConfiguration('invalid!', Context::createDefaultContext());
    }

    public function testMissingConfig(): void
    {
        $this->expectException(ConfigurationNotFoundException::class);

        $configService = new ConfigurationService(
            [],
            new ConfigReader(),
            $this->createMock(AppLoader::class),
            new StaticEntityRepository([new AppCollection()]),
            new StaticSystemConfigService([])
        );

        $configService->getConfiguration('missing', Context::createDefaultContext());
    }

    public function testConfigurationFeatureFlag(): void
    {
        $_SERVER['FEATURE_NEXT_101'] = '1';
        $_SERVER['FEATURE_NEXT_102'] = '1';
        static::assertTrue(Feature::isActive('FEATURE_NEXT_101'));
        
$frwClient->expects(static::once())
            ->method('getRecommendations')
            ->with('us', 'payment', $this->context)
            ->willReturn($recommendations);

        $frwService = $this->createFirstRunWizardService(
            frwClient: $frwClient,
        );

        $recommendations = $frwService->getRecommendations(
            new PluginCollection(),
            new AppCollection(),
            'us',
            'payment',
            $this->context
        );

        static::assertCount(3, $recommendations);
    }

    public function testFiltersOutRecommendedPluginsWithMissingName(): void
    {
        $recommendations = [
            [
Home | Imprint | This part of the site doesn't use cookies.