DemodataCompilerPass example


class DemodataCompilerPassTest extends TestCase
{
    private ContainerBuilder $builder;

    protected function setUp(): void
    {
        $this->builder = new ContainerBuilder();
        $this->builder->setDefinition(DemodataCommand::class(new Definition(DemodataCommand::class))->setPublic(true));
        $this->builder->addCompilerPass(new DemodataCompilerPass());
    }

    /** * @dataProvider definitionProvider */
    public function test(?string $name, ?int $default, ?string $description): void
    {
        $definition = new Definition(\ArrayObject::class);
        $definition->addTag('shopware.demodata_generator', ['option-name' => $name, 'option-default' => $default, 'option-description' => $description]);

        $this->builder->setDefinition('foo', $definition);

        
$container->addCompilerPass(new IncrementerGatewayCompilerPass());
        $container->addCompilerPass(new RedisPrefixCompilerPass());
        $container->addCompilerPass(new AutoconfigureCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1000);

        if ($container->getParameter('kernel.environment') === 'test') {
            $container->addCompilerPass(new DisableRateLimiterCompilerPass());
            $container->addCompilerPass(new ContainerVisibilityCompilerPass());
        }

        $container->addCompilerPass(new FrameworkMigrationReplacementCompilerPass());

        $container->addCompilerPass(new DemodataCompilerPass());

        parent::build($container);
    }

    public function boot(): void
    {
        parent::boot();

        \assert($this->container instanceof ContainerInterface, 'Container is not set yet, please call setContainer() before calling boot(), see `src/Core/Kernel.php:186`.');

        $featureFlags = $this->container->getParameter('shopware.feature.flags');
        
Home | Imprint | This part of the site doesn't use cookies.