public handleError ( |
||
$request | ||
$basket | Sonata\Component\Basket\BasketInterface |
/** * @expectedException \Doctrine\ORM\EntityNotFoundException */ public function testHandleErrorEntityNotFoundException() { $payment = $this->getMock('Sonata\\Component\\Payment\\PaymentInterface'); $payment->expects($this->once())->method('getOrderReference')->will($this->returnValue('42')); $om = $this->getMock('Sonata\\Component\\Order\\OrderManagerInterface'); $om->expects($this->once())->method('findOneBy')->will($this->returnValue(null)); $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(); $handler = new PaymentHandler($om, $ps, $ref, $tm, $nb); $request = new Request(); $basket = $this->getMock('Sonata\\Component\\Basket\\BasketInterface'); $errorOrder = $handler->handleError($request, $basket); $this->assertEquals($errorOrder, null); }