/** * @test */ public function throwRedirectUrlRequestIfForceTrue() { $apiMock = $this->createApiMock(); $apiMock->expects($this->once())->method('getAuthorizeTokenUrl'); $action = new AuthorizeTokenAction(); $action->setApi($apiMock); $request = new AuthorizeTokenRequest(array('TOKEN' => 'aToken', 'PAYERID' => 'aPayerId'), $force = true); try { $action->execute($request); } catch (RedirectUrlInteractiveRequest $redirectUrlRequest) { return; } $this->fail('RedirectUrlInteractiveRequest exception was expected.'); }
/** * @test */ public function throwRedirectUrlRequestIfForceTrue() { $apiMock = $this->createApiMock(); $apiMock->expects($this->once())->method('getAuthorizeTokenUrl')->will($this->returnValue('theRedirectUrl')); $action = new AuthorizeTokenAction(); $action->setApi($apiMock); $request = new AuthorizeToken(array('TOKEN' => 'aToken', 'PAYERID' => 'aPayerId'), $force = true); try { $action->execute($request); } catch (HttpRedirect $reply) { $this->assertEquals('theRedirectUrl', $reply->getUrl()); return; } $this->fail('HttpRedirect reply was expected to be thrown.'); }