Browse Source

Merge branch 'master' of git://github.com/yiisoft/yii2 into 196-add-popvalue-method

* 'master' of git://github.com/yiisoft/yii2:
  Updated framework paths in composer.json
  Moved "framework" to "iii".
  Fixed Yii::importNamespaces() bug.
  Fixes issue #174: make URL parameters available in $_GET.
  refactoring.
  Removed static variable from autoload per qiangxue's suggestion
  Renamed yii.php -> Yii.php for class, filename consitency
  created StringHelper::basename()
  Fixed YiiBaseTest echo
  Check if trait was loaded
tags/2.0.0-beta
Antonio Ramirez 12 years ago
parent
commit
18f23ff143
  1. 2
      .gitignore
  2. 13
      apps/bootstrap/index.php
  3. 2
      build/build
  4. 4
      composer.json
  5. 2
      tests/unit/bootstrap.php
  6. 1
      tests/unit/framework/YiiBaseTest.php
  7. 44
      tests/unit/framework/helpers/StringHelperTest.php
  8. 2
      tests/web/app/index.php
  9. 0
      yii/.htaccess
  10. 0
      yii/Yii.php
  11. 7
      yii/YiiBase.php
  12. 0
      yii/assets.php
  13. 0
      yii/assets/jquery.min.js
  14. 0
      yii/assets/yii.activeForm.js
  15. 0
      yii/assets/yii.captcha.js
  16. 0
      yii/assets/yii.debug.js
  17. 0
      yii/assets/yii.js
  18. 0
      yii/assets/yii.validation.js
  19. 0
      yii/base/Action.php
  20. 0
      yii/base/ActionEvent.php
  21. 0
      yii/base/ActionFilter.php
  22. 0
      yii/base/Application.php
  23. 0
      yii/base/Behavior.php
  24. 0
      yii/base/Component.php
  25. 0
      yii/base/Controller.php
  26. 0
      yii/base/Dictionary.php
  27. 0
      yii/base/DictionaryIterator.php
  28. 0
      yii/base/ErrorException.php
  29. 0
      yii/base/ErrorHandler.php
  30. 0
      yii/base/Event.php
  31. 0
      yii/base/Exception.php
  32. 0
      yii/base/HttpException.php
  33. 0
      yii/base/InlineAction.php
  34. 0
      yii/base/InvalidCallException.php
  35. 0
      yii/base/InvalidConfigException.php
  36. 0
      yii/base/InvalidParamException.php
  37. 0
      yii/base/InvalidRequestException.php
  38. 0
      yii/base/InvalidRouteException.php
  39. 0
      yii/base/Model.php
  40. 0
      yii/base/ModelEvent.php
  41. 0
      yii/base/Module.php
  42. 0
      yii/base/NotSupportedException.php
  43. 0
      yii/base/Object.php
  44. 0
      yii/base/Request.php
  45. 0
      yii/base/Response.php
  46. 0
      yii/base/Theme.php
  47. 0
      yii/base/UnknownClassException.php
  48. 0
      yii/base/UnknownMethodException.php
  49. 0
      yii/base/UnknownPropertyException.php
  50. 0
      yii/base/UserException.php
  51. 0
      yii/base/Vector.php
  52. 0
      yii/base/VectorIterator.php
  53. 0
      yii/base/View.php
  54. 0
      yii/base/ViewEvent.php
  55. 0
      yii/base/ViewRenderer.php
  56. 0
      yii/base/Widget.php
  57. 0
      yii/caching/ApcCache.php
  58. 0
      yii/caching/Cache.php
  59. 0
      yii/caching/ChainedDependency.php
  60. 0
      yii/caching/DbCache.php
  61. 0
      yii/caching/DbDependency.php
  62. 0
      yii/caching/Dependency.php
  63. 0
      yii/caching/DummyCache.php
  64. 0
      yii/caching/ExpressionDependency.php
  65. 0
      yii/caching/FileCache.php
  66. 0
      yii/caching/FileDependency.php
  67. 0
      yii/caching/MemCache.php
  68. 0
      yii/caching/MemCacheServer.php
  69. 0
      yii/caching/WinCache.php
  70. 0
      yii/caching/XCache.php
  71. 0
      yii/caching/ZendDataCache.php
  72. 0
      yii/console/Application.php
  73. 0
      yii/console/Controller.php
  74. 0
      yii/console/Exception.php
  75. 0
      yii/console/Request.php
  76. 0
      yii/console/controllers/AppController.php
  77. 0
      yii/console/controllers/AssetController.php
  78. 0
      yii/console/controllers/CacheController.php
  79. 0
      yii/console/controllers/HelpController.php
  80. 0
      yii/console/controllers/MessageController.php
  81. 0
      yii/console/controllers/MigrateController.php
  82. 0
      yii/console/runtime/.gitignore
  83. 0
      yii/db/ActiveQuery.php
  84. 2
      yii/db/ActiveRecord.php
  85. 0
      yii/db/ActiveRelation.php
  86. 0
      yii/db/ColumnSchema.php
  87. 0
      yii/db/Command.php
  88. 0
      yii/db/Connection.php
  89. 0
      yii/db/DataReader.php
  90. 0
      yii/db/Exception.php
  91. 0
      yii/db/Expression.php
  92. 0
      yii/db/Migration.php
  93. 0
      yii/db/Query.php
  94. 0
      yii/db/QueryBuilder.php
  95. 0
      yii/db/Schema.php
  96. 0
      yii/db/StaleObjectException.php
  97. 0
      yii/db/TableSchema.php
  98. 0
      yii/db/Transaction.php
  99. 0
      yii/db/mysql/QueryBuilder.php
  100. 0
      yii/db/mysql/Schema.php
  101. Some files were not shown because too many files have changed in this diff Show More

