You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB

12 years ago
<?php
namespace yiiunit\framework;
use Yii;
12 years ago
use yiiunit\TestCase;
/**
* YiiBaseTest
*/
class YiiBaseTest extends TestCase
{
public $aliases;
12 years ago
protected function setUp()
{
12 years ago
parent::setUp();
$this->aliases = Yii::$aliases;
}
12 years ago
protected function tearDown()
{
12 years ago
parent::tearDown();
Yii::$aliases = $this->aliases;
}
12 years ago
public function testAlias()
{
$this->assertEquals(YII_PATH, Yii::getAlias('@yii'));
Yii::$aliases = array();
$this->assertFalse(Yii::getAlias('@yii', false));
Yii::setAlias('@yii', '/yii/framework');
$this->assertEquals('/yii/framework', Yii::getAlias('@yii'));
$this->assertEquals('/yii/framework/test/file', Yii::getAlias('@yii/test/file'));
Yii::setAlias('@yii/gii', '/yii/gii');
$this->assertEquals('/yii/framework', Yii::getAlias('@yii'));
$this->assertEquals('/yii/framework/test/file', Yii::getAlias('@yii/test/file'));
$this->assertEquals('/yii/gii', Yii::getAlias('@yii/gii'));
$this->assertEquals('/yii/gii/file', Yii::getAlias('@yii/gii/file'));
Yii::setAlias('@tii', '@yii/test');
$this->assertEquals('/yii/framework/test', Yii::getAlias('@tii'));
12 years ago
Yii::setAlias('@yii', null);
$this->assertFalse(Yii::getAlias('@yii', false));
$this->assertEquals('/yii/gii/file', Yii::getAlias('@yii/gii/file'));
12 years ago
Yii::setAlias('@some/alias', '/www');
$this->assertEquals('/www', Yii::getAlias('@some/alias'));
12 years ago
}
public function testGetVersion()
{
$this->assertTrue((boolean)preg_match('~\d+\.\d+(?:\.\d+)?(?:-\w+)?~', \Yii::getVersion()));
}
public function testPowered()
{
$this->assertTrue(is_string(Yii::powered()));
12 years ago
}
}