Sonata\Tests\Component\Payment\CheckPaymentTest::testSendConfirmationReceipt PHP Метод

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

    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');
    }