Payum\Paypal\ExpressCheckout\Nvp\Tests\Action\CaptureActionTest::shouldSetTokenTargetUrlAsCancelUrlIfCapturePassedWithToken PHP Method

shouldSetTokenTargetUrlAsCancelUrlIfCapturePassedWithToken() public method

    public function shouldSetTokenTargetUrlAsCancelUrlIfCapturePassedWithToken()
    {
        $testCase = $this;
        $cancelUrl = 'http://thecancelurl/';
        $expectedCancelUrl = $cancelUrl . '?cancelled=1';
        $token = new Token();
        $token->setTargetUrl($cancelUrl);
        $token->setDetails(array());
        $gatewayMock = $this->createGatewayMock();
        $gatewayMock->expects($this->at(0))->method('execute')->with($this->isInstanceOf(GetHttpRequest::class));
        $gatewayMock->expects($this->at(1))->method('execute')->with($this->isInstanceOf(SetExpressCheckout::class))->will($this->returnCallback(function ($request) use($testCase, $expectedCancelUrl) {
            $model = $request->getModel();
            $testCase->assertEquals($expectedCancelUrl, $model['CANCELURL']);
        }));
        $action = new CaptureAction();
        $action->setGateway($gatewayMock);
        $request = new Capture($token);
        $request->setModel(array());
        $action->execute($request);
    }