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()); }
public function testServiceAliases() { $cubex = new Cubex(); $cubex->configure(new TestConfigProvider()); $manager = new ServiceManager(); $manager->setCubex($cubex); $manager->boot(); $encrypter = $cubex->make('encrypter'); $this->assertInstanceOf('\\Illuminate\\Encryption\\Encrypter', $encrypter); }
/** * Boot Cubex, Setup Facades, & Service Providers */ public function boot() { if ($this->_booted) { return null; } //Fix anything that hasnt been set by the projects bootstrap $this->prepareCubex(); //Bind services $this->processConfiguration($this->getConfiguration()); //Setup facades Facade::clearResolvedInstances(); Facade::setFacadeApplication($this); FacadeLoader::register(); //Setup Service Providers $serviceManager = new ServiceManager(); $serviceManager->setCubex($this); $serviceManager->boot(); $this->instance('service.manager', $serviceManager); $this->_booted = true; }