DefinitionService example

use Shopware\Core\System\SalesChannel\Entity\SalesChannelDefinitionInstanceRegistry;

/** * @internal * * @covers \Shopware\Core\Framework\Api\ApiDefinition\DefinitionService */
class DefinitionServiceTest extends TestCase
{
    public function testConversionFromStringToApiType(): void
    {
        $definitionService = new DefinitionService(
            $this->createMock(DefinitionInstanceRegistry::class),
            $this->createMock(SalesChannelDefinitionInstanceRegistry::class)
        );

        static::assertNull($definitionService->toApiType('foobar'));
        static::assertSame(DefinitionService::TYPE_JSON_API, $definitionService->toApiType('jsonapi'));
        static::assertSame(DefinitionService::TYPE_JSON, $definitionService->toApiType('json'));
    }
}
Home | Imprint | This part of the site doesn't use cookies.