Esempio n. 1
0
 /**
  * Logs in as a dummy admin
  */
 public function actionDummyAdminLogin()
 {
     $identity = new DummyUserIdentity(1);
     if ($identity->authenticate()) {
         Yii::app()->user->login($identity);
     }
     $this->redirect(array('home/index'));
 }
 /**
  * Tests the dummy admin login action.
  */
 public function testDummyAdminLogin()
 {
     $identity = new DummyUserIdentity(1);
     $this->assertTrue($identity->authenticate());
     $student = Student::model()->findByAttributes(array('username' => 'dummy.admin'));
     $this->assertNotNull($student);
     $this->assertEquals('Dummy Admin', $student->name);
     $this->assertTrue($student->is_admin == 1);
     $this->assertTrue($student->faculty->id == 1);
     $this->assertEquals(Yii::app()->params['defaultProfilePhoto'], $student->photo);
 }