sendConfirmationReceipt() public method

public sendConfirmationReceipt ( Sonata\Component\Payment\TransactionInterface $transaction )
$transaction Sonata\Component\Payment\TransactionInterface
Example #1
0
 public function testSendConfirmationReceipt()
 {
     $order = new CheckPaymentTest_Order();
     $transaction = $this->getMock('Sonata\\Component\\Payment\\TransactionInterface');
     $transaction->expects($this->exactly(2))->method('getOrder')->will($this->onConsecutiveCalls(null, $order));
     $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
     $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface');
     $browser = new Browser();
     $payment = new CheckPayment($router, $logger, $browser);
     $payment->setCode('free_1');
     // first call : the order is not set
     $response = $payment->sendConfirmationReceipt($transaction);
     $this->assertFalse($response, '::sendConfirmationReceipt return false on invalid order');
     // second call : the order is set
     $response = $payment->sendConfirmationReceipt($transaction);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response, '::sendConfirmationReceipt return a Response object');
     $this->assertEquals('ok', $response->getContent(), '::getContent returns ok');
 }