updateApps example

static::assertNotFalse($licensesJson);
        static::assertNotFalse($swagAppJson);

        $this->getRequestHandler()->append(new Response(200, [], '{}'));
        $this->getRequestHandler()->append(new Response(200, []$licensesJson));
        $this->getRequestHandler()->append(new Response(200, [], '{"location": "http://localhost/my.zip", "type": "app"}'));
        $this->getRequestHandler()->append(new Response(200, []$swagAppJson));
        $expectedLocation = $this->getContainer()->getParameter('kernel.app_dir') . '/SwagApp';

        try {
            $this->updater->updateApps($this->context);

            $apps = $this->appRepo->search(new Criteria()$this->context);

            static::assertEquals(1, $apps->count());
            /** @var AppEntity $testApp */
            $testApp = $apps->first();
            static::assertEquals('2.0.0', $testApp->getVersion());
        } finally {
            (new Filesystem())->remove($expectedLocation);
        }
    }

    

    public function __construct(
        EntityRepository $scheduledTaskRepository,
        private readonly AbstractAppUpdater $appUpdater
    ) {
        parent::__construct($scheduledTaskRepository);
    }

    public function run(): void
    {
        $this->appUpdater->updateApps(Context::createDefaultContext());
    }
}
Home | Imprint | This part of the site doesn't use cookies.