2
.gitignore vendored

@ -13,4 +13,4 @@ nbproject
Thumbs.db
# composer vendor dir
/framework/vendor
/yii/vendor

13
apps/bootstrap/index.php

@ -1,14 +1,13 @@
<?php
// Set to false to disable debug mode
// comment out the following line to disable debug mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
$frameworkPath = __DIR__ . '/../../framework/';
require($frameworkPath . 'yii.php');
$config = require(__DIR__ . '/protected/config/main.php');
$application = new yii\web\Application($config);
$frameworkPath = __DIR__ . '/../../yii';
require($frameworkPath . '/Yii.php');
// Register Composer autoloader
@include $frameworkPath . '/vendor/autoload.php';
@include($frameworkPath . '/vendor/autoload.php');
$config = require(__DIR__ . '/protected/config/main.php');
$application = new yii\web\Application($config);
$application->run();

2
build/build

@ -11,7 +11,7 @@
// fcgi doesn't have STDIN defined by default
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));
require(__DIR__ . '/../framework/yii.php');
require(__DIR__ . '/../framework/Yii.php');
$id = 'yiic-build';
$basePath = __DIR__;

4
composer.json

@ -64,10 +64,10 @@
"source": "https://github.com/yiisoft/yii2"
},
"config": {
"vendor-dir": "framework/vendor"
"vendor-dir": "yii/vendor"
},
"bin": [
"framework/yiic"
"yii/yiic"
],
"require": {
"php": ">=5.3.0",

2
tests/unit/bootstrap.php

@ -5,7 +5,7 @@ define('YII_DEBUG', true);
$_SERVER['SCRIPT_NAME'] = '/' . __DIR__;
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
require_once(__DIR__ . '/../../framework/yii.php');
require_once(__DIR__ . '/../../yii/Yii.php');
Yii::setAlias('@yiiunit', __DIR__);

1
tests/unit/framework/YiiBaseTest.php

@ -47,7 +47,6 @@ class YiiBaseTest extends TestCase
public function testGetVersion()
{
echo Yii::getVersion();
$this->assertTrue((boolean)preg_match('~\d+\.\d+(?:\.\d+)?(?:-\w+)?~', \Yii::getVersion()));
}

44
tests/unit/framework/helpers/StringHelperTest.php

@ -70,4 +70,48 @@ class StringHelperTest extends \yii\test\TestCase
$this->assertEquals('PostTag', StringHelper::id2camel('post-tag'));
$this->assertEquals('PostTag', StringHelper::id2camel('post_tag', '_'));
}
public function testBasename()
{
$this->assertEquals('', StringHelper::basename(''));
$this->assertEquals('file', StringHelper::basename('file'));
$this->assertEquals('file.test', StringHelper::basename('file.test', '.test2'));
$this->assertEquals('file', StringHelper::basename('file.test', '.test'));
$this->assertEquals('file', StringHelper::basename('/file'));
$this->assertEquals('file.test', StringHelper::basename('/file.test', '.test2'));
$this->assertEquals('file', StringHelper::basename('/file.test', '.test'));
$this->assertEquals('file', StringHelper::basename('/path/to/file'));
$this->assertEquals('file.test', StringHelper::basename('/path/to/file.test', '.test2'));
$this->assertEquals('file', StringHelper::basename('/path/to/file.test', '.test'));
$this->assertEquals('file', StringHelper::basename('\file'));
$this->assertEquals('file.test', StringHelper::basename('\file.test', '.test2'));
$this->assertEquals('file', StringHelper::basename('\file.test', '.test'));
$this->assertEquals('file', StringHelper::basename('C:\file'));
$this->assertEquals('file.test', StringHelper::basename('C:\file.test', '.test2'));
$this->assertEquals('file', StringHelper::basename('C:\file.test', '.test'));
$this->assertEquals('file', StringHelper::basename('C:\path\to\file'));
$this->assertEquals('file.test', StringHelper::basename('C:\path\to\file.test', '.test2'));
$this->assertEquals('file', StringHelper::basename('C:\path\to\file.test', '.test'));
// mixed paths
$this->assertEquals('file.test', StringHelper::basename('/path\to/file.test'));
$this->assertEquals('file.test', StringHelper::basename('/path/to\file.test'));
$this->assertEquals('file.test', StringHelper::basename('\path/to\file.test'));
// \ and / in suffix
$this->assertEquals('file', StringHelper::basename('/path/to/filete/st', 'te/st'));
$this->assertEquals('st', StringHelper::basename('/path/to/filete/st', 'te\st'));
$this->assertEquals('file', StringHelper::basename('/path/to/filete\st', 'te\st'));
$this->assertEquals('st', StringHelper::basename('/path/to/filete\st', 'te/st'));
// http://www.php.net/manual/en/function.basename.php#72254
$this->assertEquals('foo', StringHelper::basename('/bar/foo/'));
$this->assertEquals('foo', StringHelper::basename('\\bar\\foo\\'));
}
}

