Sonata\tests\Component\Payment\Scellius\ScelliusPaymentTest::testValidSendbankPayment PHP Method

testValidSendbankPayment() public method

    public function testValidSendbankPayment()
    {
        $logger = $this->getMock('Symfony\\Component\\HttpKernel\\Log\\LoggerInterface');
        $templating = $this->getMock('Symfony\\Bundle\\FrameworkBundle\\Templating\\EngineInterface');
        $templating->expects($this->once())->method('renderResponse')->will($this->returnCallback(array($this, 'callbackValidsendbank')));
        $generator = $this->getMock('Sonata\\Component\\Payment\\Scellius\\ScelliusTransactionGeneratorInterface');
        $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface');
        $date = new \DateTime();
        $date->setTimeStamp(strtotime('30/11/1981'));
        $date->setTimezone(new \DateTimeZone('Europe/Paris'));
        $customer = $this->getMock('Sonata\\Component\\Customer\\CustomerInterface');
        $customer->expects($this->once())->method('getId')->will($this->returnValue(42));
        $customer->expects($this->once())->method('getEmail')->will($this->returnValue('[email protected]'));
        $order = new ScelliusPaymentTest_Order();
        $order->setCreatedAt($date);
        $order->setId(2);
        $order->setReference('FR');
        $currency = new Currency();
        $currency->setLabel('EUR');
        $order->setCurrency($currency);
        $order->setCustomer($customer);
        $order->setLocale('es');
        $payment = new ScelliusPayment($router, $logger, $templating, $generator, true);
        $payment->setCode('free_1');
        $payment->setOptions(array('base_folder' => __DIR__, 'request_command' => 'cat request_ok.txt && echo '));
        $response = $payment->sendbank($order);
        $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $response);
    }