public function setUp() { GladProvider::set(['DatabaseServiceInterface' => 'Glad\\Grants\\DatabaseService', 'SessionHandlerInterface' => 'Glad\\Mocks\\SessionMock', 'CookerInterface' => 'Glad\\Mocks\\CookerMock']); $this->constants = new Constants(); $this->sessionId = md5(time()); $activeDriver = $this->constants->repository['driver']; $config = $this->constants->repository['options'][$activeDriver]; $this->glad = new Glad(); $this->injector = new Injector(); $this->repositoryHandler = new RepositoryHandler(); $this->repositoryHandler->save('cookie', [$config['name'] => $this->sessionId]); $this->injector->add('db', 'Glad\\Mocks\\DatabaseMock'); $this->author = new Author($this->constants, new CookerMock(), $this->injector, new Crypt(), new DatabaseService(), new SessionMock(), new Dispatcher()); $this->glad->setup(['uniqueField' => 'id', 'table' => 'users', 'fields' => ['identity' => ['username', 'email'], 'password' => 'password']]); $this->userData = ['id' => md5('*****@*****.**'), 'firstname' => 'Fisrtname', 'lastname' => 'Lastname', 'username' => 'exampleuser', 'email' => '*****@*****.**', 'password' => '123412', 'banned' => 0, 'activate' => 1]; $this->loginData = ['email' => '*****@*****.**', 'password' => '123412']; }
/** * Set custom providers * * @param $providers array * * @return bool */ public static function provider(array $providers) { GladProvider::set($providers); static::setStaticVariable(static::$injector, ['field' => 'providers', 'value' => GladProvider::get()]); return true; }