Beispiel #1
0
 /**
  * @test
  */
 public function logout()
 {
     /** @var myWebUser $webUser */
     $webUser = Yii::app()->user;
     $this->assertTrue(myTestHelper::setWebUserFromIdentity('user', 'admin'));
     $userId = $this->users('user')->id;
     $this->assertEquals($userId, $webUser->getUser()->id);
     myTestHelper::logout();
     $webUser = Yii::app()->user;
     $this->assertNull($webUser->getUser());
     $this->assertTrue($webUser->isGuest);
 }
Beispiel #2
0
<?php

if (file_exists(dirname(__FILE__) . '/../../index_test.php')) {
    echo "--> activer le fichier index.php de test...";
    exit;
}
// change the following paths if necessary
$yiit = dirname(__FILE__) . '/../../../framework/yiit.php';
$config = dirname(__FILE__) . '/../config/test.php';
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
require_once $yiit;
require_once dirname(__FILE__) . '/myWebTestCase.php';
Yii::createWebApplication($config);
require_once dirname(__FILE__) . '/myTestHelper.php';
myTestHelper::enableLogging();