Inheritance: extends Cake\Auth\BaseAuthenticate
Esempio n. 1
0
 /**
  * test
  *
  * @return void
  */
 public function testAuthenticateDefaultAllFinder()
 {
     Configure::write('Auth.authenticate.all.finder', null);
     $request = new Request('/?api_key=yyy');
     $result = $this->apiKey->authenticate($request, new Response());
     $this->assertEquals('user-1', $result['username']);
 }
 /**
  * test
  *
  * @return void
  */
 public function testAuthenticateHeaderFail()
 {
     $request = $this->getMockBuilder('\\Cake\\Network\\Request')->setMethods(['header'])->getMock();
     $request->expects($this->once())->method('header')->with('api_key')->will($this->returnValue('wrong'));
     $this->apiKey->config('type', 'header');
     $result = $this->apiKey->authenticate($request, new Response());
     $this->assertFalse($result);
 }