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

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

    public function testPostCustomerInvalidAction()
    {
        $customer = $this->getMock('Sonata\\CustomerBundle\\Model\\CustomerInterface');
        $customerManager = $this->getMock('Sonata\\Component\\Customer\\CustomerManagerInterface');
        $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(null, $customerManager, null, $formFactory)->postCustomerAction(new Request());
        $this->assertInstanceOf('Symfony\\Component\\Form\\FormInterface', $view);
    }