Sonata\Test\CustomerBundle\Controller\Api\CustomerControllerTest::testPutCustomerInvalidAction PHP Метод

testPutCustomerInvalidAction() публичный Метод

    public function testPutCustomerInvalidAction()
    {
        $customer = $this->getMock('Sonata\\CustomerBundle\\Model\\CustomerInterface');
        $customerManager = $this->getMock('Sonata\\Component\\Customer\\CustomerManagerInterface');
        $customerManager->expects($this->once())->method('findOneBy')->will($this->returnValue($customer));
        $customerManager->expects($this->never())->method('save')->will($this->returnValue($customer));
        $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
        $form->expects($this->once())->method('bind');
        $form->expects($this->once())->method('isValid')->will($this->returnValue(false));
        $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
        $formFactory->expects($this->once())->method('createNamed')->will($this->returnValue($form));
        $view = $this->createCustomerController($customer, $customerManager, null, $formFactory)->putCustomerAction(1, new Request());
        $this->assertInstanceOf('Symfony\\Component\\Form\\FormInterface', $view);
    }