patchRootComposerJson example


    public function testPatchComposerJson(array $composer): void
    {
        $tmpDir = sys_get_temp_dir() . '/flex-migrator-test';
        $fs = new Filesystem();
        $fs->mkdir($tmpDir);
        $fs->dumpFile($tmpDir . '/composer.json', json_encode($composer, \JSON_THROW_ON_ERROR));

        $flexMigrator = new FlexMigrator();

        $flexMigrator->patchRootComposerJson($tmpDir);

        $composerJson = json_decode((string) file_get_contents($tmpDir . '/composer.json'), true);

        static::assertEquals(
            [
                'require' => [
                    'symfony/flex' => '^2',
                    'symfony/runtime' => '^5.0|^6.0',
                ],
                'config' => [
                    'allow-plugins' => [
                        
'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);
        $this->flexMigrator->copyNewTemplateFiles($shopwarePath);
        $this->flexMigrator->migrateEnvFile($shopwarePath);

        return new Response('', Response::HTTP_NO_CONTENT);
    }

    #[Route('/update/_run', name: 'update_run', methods: ['POST'])]     public function run(Request $request): Response
    {
        $version = $request->query->get('shopwareVersion', '');

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