isBillingAddress example

$page = $checkoutConfirmPageLoader->load(new Request()$this->getContextWithDummyCustomer());

        static::assertInstanceOf(Cart::class$page->getCart());
        static::assertCount(1, $page->getCart()->getErrors());
        static::assertArrayHasKey('billing-address-invalid', $page->getCart()->getErrors()->getElements());

        $error = $page->getCart()->getErrors()->first();

        static::assertNotNull($error);
        static::assertInstanceOf(AddressValidationError::class$error);
        static::assertTrue($error->isBillingAddress());

        static::assertCount(1, $error->getViolations());

        $violation = $error->getViolations()->get(0);

        static::assertNotNull($violation);
        static::assertInstanceOf(ConstraintViolation::class$violation);
        static::assertSame('Test error', $violation->getMessage());
        static::assertSame('root', $violation->getRoot());
        static::assertSame('invalidValue', $violation->getInvalidValue());
    }

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