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

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

    public function testPostCustomerAction()
    {
        $customer = $this->getMock('Sonata\\CustomerBundle\\Model\\CustomerInterface');
        $customerManager = $this->getMock('Sonata\\Component\\Customer\\CustomerManagerInterface');
        $customerManager->expects($this->once())->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(true));
        $form->expects($this->once())->method('getData')->will($this->returnValue($customer));
        $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('FOS\\RestBundle\\View\\View', $view);
    }