Sonata\tests\Component\Payment\Scellius\ScelliusPaymentTest::testSendConfirmationReceipt PHP Метод

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

    public function testSendConfirmationReceipt()
    {
        $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface');
        $templating = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface');
        $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
        $generator = $this->getMock('Sonata\\Component\\Payment\\Scellius\\ScelliusTransactionGeneratorInterface');
        $payment = new ScelliusPayment($router, $logger, $templating, $generator, true);
        $payment->setOptions(array('base_folder' => __DIR__, 'response_command' => 'cat response_ko.txt && echo '));
        $transaction = $this->getMock('Sonata\\Component\\Payment\\TransactionInterface');
        $transaction->expects($this->any())->method('get')->will($this->returnValue('" >> /dev/null'));
        $transaction->expects($this->any())->method('getParameters')->will($this->returnValue(array()));
        $transaction->expects($this->any())->method('getOrder')->will($this->returnValue($this->getMock('Sonata\\Component\\Order\\OrderInterface')));
        $this->assertFalse($payment->sendConfirmationReceipt($transaction));
        $payment->setOptions(array('base_folder' => __DIR__, 'response_command' => 'cat response_nok.txt && echo '));
        $this->assertFalse($payment->sendConfirmationReceipt($transaction));
        $payment->setOptions(array('base_folder' => __DIR__, 'response_command' => 'cat response_code_nok.txt && echo '));
        $this->assertFalse($payment->sendConfirmationReceipt($transaction));
        $payment->setOptions(array('base_folder' => __DIR__, 'response_command' => 'cat response_ok.txt && echo '));
        $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $payment->sendConfirmationReceipt($transaction));
    }