public function setUp() { $this->requestMethod = 'GET'; $this->requestUrl = 'http://photos.example.net/photos'; $this->token = new OAuthToken(); $this->token->setRequestMethod($this->requestMethod); $this->token->setRequestUrl($this->requestUrl); $consumerProvider = new ConsumerProviderMock(); $tokenProvider = new TokenProviderMock(); $nonceProvider = new NonceProviderMock(); $fixedTimestamp = new \DateTime(); $fixedTimestamp->setTimestamp(1433160000); $clock = new FrozenClock($fixedTimestamp); $this->oauthServerService = new OAuthServerServiceMock($consumerProvider, $tokenProvider, $nonceProvider, $clock); $this->signatureService = new OAuthHmacSha1Signature(); $this->oauthServerService->addSignatureService($this->signatureService); $userProvider = new UserProviderMock(); $this->oauthAuthenticationProvider = new OAuthAuthenticationProvider($userProvider, $this->oauthServerService); }
public function testValidateRequestTokenError() { $requestParameters = $this->requestParameters; $requestParameters['oauth_token'] = 'returnBadToken'; $requestParameters['oauth_timestamp'] = 1433160000; $signature = 'btZnOkU+lCRSAAK5q9riQc4VbZE='; $requestParameters['oauth_signature'] = $signature; $this->oauthServerService->addSignatureService($this->signatureService); $this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\HttpException', 'token_rejected'); $hasBeenValidated = $this->oauthServerService->validateRequest($requestParameters, $this->requestMethod, $this->requestUrl); }