Beispiel #1
0
 public function testExceptionHandlerPopulatesErrorMessage()
 {
     $this->login->shouldReceive('login')->andThrow('Aura\\Auth\\Exception\\MultipleMatches');
     $this->service->authenticate();
     $this->assertTrue($this->service->hasError());
     $this->assertEquals('There were multiple matches for your credentials in the database.', $this->service->getError(true));
     $this->assertEquals(['message', 'exception'], array_keys($this->service->getError()));
 }
Beispiel #2
0
 public function checkAuth(Route $requestedRoute)
 {
     $auth = $this->authService->resume();
     if (!$auth->isValid()) {
         return $this->redirectRoute;
     }
     return $requestedRoute;
 }
Beispiel #3
0
 /**
  * @param Config $config
  * @param Router\RouteManager $router
  * @param Auth\Service $authService
  * @param Log\Manager $handler
  * @param ResponseManager $responseManager
  * @throws Log\Exception\LoggerNotRegistered
  */
 public function __construct(Config $config, Di\Container $di, Router\RouteManager $router, Auth\Service $authService, Log\Manager $handler, ResponseManager $responseManager)
 {
     $this->config = $config;
     $this->serviceLocator = $di;
     $this->router = $router;
     $this->authService = $authService;
     $this->errorLog = $handler->getLogger('error');
     $this->eventLog = $handler->getLogger('event');
     $this->responseManager = $responseManager;
     $this->authService->resume();
 }