Exemplo n.º 1
0
 public function testAuthFacade()
 {
     $provider = new TestAuthProvider();
     $authy = new AuthedUser('brooke', 1);
     $provider->setRetrieve($authy);
     $cubex = new Cubex();
     $cubex->configure(new TestConfigProvider());
     $cubex->processConfiguration($cubex->getConfiguration());
     $cubex->instance('request', Request::createFromGlobals());
     $cubex->instance('\\Cubex\\Auth\\IAuthProvider', $provider);
     $sm = new ServiceManager();
     $sm->setCubex($cubex);
     $sm->boot();
     Auth::setFacadeApplication($cubex);
     $username = '******';
     $this->assertTrue(Auth::forgottenPassword($username));
     $authUser = Auth::login($username, 'password');
     $this->assertEquals("brooke", $authUser->getUsername());
     $autho = Auth::getAuthedUser();
     $this->assertEquals("brooke", $autho->getUsername());
     Auth::updateAuthedUser($autho);
     $this->assertTrue(Auth::isLoggedIn());
     $this->assertTrue(Auth::logout());
     $this->assertFalse(Auth::isLoggedIn());
 }