Payum\Klarna\Checkout\Tests\Action\AuthorizeActionTest::shouldThrowReplyWhenStatusCheckoutIncomplete PHP Method

shouldThrowReplyWhenStatusCheckoutIncomplete() public method

    public function shouldThrowReplyWhenStatusCheckoutIncomplete()
    {
        $snippet = 'theSnippet';
        $expectedContent = 'theTemplateContent';
        $expectedTemplateName = 'theTemplateName';
        $expectedContext = array('snippet' => $snippet);
        $testCase = $this;
        $gatewayMock = $this->createGatewayMock();
        $gatewayMock->expects($this->at(1))->method('execute')->with($this->isInstanceOf(RenderTemplate::class))->will($this->returnCallback(function (RenderTemplate $request) use($testCase, $expectedTemplateName, $expectedContext, $expectedContent) {
            $testCase->assertEquals($expectedTemplateName, $request->getTemplateName());
            $testCase->assertEquals($expectedContext, $request->getParameters());
            $request->setResult($expectedContent);
        }));
        $action = new AuthorizeAction($expectedTemplateName);
        $action->setGateway($gatewayMock);
        try {
            $action->execute(new Authorize(array('location' => 'aLocation', 'status' => Constants::STATUS_CHECKOUT_INCOMPLETE, 'gui' => array('snippet' => $snippet), 'merchant' => ['confirmation_uri' => 'theConfirmationUri', 'push_uri' => 'thePushUri', 'checkout_uri' => 'theCheckoutUri', 'terms_uri' => 'theTermsUri'])));
        } catch (HttpResponse $reply) {
            $this->assertEquals($expectedContent, $reply->getContent());
            return;
        }
        $this->fail('Exception expected to be throw');
    }