OrderSerializer example


#[Package('system-settings')] class OrderSerializerTest extends TestCase
{
    private OrderSerializer $serializer;

    protected function setUp(): void
    {
        $this->serializer = new OrderSerializer();
        $this->serializer->setRegistry($this->createMock(SerializerRegistry::class));
    }

    public function testSupports(): void
    {
        static::assertTrue($this->serializer->supports('order'));
        static::assertFalse($this->serializer->supports('not_order'));
    }

    /** * @dataProvider serializeDataProvider * * @param array<mixed>|Struct|null $entity * @param array<mixed> $expected */
use OrderFixture;

    private OrderSerializer $serializer;

    private EntityRepository $orderRepository;

    protected function setUp(): void
    {
        $this->orderRepository = $this->getContainer()->get('order.repository');
        $serializerRegistry = $this->getContainer()->get(SerializerRegistry::class);

        $this->serializer = new OrderSerializer();

        $this->serializer->setRegistry($serializerRegistry);
    }

    public function testSerializeOrder(): void
    {
        $order = $this->createOrder();
        static::assertNotNull($order->getBillingAddress());
        static::assertNotNull($order->getOrderCustomer());

        $orderDefinition = $this->getContainer()->get('order.repository')->getDefinition();
        
Home | Imprint | This part of the site doesn't use cookies.