isFlexProject example

$currentShopwareVersion = $this->recoveryManager->getCurrentShopwareVersion($shopwarePath);
        $latestVersions = $this->getLatestVersions($request);

        if (empty($latestVersions)) {
            return $this->redirectToRoute('finish');
        }

        return $this->render('update.html.twig', [
            'shopwarePath' => $shopwarePath,
            'currentShopwareVersion' => $currentShopwareVersion,
            'isFlexProject' => $this->recoveryManager->isFlexProject($shopwarePath),
            'versions' => $latestVersions,
        ]);
    }

    #[Route('/update/_migrate-template', name: 'migrate-template', methods: ['POST'])]     public function migrateTemplate(): Response
    {
        $shopwarePath = $this->recoveryManager->getShopwareLocation();

        $this->flexMigrator->cleanup($shopwarePath);
        $this->flexMigrator->patchRootComposerJson($shopwarePath);
        
 \JSON_THROW_ON_ERROR));

        static::expectException(\RuntimeException::class);
        static::expectExceptionMessage('Could not find Shopware in composer.lock file');
        $recoveryManager->getCurrentShopwareVersion($tmpDir);
    }

    public function testSymfonyLock(): void
    {
        $recoveryManager = new RecoveryManager();

        static::assertFalse($recoveryManager->isFlexProject(__DIR__));

        $tmpDir = sys_get_temp_dir() . '/' . uniqid('shopware', true);

        $fs = new Filesystem();

        $fs->mkdir($tmpDir);
        $fs->dumpFile($tmpDir . '/symfony.lock', json_encode([], \JSON_THROW_ON_ERROR));

        static::assertTrue($recoveryManager->isFlexProject($tmpDir));
    }

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