StringInput example

 else {
                    $io->error($key . ': ' . $error->getMessage());
                }
            }
        }

        $skipPluginList = $input->getOption('skipPluginList');
        if ($skipPluginList) {
            return self::SUCCESS;
        }

        $listInput = new StringInput('plugin:list');

        /** @var Application $application */
        $application = $this->getApplication();
        $application->doRun($listInput$output);

        return self::SUCCESS;
    }
}
$this->fileSystem = $this->getContainer()->get('shopware.filesystem.private');
        $this->productExportGenerateCommand = $this->getContainer()->get(ProductExportGenerateCommand::class);

        $salesChannelContextFactory = $this->getContainer()->get(SalesChannelContextFactory::class);
        $this->salesChannelContext = $salesChannelContextFactory->create(Uuid::randomHex()$this->getSalesChannelDomain()->getSalesChannelId());
    }

    public function testExecute(): void
    {
        $this->createTestEntity();

        $input = new StringInput($this->getSalesChannelDomain()->getSalesChannelId());
        $output = new BufferedOutput();

        $this->runCommand($this->productExportGenerateCommand, $input$output);

        $filePath = sprintf('%s/Testexport.csv', $this->getContainer()->getParameter('product_export.directory'));
        $fileContent = $this->fileSystem->read($filePath);

        static::assertIsString($fileContent);
        $csvRows = explode(\PHP_EOL, $fileContent);

        static::assertTrue($this->fileSystem->directoryExists($this->getContainer()->getParameter('product_export.directory')));
        

        $generator = $this->createMock(BundleConfigGenerator::class);
        $generator->method('getConfig')->willReturn([]);
        $tempDir = \sys_get_temp_dir() . '/' . uniqid(__FUNCTION__, true);
        (new Filesystem())->mkdir([$tempDir$tempDir . '/var/']);

        $dumper = new BundleDumpCommand(
            $generator,
            $tempDir
        );

        static::assertSame(0, $dumper->run(new StringInput('')new NullOutput()));
        static::assertFileExists($tempDir . '/var/plugins.json');

        (new Filesystem())->remove($tempDir);
    }

    public function testDumperWritesFileToSpecifiedFilePath(): void
    {
        $generator = $this->createMock(BundleConfigGenerator::class);
        $generator->method('getConfig')->willReturn([]);
        $tempDir = \sys_get_temp_dir() . '/' . uniqid(__FUNCTION__, true);
        (new Filesystem())->mkdir([$tempDir$tempDir . '/var/']);

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

        /** @var array<string> $ids */
        $ids = $this->mediaRepository->searchIds(new Criteria()$this->context)->getIds();
        $this->initialMediaIds = $ids;
    }

    public function testExecuteHappyPath(): void
    {
        $this->createValidMediaFiles();

        $input = new StringInput('');
        $output = new BufferedOutput();

        $this->runCommand($this->generateMediaTypesCommand, $input$output);

        $mediaResult = $this->getNewMediaEntities();
        /** @var MediaEntity $updatedMedia */
        foreach ($mediaResult as $updatedMedia) {
            static::assertInstanceOf(MediaType::class$updatedMedia->getMediaType());
        }
    }

    
/** * @dataProvider provideCheckCommandFixtures * * @param list<string> $expectedOutputSnippets */
    public function testChangelogCheckCommand(string $path, array $expectedOutputSnippets): void
    {
        self::getContainer()->get(ChangelogValidator::class)->setPlatformRoot($path);
        $cmd = self::getContainer()->get(ChangelogCheckCommand::class);

        $output = new BufferedOutput();
        $cmd->run(new StringInput('')$output);

        $outputContents = $output->fetch();

        foreach ($expectedOutputSnippets as $snippet) {
            static::assertStringContainsString($snippet$outputContents);
        }
    }

    /** * @dataProvider provideChangeCommandFixtures * * @param class-string<\Throwable>|null $expectedException * @param list<string> $expectedOutputSnippets */
$this->context = Context::createDefaultContext();

        /** @var array<string> $ids */
        $ids = $this->mediaRepository->searchIds(new Criteria()$this->context)->getIds();
        $this->initialMediaIds = $ids;
    }

    public function testExecuteHappyPath(): void
    {
        $this->createValidMediaFiles();

        $input = new StringInput('');
        $output = new BufferedOutput();

        $this->runCommand($this->thumbnailCommand, $input$output);

        $string = $output->fetch();
        static::assertMatchesRegularExpression('/.*Generated\s*2.*/', $string);
        static::assertMatchesRegularExpression('/.*Skipped\s*' . \count($this->initialMediaIds) . '.*/', $string);

        $medias = $this->getNewMediaEntities();
        foreach ($medias as $updatedMedia) {
            $thumbnails = $updatedMedia->getThumbnails();
            
return $plugins;
        }

        $io->text(sprintf('%s %d plugin(s):', ucfirst($lifecycleMethod), \count($plugins)));
        $io->listing($this->formatPluginList($plugins));

        return $plugins;
    }

    protected function refreshPlugins(): void
    {
        $input = new StringInput('plugin:refresh -s');
        /** @var Application $application */
        $application = $this->getApplication();
        $application->doRun($inputnew NullOutput());
    }

    protected function handleClearCacheOption(InputInterface $input, ShopwareStyle $io, string $action): void
    {
        if ($input->getOption('clearCache')) {
            $io->note('Clearing Cache');

            try {
                
Home | Imprint | This part of the site doesn't use cookies.