Exemplo n.º 1
0
 protected function _RequireAuthentication()
 {
     $user = new User();
     $user->email = '*****@*****.**';
     $user->Insert();
     Bugdar::$auth = new AuthenticationTest($user);
 }
Exemplo n.º 2
0
 public function testBadPassword()
 {
     Bugdar::$auth = new AuthenticationTest(NULL);
     $data = new phalanx\base\PropertyBag(array('do' => 'fire', 'email' => self::EMAIL, 'password' => 'foo'));
     $event = new UserLoginEvent($data);
     $self =& $this;
     EventPump::Pump()->PostEvent($event);
     $this->assertFalse($event->was_successful());
 }
Exemplo n.º 3
0
 public function testInvalidEmail()
 {
     Bugdar::$auth = new AuthenticationTest(NULL);
     $data = new phalanx\base\PropertyBag(array('do' => 'submit', 'email' => 'robert', 'alias' => 'Robert', 'password' => 'abc123'));
     $event = new UserRegisterEvent($data);
     EventPump::Pump()->PostEvent($event);
     $last_event = EventPump::Pump()->GetEventChain()->Top();
     $this->assertType('StandardErrorEvent', $last_event);
 }
Exemplo n.º 4
0
 public static function BootstrapAuthentication($config)
 {
     // Load the authentication system.
     $auth_module = BUGDAR_ROOT . '/includes/auth/auth_' . $config->{'auth.module'} . '.php';
     if (!file_exists($auth_module) || !is_readable($auth_module)) {
         throw new CoreException('Could not load authentication module ' . $config->{'auth.module'});
     }
     require $auth_module;
     $name = phalanx\base\UnderscoreToCamelCase($config->{'auth.module'});
     $class_name = 'Authentication' . $name;
     if (!class_exists($class_name)) {
         throw new CoreException('Could not find class ' . $class_name);
     }
     self::$auth = new $class_name($config->auth);
 }