UpdateController example


class UpdateControllerTest extends TestCase
{
    public function testCheckForUpdatesNoUpdate(): void
    {
        $apiClient = $this->createMock(ApiClient::class);
        $apiClient
            ->method('checkForUpdates')
            ->willReturn(new Version(['version' => '6.5.1.0', 'date' => '2020-01-01']));

        $updateController = new UpdateController(
            $apiClient,
            $this->createMock(WriteableCheck::class),
            $this->createMock(LicenseCheck::class),
            $this->createMock(ExtensionCompatibility::class),
            $this->createMock(EventDispatcherInterface::class),
            $this->createMock(SystemConfigService::class),
            $this->createMock(AbstractExtensionLifecycle::class),
            '6.5.1.0'
        );

        $response = $updateController->updateApiCheck();

        

class UpdateControllerTest extends TestCase
{
    public function testRedirectWhenNotInstalled(): void
    {
        $recoveryManager = $this->createMock(RecoveryManager::class);

        $recoveryManager
            ->method('getShopwareLocation')
            ->willThrowException(new \RuntimeException('Could not find Shopware installation'));

        $controller = new UpdateController(
            $recoveryManager,
            $this->createMock(ReleaseInfoProvider::class),
            $this->createMock(FlexMigrator::class),
            $this->createMock(StreamedCommandResponseGenerator::class),
        );

        $controller->setContainer($this->getContainer());

        $request = new Request();
        $request->setSession(new Session(new MockArraySessionStorage()));
        $response = $controller->index($request);

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