Sonata\Tests\Component\Transformer\BasketTransformerTest::testInvalidDeliveryAddress PHP Method

testInvalidDeliveryAddress() public method

    public function testInvalidDeliveryAddress()
    {
        $this->setExpectedException('RuntimeException', 'Invalid delivery address');
        $basket = new Basket();
        $customer = $this->getMock('Sonata\\Component\\Customer\\CustomerInterface');
        $billingAddress = $this->getMock('Sonata\\Component\\Customer\\AddressInterface');
        $paymentMethod = $this->getMock('Sonata\\Component\\Payment\\PaymentInterface');
        $deliveryMethod = $this->getMock('Sonata\\Component\\Delivery\\ServiceDeliveryInterface');
        $deliveryMethod->expects($this->once())->method('isAddressRequired')->will($this->returnValue(true));
        $basket->setCustomer($customer);
        $basket->setBillingAddress($billingAddress);
        $basket->setDeliveryMethod($deliveryMethod);
        $basket->setPaymentMethod($paymentMethod);
        $currency = new Currency();
        $currency->setLabel('EUR');
        $basket->setCurrency($currency);
        $this->getBasketTransform()->transformIntoOrder($basket);
    }