mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 14:57:23 +08:00
Fixes issue #294.
This commit is contained in:
@@ -45,6 +45,9 @@ class YiiBaseTest extends TestCase
|
|||||||
Yii::setAlias('@yii', null);
|
Yii::setAlias('@yii', null);
|
||||||
$this->assertFalse(Yii::getAlias('@yii', false));
|
$this->assertFalse(Yii::getAlias('@yii', false));
|
||||||
$this->assertEquals('/yii/gii/file', Yii::getAlias('@yii/gii/file'));
|
$this->assertEquals('/yii/gii/file', Yii::getAlias('@yii/gii/file'));
|
||||||
|
|
||||||
|
Yii::setAlias('@some/alias', '/www');
|
||||||
|
$this->assertEquals('/www', Yii::getAlias('@some/alias'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetVersion()
|
public function testGetVersion()
|
||||||
|
|||||||
@@ -287,7 +287,11 @@ class YiiBase
|
|||||||
if ($path !== null) {
|
if ($path !== null) {
|
||||||
$path = strncmp($path, '@', 1) ? rtrim($path, '\\/') : static::getAlias($path);
|
$path = strncmp($path, '@', 1) ? rtrim($path, '\\/') : static::getAlias($path);
|
||||||
if (!isset(self::$aliases[$root])) {
|
if (!isset(self::$aliases[$root])) {
|
||||||
self::$aliases[$root] = $path;
|
if ($pos === false) {
|
||||||
|
self::$aliases[$root] = $path;
|
||||||
|
} else {
|
||||||
|
self::$aliases[$root] = array($alias => $path);
|
||||||
|
}
|
||||||
} elseif (is_string(self::$aliases[$root])) {
|
} elseif (is_string(self::$aliases[$root])) {
|
||||||
if ($pos === false) {
|
if ($pos === false) {
|
||||||
self::$aliases[$root] = $path;
|
self::$aliases[$root] = $path;
|
||||||
|
|||||||
Reference in New Issue
Block a user