copyAssetsFromApp example

protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);

        foreach ($this->kernel->getBundles() as $bundle) {
            $io->writeln(sprintf('Copying files for bundle: %s', $bundle->getName()));
            $this->assetService->copyAssetsFromBundle($bundle->getName()$input->getOption('force'));
        }

        foreach ($this->activeAppsLoader->getActiveApps() as $app) {
            $io->writeln(sprintf('Copying files for app: %s', $app['name']));
            $this->assetService->copyAssetsFromApp($app['name']$app['path']$input->getOption('force'));
        }

        $io->writeln('Copying files for bundle: Installer');
        $this->assetService->copyAssets(new Installer()$input->getOption('force'));

        $publicDir = $this->kernel->getProjectDir() . '/public/';

        if (!file_exists($publicDir . '/.htaccess') && file_exists($publicDir . '/.htaccess.dist')) {
            $io->writeln('Copying .htaccess.dist to .htaccess');
            copy($publicDir . '/.htaccess.dist', $publicDir . '/.htaccess');
        }

        
$filesystem = new Filesystem(new MemoryFilesystemAdapter());
        $assetService = new AssetService(
            $filesystem,
            $filesystem,
            $this->createMock(KernelInterface::class),
            $this->createMock(KernelPluginLoader::class),
            $this->createMock(CacheInvalidator::class),
            $this->createMock(AbstractAppLoader::class),
            new ParameterBag(['shopware.filesystem.asset.type' => 's3'])
        );

        $assetService->copyAssetsFromApp('TestApp', __DIR__ . '/foo');

        static::assertEmpty($filesystem->listContents('bundles')->toArray());
    }

    public function testCopyAssetsWithApp(): void
    {
        $filesystem = new Filesystem(new MemoryFilesystemAdapter());

        $appLoader = $this->createMock(AbstractAppLoader::class);
        $appLoader
            ->method('locatePath')
            
$this->paymentMethodPersister->updatePaymentMethods($manifest$id$defaultLocale$context);
            $this->taxProviderPersister->updateTaxProviders($manifest$id$defaultLocale$context);

            $this->updateModules($manifest$id$defaultLocale$context);
        }

        $this->ruleConditionPersister->updateConditions($manifest$id$defaultLocale$context);
        $this->actionButtonPersister->updateActions($manifest$id$defaultLocale$context);
        $this->templatePersister->updateTemplates($manifest$id$context);
        $this->scriptPersister->updateScripts($id$context);
        $this->customFieldPersister->updateCustomFields($manifest$id$context);
        $this->assetService->copyAssetsFromApp($app->getName()$app->getPath());

        $cmsExtensions = $this->appLoader->getCmsExtensions($app);
        if ($cmsExtensions) {
            $this->cmsBlockPersister->updateCmsBlocks($cmsExtensions$id$defaultLocale$context);
        }

        $updatePayload = [
            'id' => $app->getId(),
            'configurable' => $this->handleConfigUpdates($app$manifest$install$context),
            'allowDisable' => $this->doesAllowDisabling($app$context),
        ];
        
Home | Imprint | This part of the site doesn't use cookies.