ExtensionStruct example

// secret from login.json         static::assertEquals(
            'shop.secret',
            $this->configService->get('core.store.shopSecret')
        );
    }

    public function testItRequestsUpdatesForLoggedInUser(): void
    {
        $pluginList = new ExtensionCollection();
        $pluginList->add((new ExtensionStruct())->assign([
            'name' => 'TestExtension',
            'version' => '1.0.0',
        ]));

        $this->getRequestHandler()->append(new Response(200, [], \json_encode([
            'data' => [],
        ], \JSON_THROW_ON_ERROR)));

        $updateList = $this->storeClient->getExtensionUpdateList($pluginList$this->storeContext);

        static::assertEquals([]$updateList);

        
$this->getStoreClient(__DIR__ . './../_fixtures/responses/extension-green.json'),
            $this->getExtensionDataProvider()
        );

        $extensionStructs = $pluginCompatibility->getExtensionsToDeactivate(new Version(), Context::createDefaultContext());

        static::assertCount(0, $extensionStructs);
    }

    public function getExtensionDataProvider(): AbstractExtensionDataProvider&MockObject
    {
        $extension = new ExtensionStruct();
        $extension->setName('TestApp');
        $extension->setActive(true);

        $extensionDataProvider = $this->createMock(AbstractExtensionDataProvider::class);
        $extensionDataProvider
            ->method('getInstalledExtensions')
            ->willReturn(new ExtensionCollection(['TestApp' => $extension]));

        return $extensionDataProvider;
    }

    
$this->extensionListingLoader = $this->getContainer()->get(ExtensionListingLoader::class);
    }

    public function testServerNotReachable(): void
    {
        $this->getRequestHandler()->reset();
        $this->getRequestHandler()->append(function D): void {
            throw new ClientException('', new Request('GET', '')new Response(500, [], ''));
        });

        $collection = new ExtensionCollection();
        $collection->set('myPlugin', (new ExtensionStruct())->assign(['name' => 'myPlugin', 'label' => 'Label', 'version' => '1.0.0']));
        $collection = $this->extensionListingLoader->load($collection$this->createAdminStoreContext());

        static::assertCount(1, $collection);
    }

    public function testExternalAreAdded(): void
    {
        $this->getRequestHandler()->reset();
        $this->getRequestHandler()->append(new Response(200, [], '{"data":[]}'));
        $this->getRequestHandler()->append(new Response(200, []$this->getLicencesJson()));

        
$events = [];

        $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
        $eventDispatcher
            ->method('dispatch')
            ->willReturnCallback(function D$event) use (&$events): object {
                $events[] = $event;

                return $event;
            });

        $extension = new ExtensionStruct();
        $extension->setName('test');
        $extension->setType(ExtensionStruct::EXTENSION_TYPE_APP);

        $pluginCompatibility = $this->createMock(ExtensionCompatibility::class);
        $pluginCompatibility
            ->method('getExtensionsToDeactivate')
            ->willReturn([$extension$extension]);

        $updateController = new UpdateController(
            $this->createMock(ApiClient::class),
            $this->createMock(WriteableCheck::class),
            
static::assertSame($result->getTotal()$result->getOffset());
    }

    public function testRunShouldDeactivateOneAndFinishDirectly(): void
    {
        $version = new Version();
        $version->assign([
            'version' => '6.6.0.0',
        ]);

        $extension = new ExtensionStruct();
        $extension->setId(1);
        $extension->setName('TestApp');
        $extension->setType(ExtensionStruct::EXTENSION_TYPE_APP);

        $pluginCompatibility = $this->createMock(ExtensionCompatibility::class);
        $pluginCompatibility
            ->method('getExtensionsToDeactivate')
            ->willReturn([$extension]);

        $systemConfigService = $this->createMock(SystemConfigService::class);

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