Sonata\Tests\Component\Payment\PaymentHandlerTest::testHandleErrorInvalidTransactionException PHP Method

testHandleErrorInvalidTransactionException() public method

    public function testHandleErrorInvalidTransactionException()
    {
        $payment = $this->getMock('Sonata\\Component\\Payment\\PaymentInterface');
        $order = $this->getMock('Sonata\\Component\\Order\\OrderInterface');
        $om = $this->getMock('Sonata\\Component\\Order\\OrderManagerInterface');
        $ps = $this->getMock('Sonata\\Component\\Payment\\PaymentSelectorInterface');
        $ps->expects($this->exactly(2))->method('getPayment')->will($this->returnValue($payment));
        $ref = $this->getMock('Sonata\\Component\\Generator\\ReferenceInterface');
        $tm = $this->getMock('Sonata\\Component\\Payment\\TransactionManagerInterface');
        $tm->expects($this->once())->method('create')->will($this->returnValue(new Transaction()));
        $nb = $this->getMockBuilder('Sonata\\NotificationBundle\\Backend\\RuntimeBackend')->disableOriginalConstructor()->getMock();
        $eventDispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
        $handler = new PaymentHandler($om, $ps, $ref, $tm, $nb, $eventDispatcher);
        $request = new Request();
        $basket = $this->getMock('Sonata\\Component\\Basket\\BasketInterface');
        $errorOrder = $handler->handleError($request, $basket);
        $this->assertEquals($errorOrder, $order);
    }