2
tests/web/app/index.php

@ -1,6 +1,6 @@
<?php
require(__DIR__ . '/../../../framework/yii.php');
require(__DIR__ . '/../../../yii/Yii.php');
$application = new yii\web\Application('test', __DIR__ . '/protected');
$application->run();

0
framework/.htaccess → yii/.htaccess

0
framework/yii.php → yii/Yii.php

7
framework/YiiBase.php → yii/YiiBase.php

@ -158,8 +158,8 @@ class YiiBase
{
foreach ($namespaces as $name => $path) {
if ($name !== '') {
$name = '@' . str_replace('\\', '/', $name);
static::setAlias($name, $path);
$name = trim(strtr($name, array('\\' => '/', '_' => '/')), '/');
static::setAlias('@' . $name, rtrim($path, '/\\') . '/' . $name);
}
}
}
@ -370,7 +370,8 @@ class YiiBase
include($classFile);
if (class_exists($className, false) || interface_exists($className, false)) {
if (class_exists($className, false) || interface_exists($className, false) ||
function_exists('trait_exists') && trait_exists($className, false)) {
return true;
} else {
throw new UnknownClassException("Unable to find '$className' in file: $classFile");

0
framework/assets.php → yii/assets.php

0
framework/assets/jquery.min.js → yii/assets/jquery.min.js vendored

0
framework/assets/yii.activeForm.js → yii/assets/yii.activeForm.js

0
framework/assets/yii.captcha.js → yii/assets/yii.captcha.js

0
framework/assets/yii.debug.js → yii/assets/yii.debug.js

0
framework/assets/yii.js → yii/assets/yii.js

0
framework/assets/yii.validation.js → yii/assets/yii.validation.js

0
framework/base/Action.php → yii/base/Action.php

0
framework/base/ActionEvent.php → yii/base/ActionEvent.php

0
framework/base/ActionFilter.php → yii/base/ActionFilter.php

0
framework/base/Application.php → yii/base/Application.php

0
framework/base/Behavior.php → yii/base/Behavior.php

0
framework/base/Component.php → yii/base/Component.php

0
framework/base/Controller.php → yii/base/Controller.php

0
framework/base/Dictionary.php → yii/base/Dictionary.php

0
framework/base/DictionaryIterator.php → yii/base/DictionaryIterator.php

0
framework/base/ErrorException.php → yii/base/ErrorException.php

0
framework/base/ErrorHandler.php → yii/base/ErrorHandler.php

0
framework/base/Event.php → yii/base/Event.php

0
framework/base/Exception.php → yii/base/Exception.php

0
framework/base/HttpException.php → yii/base/HttpException.php

0
framework/base/InlineAction.php → yii/base/InlineAction.php

0
framework/base/InvalidCallException.php → yii/base/InvalidCallException.php

0
framework/base/InvalidConfigException.php → yii/base/InvalidConfigException.php

0
framework/base/InvalidParamException.php → yii/base/InvalidParamException.php

0
framework/base/InvalidRequestException.php → yii/base/InvalidRequestException.php

0
framework/base/InvalidRouteException.php → yii/base/InvalidRouteException.php

0
framework/base/Model.php → yii/base/Model.php

0
framework/base/ModelEvent.php → yii/base/ModelEvent.php

0
framework/base/Module.php → yii/base/Module.php

0
framework/base/NotSupportedException.php → yii/base/NotSupportedException.php

0
framework/base/Object.php → yii/base/Object.php

0
framework/base/Request.php → yii/base/Request.php

0
framework/base/Response.php → yii/base/Response.php

0
framework/base/Theme.php → yii/base/Theme.php

0
framework/base/UnknownClassException.php → yii/base/UnknownClassException.php

0
framework/base/UnknownMethodException.php → yii/base/UnknownMethodException.php

0
framework/base/UnknownPropertyException.php → yii/base/UnknownPropertyException.php

0
framework/base/UserException.php → yii/base/UserException.php

0
framework/base/Vector.php → yii/base/Vector.php

0
framework/base/VectorIterator.php → yii/base/VectorIterator.php

0
framework/base/View.php → yii/base/View.php

0
framework/base/ViewEvent.php → yii/base/ViewEvent.php

0
framework/base/ViewRenderer.php → yii/base/ViewRenderer.php

0
framework/base/Widget.php → yii/base/Widget.php

0
framework/caching/ApcCache.php → yii/caching/ApcCache.php

0
framework/caching/Cache.php → yii/caching/Cache.php

0
framework/caching/ChainedDependency.php → yii/caching/ChainedDependency.php

0
framework/caching/DbCache.php → yii/caching/DbCache.php

0
framework/caching/DbDependency.php → yii/caching/DbDependency.php

0
framework/caching/Dependency.php → yii/caching/Dependency.php

0
framework/caching/DummyCache.php → yii/caching/DummyCache.php

0
framework/caching/ExpressionDependency.php → yii/caching/ExpressionDependency.php

0
framework/caching/FileCache.php → yii/caching/FileCache.php

0
framework/caching/FileDependency.php → yii/caching/FileDependency.php

0
framework/caching/MemCache.php → yii/caching/MemCache.php

0
framework/caching/MemCacheServer.php → yii/caching/MemCacheServer.php

0
framework/caching/WinCache.php → yii/caching/WinCache.php

0
framework/caching/XCache.php → yii/caching/XCache.php

0
framework/caching/ZendDataCache.php → yii/caching/ZendDataCache.php

0
framework/console/Application.php → yii/console/Application.php

0
framework/console/Controller.php → yii/console/Controller.php

0
framework/console/Exception.php → yii/console/Exception.php

0
framework/console/Request.php → yii/console/Request.php

0
framework/console/controllers/AppController.php → yii/console/controllers/AppController.php

0
framework/console/controllers/AssetController.php → yii/console/controllers/AssetController.php

0
framework/console/controllers/CacheController.php → yii/console/controllers/CacheController.php

0
framework/console/controllers/HelpController.php → yii/console/controllers/HelpController.php

0
framework/console/controllers/MessageController.php → yii/console/controllers/MessageController.php

0
framework/console/controllers/MigrateController.php → yii/console/controllers/MigrateController.php

0
framework/console/runtime/.gitignore → yii/console/runtime/.gitignore vendored

0
framework/db/ActiveQuery.php → yii/db/ActiveQuery.php

2
framework/db/ActiveRecord.php → yii/db/ActiveRecord.php

@ -252,7 +252,7 @@ class ActiveRecord extends Model
*/
public static function tableName()
{
return 'tbl_' . StringHelper::camel2id(basename(get_called_class()), '_');
return 'tbl_' . StringHelper::camel2id(StringHelper::basename(get_called_class()), '_');
}
/**

0
framework/db/ActiveRelation.php → yii/db/ActiveRelation.php

0
framework/db/ColumnSchema.php → yii/db/ColumnSchema.php

0
framework/db/Command.php → yii/db/Command.php

0
framework/db/Connection.php → yii/db/Connection.php

0
framework/db/DataReader.php → yii/db/DataReader.php

0
framework/db/Exception.php → yii/db/Exception.php

0
framework/db/Expression.php → yii/db/Expression.php

0
framework/db/Migration.php → yii/db/Migration.php

0
framework/db/Query.php → yii/db/Query.php

0
framework/db/QueryBuilder.php → yii/db/QueryBuilder.php

0
framework/db/Schema.php → yii/db/Schema.php

0
framework/db/StaleObjectException.php → yii/db/StaleObjectException.php

0
framework/db/TableSchema.php → yii/db/TableSchema.php

0
framework/db/Transaction.php → yii/db/Transaction.php

0
framework/db/mysql/QueryBuilder.php → yii/db/mysql/QueryBuilder.php

0
framework/db/mysql/Schema.php → yii/db/mysql/Schema.php

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save