doRefreshApps example

protected function loadAppsFromDir(string $appDir, bool $activateApps = true): void
    {
        $appService = new AppService(
            new AppLifecycleIterator(
                $this->getContainer()->get('app.repository'),
                $this->getAppLoader($appDir),
            ),
            $this->getContainer()->get(AppLifecycle::class)
        );

        $fails = $appService->doRefreshApps($activateApps, Context::createDefaultContext());

        if ($fails !== []) {
            $errors = \array_map(function Darray $fail): string {
                return $fail['exception']->getMessage();
            }$fails);

            static::fail('App synchronisation failed: ' . \print_r($errors, true));
        }
    }

    protected function reloadAppSnippets(): void
    {
$this->appRepository,
                $this->getAppLoader(__DIR__ . '/Manifest/_fixtures/test')
            ),
            $this->getContainer()->get(AppLifecycle::class)
        );

        $this->context = Context::createDefaultContext();
    }

    public function testRefreshInstallsNewApp(): void
    {
        $this->appService->doRefreshApps(true, $this->context);

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

        static::assertCount(1, $apps);
        $first = $apps->first();
        static::assertInstanceOf(AppEntity::class$first);
        static::assertEquals('test', $first->getName());

        $this->assertDefaultActionButtons();
    }

    

        }

        if (!$input->getOption('no-validate')) {
            $hasViolations = $this->validateRefreshableApps($refreshableApps$io$context);

            if ($hasViolations === 1) {
                return self::FAILURE;
            }
        }

        $fails = $this->appService->doRefreshApps($input->getOption('activate')$context$refreshableApps->getAppNames());

        $this->appPrinter->printInstalledApps($io$context);
        $this->appPrinter->printIncompleteInstallations($io$fails);

        return self::SUCCESS;
    }

    private function validateRefreshableApps(RefreshableAppDryRun $refreshableApps, ShopwareStyle $io, Context $context): int
    {
        $refreshableManifests = array_merge(
            $refreshableApps->getToBeInstalled(),
            
Home | Imprint | This part of the site doesn't use cookies.