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

shouldAddNotifyUrlIfTokenFactorySetAndCaptureTokenPassed() public method

    public function shouldAddNotifyUrlIfTokenFactorySetAndCaptureTokenPassed()
    {
        $details = new \ArrayObject(array('foo' => 'fooVal'));
        $captureToken = new Token();
        $captureToken->setGatewayName('theGatewayName');
        $captureToken->setDetails($details);
        $notifyToken = new Token();
        $notifyToken->setTargetUrl('theNotifyUrl');
        $tokenFactoryMock = $this->getMock(GenericTokenFactoryInterface::class);
        $tokenFactoryMock->expects($this->once())->method('createNotifyToken')->with('theGatewayName', $this->identicalTo($details))->will($this->returnValue($notifyToken));
        $action = new CaptureAction();
        $action->setGateway($this->createGatewayMock());
        $action->setGenericTokenFactory($tokenFactoryMock);
        $request = new Capture($captureToken);
        $request->setModel($details);
        $action->execute($request);
        $this->assertArrayHasKey('PAYMENTREQUEST_0_NOTIFYURL', $details);
        $this->assertEquals('theNotifyUrl', $details['PAYMENTREQUEST_0_NOTIFYURL']);
        $this->assertArrayHasKey('foo', $details);
        $this->assertEquals('fooVal', $details['foo']);
    }