DemodataRequest example

use Symfony\Component\Console\Input\ArrayInput;

/** * @internal * * @covers \Shopware\Core\Framework\Demodata\Event\DemodataRequestCreatedEvent */
class DemodataRequestCreatedEventTest extends TestCase
{
    public function testGetter(): void
    {
        $request = new DemodataRequest();
        $context = Context::createDefaultContext();
        $input = new ArrayInput([]);

        $event = new DemodataRequestCreatedEvent(
            $request,
            $context,
            $input
        );

        static::assertEquals($request$event->getRequest());
        static::assertEquals($context$event->getContext());
        
if ($this->kernelEnv !== 'prod') {
            $output->writeln('Demo data command should only be used in production environment. You can provide the environment as follows `APP_ENV=prod bin/console framework:demodata`');

            return self::INVALID;
        }

        $io = new ShopwareStyle($input$output);
        $io->title('Demodata Generator');

        $context = Context::createDefaultContext();

        $request = new DemodataRequest();

        $request->add(TagDefinition::class$this->getCount($input, 'tags'));
        $request->add(RuleDefinition::class$this->getCount($input, 'rules'));
        $request->add(MediaDefinition::class$this->getCount($input, 'media'));
        $request->add(CustomerDefinition::class$this->getCount($input, 'customers'));
        $request->add(PropertyGroupDefinition::class$this->getCount($input, 'properties'));
        $request->add(CategoryDefinition::class$this->getCount($input, 'categories'));
        $request->add(ProductManufacturerDefinition::class$this->getCount($input, 'manufacturers'));
        $request->add(ProductDefinition::class$this->getCount($input, 'products'));
        $request->add(ProductStreamDefinition::class$this->getCount($input, 'product-streams'));
        $request->add(PromotionDefinition::class$this->getCount($input, 'promotions'));
        
Home | Imprint | This part of the site doesn't use cookies.