public function test_has_role_many() { $this->pixie->config->set('auth.default.roles.relation', 'roles'); $this->pixie->config->set('auth.default.roles.type', 'has_many'); $this->object = new PHPixie\Auth\Role\Relation($this->pixie, 'default'); $user = $this->pixie->orm->get('fairy')->find(); $this->assertEquals(true, $this->object->has_role($user, 'pixie')); $this->assertEquals(false, $this->object->has_role($user, 'pixie1')); }
public function test_login() { $this->assertEquals(true, $this->object->login('Trixie', 'test', true)); $token = $this->pixie->db->query('select')->fields('token')->table('fairies')->execute()->get('token'); $this->assertEquals(true, strlen($token) > 0); $login_token = $this->pixie->cookie->get('login_token'); $this->assertEquals(true, strlen($login_token) > 0); $this->pixie->session->remove('auth_default_password_uid'); $this->pixie->cookie->set('login_token', "Trixie:test"); $this->assertEquals(false, $this->object->check_login()); $this->pixie->cookie->set('login_token', $login_token); $this->assertEquals(true, $this->object->check_login()); $this->pixie->session->remove('auth_default_password_uid'); sleep(2); $this->assertEquals(false, $this->object->check_login()); }
public function test_flow_error_popup() { $this->pixie->session->set('auth_default_facebook_state', 112); $request = new \PHPixie\Request($this->pixie, null, "GET", array(), array('state' => '111', 'code' => 'new_code'), array(), array('HTTP_HOST' => 'test.com')); $this->object->request = $request; $this->object->run('popup'); }
public function test_logout_url_exception() { $except = false; try { $url = $this->object->logout_url('http://google.com/'); } catch (\Exception $e) { $except = true; } $this->assertEquals(true, $except); }
public function test_login() { $this->assertEquals(true, $this->object->login('Trixie', '1234567')); $this->assertEquals(false, $this->object->login('Trixie', 'test1')); $this->assertEquals(false, $this->object->login('Trixie1', 'test1')); $this->assertEquals(true, $this->object->login('Vixie', '1234567')); $this->assertEquals(false, $this->object->login('Vixie', 'test1')); $this->assertEquals(false, $this->object->login('Vixie1', 'test1')); }
public function testResult_driver() { $this->assertEquals('PHPixie\\DB\\PDO\\Result', get_class($this->object->result_driver('pdo', null))); }
public function test_user_model() { $this->assertEquals('ServiceTest\\Model\\Fairy', get_class($this->object->user_model())); }
public function test_logout() { $this->object->set_user($this->pixie->orm->get('fairy')->find()); $this->object->logout(); $this->assertEquals(true, empty($this->session_array['auth_default_password_uid'])); }
public function test_has_role() { $user = $this->pixie->orm->get('fairy')->find(); $this->assertEquals(true, $this->object->has_role($user, 'pixie')); $this->assertEquals(false, $this->object->has_role($user, 'pixie1')); }
public function testResult() { $this->assertEquals('PHPixie\\ORM\\Result', get_class($this->object->result('fairy', null))); }