protected function _RequireAuthentication() { $user = new User(); $user->email = '*****@*****.**'; $user->Insert(); Bugdar::$auth = new AuthenticationTest($user); }
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()); }
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); }
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); }