getAppLifecycle example


        $expected = 'domains';
        static::assertSame($expected, DomainsDeltaProvider::DELTA_NAME);
        static::assertSame($expected(new DomainsDeltaProvider())->getDeltaName());
    }

    public function testGetDomainsDelta(): void
    {
        $context = Context::createDefaultContext();
        $manifest = $this->getTestManifest();

        $this->getAppLifecycle()->install($manifest, false, $context);

        $criteria = (new Criteria())
            ->addFilter(new EqualsFilter('name', 'test'))
            ->addAssociation('acl_role');

        /** @var AppEntity $app */
        $app = $this->getAppRepository()
            ->search($criteria$context)
            ->first();

        // Modify the existing privileges to get a delta

class AppLifecycleTest extends TestCase
{
    public function testInstallNotCompatibleApp(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/../_fixtures/manifest.xml');
        $manifest->getMetadata()->assign(['compatibility' => '~7.0.0']);

        $appRepository = $this->createMock(EntityRepository::class);
        $appRepository->expects(static::never())->method('upsert');

        $appLifecycle = $this->getAppLifecycle(new StaticEntityRepository([])new StaticEntityRepository([]), null, $this->createMock(AppLoader::class));

        static::expectException(AppException::class);
        static::expectExceptionMessage('App test is not compatible with this Shopware version');
        $appLifecycle->install($manifest, false, Context::createDefaultContext());
    }

    public function testUpdateNotCompatibleApp(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/../_fixtures/manifest.xml');
        $manifest->getMetadata()->assign(['compatibility' => '~7.0.0']);

        

        $expected = 'permissions';
        static::assertSame($expected, PermissionsDeltaProvider::DELTA_NAME);
        static::assertSame($expected(new PermissionsDeltaProvider())->getDeltaName());
    }

    public function testGetPermissionsDelta(): void
    {
        $context = Context::createDefaultContext();
        $manifest = $this->getTestManifest();

        $this->getAppLifecycle()->install($manifest, false, $context);

        $criteria = (new Criteria())
            ->addFilter(new EqualsFilter('name', 'test'))
            ->addAssociation('acl_role');

        /** @var AppEntity $app */
        $app = $this->getAppRepository()
            ->search($criteria$context)
            ->first();

        static::assertNotNull($app->getAclRole());

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