Esempio n. 1
0
 public function testAuthenticate()
 {
     $authService = $this->prophesize(AuthenticationService::class);
     $adapter = $this->prophesize(AdapterInterface::class);
     $result = $this->prophesize(Result::class);
     $authenticator = new Authenticator($authService->reveal(), $adapter->reveal());
     $eventManager = StaticEventManager::getInstance();
     // event will be raised
     $eventManager->attach(Authenticator::class, AuthenticationEvent::EVENT_AUTH, function ($e) use($result) {
         $this->assertInstanceOf(AuthenticationEvent::class, $e);
         $e->setResult($result->reveal());
     });
     $returnedResult = $authenticator->authenticate();
     $this->assertSame($result->reveal(), $returnedResult);
 }
Esempio n. 2
0
 /**
  * @param AdapterInterface $adapter
  * @return Result
  */
 public function connect(AdapterInterface $adapter)
 {
     return $this->authService->authenticate($adapter);
 }