/** * Tests \OAuth2\Server\Server->grantAccessToken() with successful Auth code grant, but without redreict_uri in the input */ public function testGrantAccessTokenWithGrantAuthCodeSuccessWithoutRedirect() { $inputData = array('grant_type' => \OAuth2\Server\Server::GRANT_TYPE_AUTH_CODE, 'client_id' => 'my_little_app', 'client_secret' => 'b', 'code' => 'foo'); $storedToken = array('redirect_uri' => 'http://www.example.com', 'client_id' => 'my_little_app', 'expires' => time() + 60); $mockStorage = $this->createBaseMock('\\OAuth2\\Grant\\GrantCodeInterface'); $mockStorage->expects($this->any())->method('getAuthCode')->will($this->returnValue($storedToken)); // Successful token grant will return a JSON encoded token: $this->expectOutputRegex('/{"access_token":".*","expires_in":\\d+,"token_type":"bearer"/'); $this->fixture = new \OAuth2\Server\Server($mockStorage); $this->fixture->setVariable(\OAuth2\Server\Server::CONFIG_ENFORCE_INPUT_REDIRECT, false); $this->fixture->grantAccessToken($inputData, array()); }
/** * * @see Server::grantAccessToken() */ public function grantAccessToken($input = null, $authHeaders = null) { $data = parent::grantAccessToken($input, $authHeaders); $data['refresh_token'] = $data['_id']; unset($data['_id']); return $data; }
/** * Tests \OAuth2\Server\Server->finishClientAuthorization() */ public function testFinishClientAuthorization() { // TODO Auto-generated OAuth2Test->testFinishClientAuthorization() $this->markTestIncomplete("finishClientAuthorization test not implemented"); $this->fixture->finishClientAuthorization(); }