Example #1
0
 /**
  * Ensures that identifyUser method sets a user id on the request model when
  * using the bearer token type
  *
  * @return void
  *
  * @test
  */
 public function identifyUserWithBearerTokenTypeSetsUserIdForValidHeader()
 {
     $request = new \Request($this->config, ['HTTPS' => 'on']);
     $mockOauth = $this->getMock('OAuthModel', array(), array(), '', false);
     $mockOauth->expects($this->once())->method('verifyAccessToken')->with('authPart')->will($this->returnValue('TheUserId'));
     $request->setOauthModel($mockOauth);
     $request->identifyUser(null, 'Bearer authPart');
     $this->assertEquals('TheUserId', $request->user_id);
     $this->assertEquals('TheUserId', $request->getUserId());
 }