getInstalledInactivePlugin example

$this->insertPlugin($this->getActivePlugin());

        $loader = new StaticKernelPluginLoader($this->classLoader);
        $this->kernel = $this->makeKernel($loader);
        $this->kernel->boot();

        static::assertEmpty($this->kernel->getPluginLoader()->getPluginInstances()->all());
    }

    public function testInactive(): void
    {
        $this->insertPlugin($this->getInstalledInactivePlugin());

        $loader = new DbalKernelPluginLoader($this->classLoader, null, $this->connection);
        $this->kernel = $this->makeKernel($loader);
        $this->kernel->boot();

        $plugins = $this->kernel->getPluginLoader()->getPluginInstances();
        static::assertNotEmpty($plugins->all());

        $testPlugin = $plugins->get(SwagTest::class);
        static::assertNotNull($testPlugin);

        
'autoload' => ['psr-4' => ['SwagTestSkipRebuild\\' => 'src/']],
            'createdAt' => new \DateTimeImmutable('2019-01-01'),
            'managedByComposer' => false,
        ]);
        $plugin->setInstalledAt(new \DateTimeImmutable());

        return $plugin;
    }

    protected function getActivePlugin(): PluginEntity
    {
        $active = $this->getInstalledInactivePlugin();
        $active->setActive(true);

        return $active;
    }

    protected function getActivePluginWithBundle(): PluginEntity
    {
        $plugin = new PluginEntity();
        $plugin->assign([
            'id' => Uuid::randomHex(),
            'name' => 'SwagTestWithBundle',
            
static::assertCount(1, $loader->getPluginInfos());

        $class = $activePluginData['baseClass'];
        $kernelPlugin = $loader->getPluginInstances()->get($class);
        static::assertNotEmpty($kernelPlugin);
        static::assertSame($kernelPlugin$loader->getPluginInstance($class));
    }

    public function testGetPluginInstanceNotActive(): void
    {
        $pluginData = $this->getInstalledInactivePlugin()->jsonSerialize();
        $loader = new StaticKernelPluginLoader($this->classLoader, null, [$pluginData]);
        $loader->initializePlugins(TEST_PROJECT_DIR);

        static::assertCount(1, $loader->getPluginInfos());

        $class = $pluginData['baseClass'];
        $kernelPlugin = $loader->getPluginInstances()->get($class);
        static::assertNotEmpty($kernelPlugin);
        static::assertNull($loader->getPluginInstance($class));
    }

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