extensionNotFoundFromId example

'categories' => ['read'],
                ],
            ],
        ]$exception->getParameters());
    }

    /** * @DisabledFeatures(features={"v6.6.0.0"}) */
    public function testExtensionNotFoundFromId(): void
    {
        $exception = StoreException::extensionNotFoundFromId('123');

        static::assertEquals(
            'Could not find extension with id "123".',
            $exception->getMessage()
        );

        static::assertEquals('FRAMEWORK__EXTENSION_NOT_FOUND', $exception->getErrorCode());
        static::assertEquals(Response::HTTP_NOT_FOUND, $exception->getStatusCode());
    }

    /** * @DisabledFeatures(features={"v6.6.0.0"}) */


        return $app;
    }

    public function getAppEntityFromId(string $id, Context $context): AppEntity
    {
        $criteria = new Criteria([$id]);
        $app = $this->appRepository->search($criteria$context)->getEntities()->first();

        if (!$app instanceof AppEntity) {
            throw StoreException::extensionNotFoundFromId($id);
        }

        return $app;
    }

    protected function getDecorated(): AbstractExtensionDataProvider
    {
        throw new DecorationPatternException(self::class);
    }
}

class ExtensionNotFoundExceptionTest extends TestCase
{
    /** * @DisabledFeatures(features={"v6.6.0.0"}) */
    public function testGetErrorCode(): void
    {
        static::assertSame(
            'FRAMEWORK__EXTENSION_NOT_FOUND',
            ExtensionNotFoundException::extensionNotFoundFromId('123')->getErrorCode()
        );
    }

    /** * @DisabledFeatures(features={"v6.6.0.0"}) */
    public function testGetStatusCode(): void
    {
        static::assertSame(
            Response::HTTP_NOT_FOUND,
            ExtensionNotFoundException::fromTechnicalName('test-app')->getStatusCode()
        );
Home | Imprint | This part of the site doesn't use cookies.