Sonata\Test\BasketBundle\Controller\Api\BasketControllerTest::testPutBasketInvalidAction PHP Method

testPutBasketInvalidAction() public method

    public function testPutBasketInvalidAction()
    {
        $basket = $this->getMock('Sonata\\Component\\Basket\\BasketInterface');
        $basketManager = $this->getMock('Sonata\\Component\\Basket\\BasketManagerInterface');
        $basketManager->expects($this->never())->method('save')->will($this->returnValue($basket));
        $basketManager->expects($this->once())->method('findOneBy')->will($this->returnValue($basket));
        $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));
        $form->expects($this->never())->method('getData')->will($this->returnValue($basket));
        $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
        $formFactory->expects($this->once())->method('createNamed')->will($this->returnValue($form));
        $view = $this->createBasketController($basketManager, null, null, null, $formFactory)->putBasketAction(1, new Request());
        $this->assertInstanceOf('Symfony\\Component\\Form\\FormInterface', $view);
    }