/** @test */ public function getIdentity_shouldReturnTheUserCorrespondingToTheAccessToken_inQuery() { $this->oauthRequest->query['access_token'] = 'at123'; $this->oauthServer->shouldReceive('getAccessTokenData')->with($this->oauthRequest)->andReturn(['user_id' => 'jimmy']); $identity = M::mock('\\Aeris\\ZfAuth\\Identity\\IdentityInterface'); $this->identityRepository->shouldReceive('findByUsername')->with('jimmy')->andReturn($identity); $this->assertSame($identity, $this->identityProvider->getIdentity()); }