Sonata\Test\CustomerBundle\Controller\Api\AddressControllerTest::testPutAddressAction PHP Method

testPutAddressAction() public method

    public function testPutAddressAction()
    {
        $address = $this->getMock('Sonata\\CustomerBundle\\Model\\AddressInterface');
        $addressManager = $this->getMock('Sonata\\Component\\Customer\\AddressManagerInterface');
        $addressManager->expects($this->once())->method('findOneBy')->will($this->returnValue($address));
        $addressManager->expects($this->once())->method('save')->will($this->returnValue($address));
        $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
        $form->expects($this->once())->method('bind');
        $form->expects($this->once())->method('isValid')->will($this->returnValue(true));
        $form->expects($this->once())->method('getData')->will($this->returnValue($address));
        $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
        $formFactory->expects($this->once())->method('createNamed')->will($this->returnValue($form));
        $view = $this->createAddressController($address, $addressManager, $formFactory)->putAddressAction(1, new Request());
        $this->assertInstanceOf('FOS\\RestBundle\\View\\View', $view);
    }