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.
64 lines
1.6 KiB
64 lines
1.6 KiB
12 years ago
|
<?php
|
||
|
namespace yiiunit\framework;
|
||
|
|
||
12 years ago
|
use Yii;
|
||
12 years ago
|
use yiiunit\TestCase;
|
||
|
|
||
|
/**
|
||
11 years ago
|
* BaseYiiTest
|
||
11 years ago
|
* @group base
|
||
12 years ago
|
*/
|
||
11 years ago
|
class BaseYiiTest extends TestCase
|
||
12 years ago
|
{
|
||
12 years ago
|
public $aliases;
|
||
|
|
||
12 years ago
|
protected function setUp()
|
||
12 years ago
|
{
|
||
12 years ago
|
parent::setUp();
|
||
12 years ago
|
$this->aliases = Yii::$aliases;
|
||
|
}
|
||
|
|
||
12 years ago
|
protected function tearDown()
|
||
12 years ago
|
{
|
||
12 years ago
|
parent::tearDown();
|
||
12 years ago
|
Yii::$aliases = $this->aliases;
|
||
|
}
|
||
|
|
||
12 years ago
|
public function testAlias()
|
||
|
{
|
||
12 years ago
|
$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
|
|
||
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()
|
||
|
{
|
||
12 years ago
|
$this->assertTrue(is_string(Yii::powered()));
|
||
12 years ago
|
}
|
||
|
}
|