Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch '2.0' into 2.1

Conflicts:
	lib/Cake/Model/Datasource/Database/Postgres.php
	lib/Cake/Test/Case/Console/TaskCollectionTest.php
	lib/Cake/Test/Case/Model/ModelIntegrationTest.php
	lib/Cake/Test/Case/Utility/ClassRegistryTest.php
	lib/Cake/Utility/ClassRegistry.php
  • Loading branch information...
commit 2e8498e166b740ec52fc0a750bf00a5561e8d8ab 2 parents 64eb38a + 8bb6f88
@markstory markstory authored
Showing with 920 additions and 306 deletions.
  1. +1 −0  app/Config/core.php
  2. +1 −0  app/View/Helper/AppHelper.php
  3. +2 −0  lib/Cake/Cache/Cache.php
  4. +5 −1 lib/Cake/Cache/Engine/FileEngine.php
  5. +1 −0  lib/Cake/Cache/Engine/XcacheEngine.php
  6. +3 −0  lib/Cake/Console/Command/ApiShell.php
  7. +5 −1 lib/Cake/Console/Command/BakeShell.php
  8. +3 −0  lib/Cake/Console/Command/SchemaShell.php
  9. +24 −19 lib/Cake/Console/Command/Task/ModelTask.php
  10. +1 −1  lib/Cake/Console/Command/Task/PluginTask.php
  11. +1 −3 lib/Cake/Console/Command/Task/ProjectTask.php
  12. +1 −0  lib/Cake/Console/Command/UpgradeShell.php
  13. +12 −3 lib/Cake/Console/Shell.php
  14. +1 −0  lib/Cake/Console/ShellDispatcher.php
  15. +1 −0  lib/Cake/Console/Templates/skel/Config/core.php
  16. +2 −0  lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css
  17. +2 −0  lib/Cake/Console/Templates/skel/webroot/index.php
  18. +2 −0  lib/Cake/Console/Templates/skel/webroot/test.php
  19. +8 −0 lib/Cake/Controller/CakeErrorController.php
  20. +2 −0  lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
  21. +5 −1 lib/Cake/Controller/Component/RequestHandlerComponent.php
  22. +8 −1 lib/Cake/Controller/Component/SecurityComponent.php
  23. +4 −4 lib/Cake/Controller/Component/SessionComponent.php
  24. +6 −0 lib/Cake/Controller/ComponentCollection.php
  25. +2 −1  lib/Cake/Core/CakePlugin.php
  26. +1 −3 lib/Cake/Core/Object.php
  27. +1 −1  lib/Cake/Error/ExceptionRenderer.php
  28. +1 −0  lib/Cake/Error/exceptions.php
  29. +1 −1  lib/Cake/I18n/I18n.php
  30. +0 −4 lib/Cake/Model/AclNode.php
  31. +0 −3  lib/Cake/Model/Aco.php
  32. +0 −3  lib/Cake/Model/AcoAction.php
  33. +0 −3  lib/Cake/Model/Aro.php
  34. +2 −0  lib/Cake/Model/Behavior/AclBehavior.php
  35. +3 −2 lib/Cake/Model/Behavior/ContainableBehavior.php
  36. +7 −1 lib/Cake/Model/CakeSchema.php
  37. +3 −0  lib/Cake/Model/ConnectionManager.php
  38. +6 −9 lib/Cake/Model/Datasource/Database/Postgres.php
  39. +2 −0  lib/Cake/Model/Datasource/Database/Sqlserver.php
  40. +20 −8 lib/Cake/Model/Model.php
  41. +0 −3  lib/Cake/Model/Permission.php
  42. +1 −1  lib/Cake/Network/CakeRequest.php
  43. +1 −0  lib/Cake/Network/CakeSocket.php
  44. +1 −1  lib/Cake/Network/Email/AbstractTransport.php
  45. +1 −0  lib/Cake/Network/Email/CakeEmail.php
  46. +1 −1  lib/Cake/Network/Email/MailTransport.php
  47. +2 −1  lib/Cake/Network/Email/SmtpTransport.php
  48. +1 −1  lib/Cake/Network/Http/HttpResponse.php
  49. +29 −6 lib/Cake/Network/Http/HttpSocket.php
  50. +0 −3  lib/Cake/Routing/Dispatcher.php
  51. +1 −0  lib/Cake/Routing/Route/CakeRoute.php
  52. +11 −9 lib/Cake/Routing/Route/PluginShortRoute.php
  53. +13 −11 lib/Cake/Routing/Route/RedirectRoute.php
  54. +1 −0  lib/Cake/Test/Case/BasicsTest.php
  55. +1 −1  lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
  56. +1 −0  lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
  57. +2 −2 lib/Cake/Test/Case/Configure/IniReaderTest.php
  58. +1 −0  lib/Cake/Test/Case/Configure/PhpReaderTest.php
  59. +2 −1  lib/Cake/Test/Case/Console/Command/AclShellTest.php
  60. +1 −1  lib/Cake/Test/Case/Console/Command/BakeShellTest.php
  61. +1 −1  lib/Cake/Test/Case/Console/Command/CommandListShellTest.php
  62. +1 −1  lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
  63. +4 −2 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
  64. +1 −1  lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php
  65. +85 −2 lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
  66. +1 −1  lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php
  67. +2 −2 lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php
  68. +4 −4 lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
  69. +3 −3 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
  70. +1 −1  lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php
  71. +2 −0  lib/Cake/Test/Case/Console/ShellDispatcherTest.php
  72. +13 −0 lib/Cake/Test/Case/Console/ShellTest.php
  73. +19 −4 lib/Cake/Test/Case/Console/TaskCollectionTest.php
  74. +1 −1  lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php
  75. +2 −1  lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php
  76. +1 −1  lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php
  77. +1 −0  lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
  78. +1 −0  lib/Cake/Test/Case/Controller/Component/DbAclTest.php
  79. +1 −0  lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
  80. +7 −4 lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
  81. +1 −1  lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php
  82. +16 −2 lib/Cake/Test/Case/Controller/ControllerTest.php
  83. +3 −3 lib/Cake/Test/Case/Controller/ScaffoldTest.php
  84. +5 −2 lib/Cake/Test/Case/Error/ErrorHandlerTest.php
  85. +7 −2 lib/Cake/Test/Case/Error/ExceptionRendererTest.php
  86. +2 −0  lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
  87. +1 −0  lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
  88. +1 −0  lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
  89. +1 −0  lib/Cake/Test/Case/Model/BehaviorCollectionTest.php
  90. +6 −0 lib/Cake/Test/Case/Model/CakeSchemaTest.php
  91. +1 −1  lib/Cake/Test/Case/Model/ConnectionManagerTest.php
  92. +4 −3 lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
  93. +1 −0  lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
  94. +1 −0  lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
  95. +5 −0 lib/Cake/Test/Case/Model/Datasource/Database/SqlserverTest.php
  96. +1 −1  lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php
  97. +13 −7 lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
  98. +1 −0  lib/Cake/Test/Case/Model/DbAclTest.php
  99. +2 −0  lib/Cake/Test/Case/Model/ModelIntegrationTest.php
  100. +1 −0  lib/Cake/Test/Case/Model/ModelReadTest.php
  101. +1 −0  lib/Cake/Test/Case/Model/ModelTestBase.php
  102. +2 −0  lib/Cake/Test/Case/Model/ModelWriteTest.php
  103. +1 −0  lib/Cake/Test/Case/Model/models.php
  104. +17 −1 lib/Cake/Test/Case/Network/CakeRequestTest.php
  105. +2 −0  lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
  106. +20 −0 lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
  107. +3 −0  lib/Cake/Test/Case/Routing/DispatcherTest.php
  108. +4 −0 lib/Cake/Test/Case/Routing/RouterTest.php
  109. +1 −1  lib/Cake/Test/Case/TestSuite/CakeTestCaseTest.php
  110. +99 −0 lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php
  111. +1 −1  lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
  112. +3 −2 lib/Cake/Test/Case/TestSuite/HtmlCoverageReportTest.php
  113. +29 −8 lib/Cake/Test/Case/Utility/ClassRegistryTest.php
  114. +2 −2 lib/Cake/Test/Case/Utility/DebuggerTest.php
  115. +8 −6 lib/Cake/Test/Case/Utility/FileTest.php
  116. +51 −0 lib/Cake/Test/Case/Utility/FolderTest.php
  117. +1 −1  lib/Cake/Test/Case/Utility/InflectorTest.php
  118. +6 −4 lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
  119. +1 −0  lib/Cake/Test/Case/Utility/SetTest.php
  120. +3 −2 lib/Cake/Test/Case/Utility/ValidationTest.php
  121. +2 −2 lib/Cake/Test/Case/Utility/XmlTest.php
  122. +2 −0  lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
  123. +19 −0 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
  124. +13 −3 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  125. +13 −1 lib/Cake/Test/Case/View/Helper/JsHelperTest.php
  126. +10 −0 lib/Cake/Test/Case/View/Helper/MootoolsEngineHelperTest.php
  127. +11 −30 lib/Cake/Test/Case/View/Helper/RssHelperTest.php
  128. +11 −9 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  129. +6 −4 lib/Cake/Test/Case/View/HelperCollectionTest.php
  130. +1 −1  lib/Cake/Test/Case/View/ScaffoldViewTest.php
  131. +1 −0  lib/Cake/Test/Case/View/ViewTest.php
  132. +3 −0  lib/Cake/Test/Fixture/TranslateWithPrefixFixture.php
  133. +1 −3 lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp
  134. +8 −0 lib/Cake/TestSuite/CakeTestLoader.php
  135. +9 −0 lib/Cake/TestSuite/CakeTestSuite.php
  136. +1 −0  lib/Cake/TestSuite/CakeTestSuiteDispatcher.php
  137. +7 −0 lib/Cake/TestSuite/Coverage/BaseCoverageReport.php
  138. +6 −0 lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
  139. +6 −0 lib/Cake/TestSuite/Coverage/TextCoverageReport.php
  140. +6 −0 lib/Cake/TestSuite/Fixture/CakeFixtureManager.php
  141. +3 −5 lib/Cake/TestSuite/Fixture/CakeTestFixture.php
  142. +1 −5 lib/Cake/TestSuite/Fixture/CakeTestModel.php
  143. +9 −5 lib/Cake/Utility/ClassRegistry.php
  144. +0 −4 lib/Cake/Utility/Debugger.php
  145. +0 −4 lib/Cake/Utility/File.php
  146. +1 −0  lib/Cake/Utility/ObjectCollection.php
  147. +2 −1  lib/Cake/Utility/Sanitize.php
  148. +7 −0 lib/Cake/Utility/Xml.php
  149. +2 −1  lib/Cake/View/Helper/CacheHelper.php
  150. +2 −10 lib/Cake/View/Helper/FormHelper.php
  151. +11 −0 lib/Cake/View/Helper/JqueryEngineHelper.php
  152. +1 −0  lib/Cake/View/Helper/JsBaseEngineHelper.php
  153. +1 −1  lib/Cake/View/Helper/JsHelper.php
  154. +13 −0 lib/Cake/View/Helper/MootoolsEngineHelper.php
  155. +8 −0 lib/Cake/View/Helper/PrototypeEngineHelper.php
  156. +13 −20 lib/Cake/View/Helper/TextHelper.php
  157. +1 −0  lib/Cake/View/Helper/TimeHelper.php
  158. +6 −0 lib/Cake/View/HelperCollection.php
  159. +1 −0  lib/Cake/View/MediaView.php
  160. +1 −0  lib/Cake/View/ScaffoldView.php
  161. +1 −0  lib/Cake/View/ThemeView.php
  162. +0 −3  lib/Cake/View/View.php
View
1  app/Config/core.php
@@ -200,6 +200,7 @@
* timestamping regardless of debug value.
*/
//Configure::write('Asset.timestamp', true);
+
/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.
View
1  app/View/Helper/AppHelper.php
@@ -19,6 +19,7 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
App::uses('Helper', 'View');
/**
View
2  lib/Cake/Cache/Cache.php
@@ -374,6 +374,7 @@ public static function increment($key, $offset = 1, $config = 'default') {
self::set(null, $config);
return $success;
}
+
/**
* Decrement a number under the key and return decremented value.
*
@@ -401,6 +402,7 @@ public static function decrement($key, $offset = 1, $config = 'default') {
self::set(null, $config);
return $success;
}
+
/**
* Delete a key from the cache.
*
View
6 lib/Cake/Cache/Engine/FileEngine.php
@@ -21,7 +21,11 @@
*/
/**
- * File Storage engine for cache
+ * File Storage engine for cache. Filestorage is the slowest cache storage
+ * to read and write. However, it is good for servers that don't have other storage
+ * engine available, or have content which is not performance sensitive.
+ *
+ * You can configure a FileEngine cache, using Cache::config()
*
* @package Cake.Cache.Engine
*/
View
1  lib/Cake/Cache/Engine/XcacheEngine.php
@@ -110,6 +110,7 @@ public function increment($key, $offset = 1) {
public function decrement($key, $offset = 1) {
return xcache_dec($key, $offset);
}
+
/**
* Delete a key from the cache
*
View
3  lib/Cake/Console/Command/ApiShell.php
@@ -24,6 +24,8 @@
/**
* API shell to show method signatures of CakePHP core classes.
*
+ * Implementation of a Cake Shell to show CakePHP core method signatures.
+ *
* @package Cake.Console.Command
*/
class ApiShell extends AppShell {
@@ -151,6 +153,7 @@ public function getOptionParser() {
))->description(__d('cake_console', 'Lookup doc block comments for classes in CakePHP.'));
return $parser;
}
+
/**
* Show help for this shell.
*
View
6 lib/Cake/Console/Command/BakeShell.php
@@ -24,7 +24,11 @@
App::uses('Model', 'Model');
/**
- * Bake is a command-line code generation utility for automating programmer chores.
+ * Command-line code generation utility to automate programmer chores.
+ *
+ * Bake is CakePHP's code generation script, which can help you kickstart
+ * application development by writing fully functional skeleton controllers,
+ * models, and views. Going further, Bake can also write Unit Tests for you.
*
* @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
View
3  lib/Cake/Console/Command/SchemaShell.php
@@ -27,6 +27,9 @@
/**
* Schema is a command-line database management utility for automating programmer chores.
*
+ * Schema is CakePHP's database management utility. This helps you maintain versions of
+ * of your database.
+ *
* @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
*/
View
43 lib/Cake/Console/Command/Task/ModelTask.php
@@ -101,10 +101,12 @@ public function execute() {
return $this->all();
}
$model = $this->_modelName($this->args[0]);
- $object = $this->_getModelObject($model);
+ $this->listAll($this->connection);
+ $useTable = $this->getTable($model);
+ $object = $this->_getModelObject($model, $useTable);
if ($this->bake($object, false)) {
if ($this->_checkUnitTest()) {
- $this->bakeFixture($model);
+ $this->bakeFixture($model, $useTable);
$this->bakeTest($model);
}
}
@@ -822,12 +824,14 @@ public function bakeTest($className) {
public function listAll($useDbConfig = null) {
$this->_tables = (array) $this->getAllTables($useDbConfig);
+ $this->_modelNames = array();
+ $count = count($this->_tables);
+ for ($i = 0; $i < $count; $i++) {
+ $this->_modelNames[] = $this->_modelName($this->_tables[$i]);
+ }
if ($this->interactive === true) {
$this->out(__d('cake_console', 'Possible Models based on your current database:'));
- $this->_modelNames = array();
- $count = count($this->_tables);
for ($i = 0; $i < $count; $i++) {
- $this->_modelNames[] = $this->_modelName($this->_tables[$i]);
$this->out($i + 1 . ". " . $this->_modelNames[$i]);
}
}
@@ -842,26 +846,27 @@ public function listAll($useDbConfig = null) {
* @return string Table name
*/
public function getTable($modelName, $useDbConfig = null) {
- if (!isset($useDbConfig)) {
- $useDbConfig = $this->connection;
- }
-
- $db = ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
if (in_array($modelName, $this->_modelNames)) {
$modelNames = array_flip($this->_modelNames);
$useTable = $this->_tables[$modelNames[$modelName]];
}
- $fullTableName = $db->fullTableName($useTable, false);
- $tableIsGood = false;
- if (array_search($useTable, $this->_tables) === false) {
- $this->out();
- $this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
- $tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
- }
- if (strtolower($tableIsGood) == 'n') {
- $useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
+ if ($this->interactive === true) {
+ if (!isset($useDbConfig)) {
+ $useDbConfig = $this->connection;
+ }
+ $db = ConnectionManager::getDataSource($useDbConfig);
+ $fullTableName = $db->fullTableName($useTable, false);
+ $tableIsGood = false;
+ if (array_search($useTable, $this->_tables) === false) {
+ $this->out();
+ $this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
+ $tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
+ }
+ if (strtolower($tableIsGood) == 'n') {
+ $useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
+ }
}
return $useTable;
}
View
2  lib/Cake/Console/Command/Task/PluginTask.php
@@ -21,7 +21,7 @@
App::uses('Folder', 'Utility');
/**
- * Task class for creating a plugin
+ * The Plugin Task handles creating an empty plugin, ready to be used
*
* @package Cake.Console.Command.Task
*/
View
4 lib/Cake/Console/Command/Task/ProjectTask.php
@@ -288,9 +288,7 @@ public function securityCipherSeed($path) {
$File = new File($path . 'Config' . DS . 'core.php');
$contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
- if (!class_exists('Security')) {
- require CAKE . 'Utility' . DS . 'security.php';
- }
+ App::uses('Security', 'Utility');
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents);
if ($File->write($result)) {
View
1  lib/Cake/Console/Command/UpgradeShell.php
@@ -554,6 +554,7 @@ public function exceptions() {
);
$this->_filesRegexpUpdate($patterns);
}
+
/**
* Move application views files to where they now should be
*
View
15 lib/Cake/Console/Shell.php
@@ -80,6 +80,14 @@ class Shell extends Object {
public $name = null;
/**
+ * The name of the plugin the shell belongs to.
+ * Is automatically set by ShellDispatcher when a shell is constructed.
+ *
+ * @var string
+ */
+ public $plugin = null;
+
+/**
* Contains tasks to load and instantiate
*
* @var array
@@ -409,7 +417,8 @@ protected function _displayHelp($command) {
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::getOptionParser
*/
public function getOptionParser() {
- $parser = new ConsoleOptionParser($this->name);
+ $name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
+ $parser = new ConsoleOptionParser($name);
return $parser;
}
@@ -716,10 +725,10 @@ protected function _controllerName($name) {
}
/**
- * Creates the proper controller camelized name (singularized) for the specified name
+ * Creates the proper model camelized name (singularized) for the specified name
*
* @param string $name Name
- * @return string Camelized and singularized controller name
+ * @return string Camelized and singularized model name
*/
protected function _modelName($name) {
return Inflector::camelize(Inflector::singularize($name));
View
1  lib/Cake/Console/ShellDispatcher.php
@@ -219,6 +219,7 @@ protected function _getShell($shell) {
));
}
$Shell = new $class();
+ $Shell->plugin = trim($plugin, '.');
return $Shell;
}
View
1  lib/Cake/Console/Templates/skel/Config/core.php
@@ -200,6 +200,7 @@
* timestamping regardless of debug value.
*/
//Configure::write('Asset.timestamp', true);
+
/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.
View
2  lib/Cake/Console/Templates/skel/webroot/css/cake.generic.css
@@ -365,6 +365,7 @@ form .submit input[type=submit] {
form .submit input[type=submit]:hover {
background: #5BA150;
}
+
/* Form errors */
form .error {
background: #FFDACC;
@@ -646,6 +647,7 @@ pre {
overflow: auto;
text-shadow: none;
}
+
/* excerpt */
.cake-code-dump pre,
.cake-code-dump pre code {
View
2  lib/Cake/Console/Templates/skel/webroot/index.php
@@ -24,6 +24,7 @@
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
+
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
@@ -37,6 +38,7 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
+
/**
* The actual directory name for the "app".
*
View
2  lib/Cake/Console/Templates/skel/webroot/test.php
@@ -24,6 +24,7 @@
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
+
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
@@ -37,6 +38,7 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
+
/**
* The actual directory name for the "app".
*
View
8 lib/Cake/Controller/CakeErrorController.php
@@ -18,6 +18,14 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
+/**
+ * Error Handling Controller
+ *
+ * Controller used by ErrorHandler to render error views.
+ *
+ * @package Cake.Controller
+ */
class CakeErrorController extends AppController {
/**
View
2  lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
@@ -100,6 +100,7 @@ public function __construct(ComponentCollection $collection, $settings) {
$this->settings['opaque'] = md5($this->settings['realm']);
}
}
+
/**
* Authenticate a user using Digest HTTP auth. Will use the configured User model and attempt a
* login using Digest HTTP auth.
@@ -142,6 +143,7 @@ public function getUser($request) {
}
return false;
}
+
/**
* Find a user record using the standard options.
*
View
6 lib/Cake/Controller/Component/RequestHandlerComponent.php
@@ -22,7 +22,11 @@
App::uses('Xml', 'Utility');
/**
- * Request object for handling HTTP requests
+ * Request object for handling alternative HTTP requests
+ *
+ * Alternative HTTP requests can come from wireless units like mobile phones, palmtop computers,
+ * and the like. These units have no use for Ajax requests, and this Component can tell how Cake
+ * should respond to the different needs of a handheld computer and a desktop machine.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html
View
9 lib/Cake/Controller/Component/SecurityComponent.php
@@ -22,7 +22,14 @@
App::uses('Security', 'Utility');
/**
- * SecurityComponent
+ * The Security Component creates an easy way to integrate tighter security in
+ * your application. It provides methods for various tasks like:
+ *
+ * - Restricting which HTTP methods your application accepts.
+ * - CSRF protection.
+ * - Form tampering protection
+ * - Requiring that SSL be used.
+ * - Limiting cross controller communication.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html
View
8 lib/Cake/Controller/Component/SessionComponent.php
@@ -1,6 +1,6 @@
<?php
/**
- * SessionComponent. Provides access to Sessions from the Controller layer
+ * SessionComponent. Provides access to Sessions from the Controller layer
*
* PHP 5
*
@@ -21,9 +21,9 @@
App::uses('CakeSession', 'Model/Datasource');
/**
- * Session Component.
- *
- * Session handling from the controller.
+ * The CakePHP SessionComponent provides a way to persist client data between
+ * page requests. It acts as a wrapper for the `$_SESSION` as well as providing
+ * convenience methods for several `$_SESSION` related functions.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html
View
6 lib/Cake/Controller/ComponentCollection.php
@@ -19,6 +19,12 @@
App::uses('ObjectCollection', 'Utility');
App::uses('Component', 'Controller');
+/**
+ * Components collection is used as a registry for loaded components and handles loading
+ * and constructing component class objects.
+ *
+ * @package Cake.Controller
+ */
class ComponentCollection extends ObjectCollection {
/**
View
3  lib/Cake/Core/CakePlugin.php
@@ -18,7 +18,8 @@
*/
/**
- * CakePlugin class
+ * CakePlugin is responsible for loading and unloading plugins. It also can
+ * retrieve plugin paths and load their bootstrap and routes files.
*
* @package Cake.Core
* @link http://book.cakephp.org/2.0/en/plugins.html
View
4 lib/Cake/Core/Object.php
@@ -152,9 +152,7 @@ protected function _stop($status = 0) {
* @return boolean Success of log write
*/
public function log($msg, $type = LOG_ERROR) {
- if (!class_exists('CakeLog')) {
- require CAKE . 'cake_log.php';
- }
+ App::uses('CakeLog', 'Log');
if (!is_string($msg)) {
$msg = print_r($msg, true);
}
View
2  lib/Cake/Error/ExceptionRenderer.php
@@ -224,7 +224,7 @@ public function error400($error) {
public function error500($error) {
$message = $error->getMessage();
if (Configure::read('debug') == 0) {
- $message = __d('cake', 'An Internal Error Has Occurred');
+ $message = __d('cake', 'An Internal Error Has Occurred.');
}
$url = $this->controller->request->here();
$code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500;
View
1  lib/Cake/Error/exceptions.php
@@ -226,6 +226,7 @@ public function __construct($message, $code = 404) {
parent::__construct($message, $code);
}
}
+
/**
* Private Action exception - used when a controller action
* starts with a `_`.
View
2  lib/Cake/I18n/I18n.php
@@ -96,7 +96,7 @@ class I18n {
*
* @return void
*/
- protected function __construct() {
+ public function __construct() {
$this->l10n = new L10n();
}
View
4 lib/Cake/Model/AclNode.php
@@ -16,15 +16,11 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Load Model and AppModel
- */
App::uses('AppModel', 'Model');
/**
* ACL Node
*
- *
* @package Cake.Model
*/
class AclNode extends AppModel {
View
3  lib/Cake/Model/Aco.php
@@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Load Model and AppModel
- */
App::uses('AppModel', 'Model');
/**
View
3  lib/Cake/Model/AcoAction.php
@@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Load Model and AppModel
- */
App::uses('AppModel', 'Model');
/**
View
3  lib/Cake/Model/Aro.php
@@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Load Model and AppModel
- */
App::uses('AppModel', 'Model');
/**
View
2  lib/Cake/Model/Behavior/AclBehavior.php
@@ -23,6 +23,8 @@
/**
* ACL behavior
*
+ * Enables objects to easily tie into an ACL system
+ *
* @package Cake.Model.Behavior
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/acl.html
*/
View
5 lib/Cake/Model/Behavior/ContainableBehavior.php
@@ -20,8 +20,9 @@
*/
/**
- * Behavior to allow for dynamic and atomic manipulation of a Model's associations used for a find call. Most useful for limiting
- * the amount of associations and data returned.
+ * Behavior to allow for dynamic and atomic manipulation of a Model's associations
+ * used for a find call. Most useful for limiting the amount of associations and
+ * data returned.
*
* @package Cake.Model.Behavior
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
View
8 lib/Cake/Model/CakeSchema.php
@@ -16,6 +16,7 @@
* @since CakePHP(tm) v 1.2.0.5550
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
App::uses('ConnectionManager', 'Model');
@@ -247,7 +248,12 @@ public function read($options = array()) {
continue;
}
- $Object = ClassRegistry::init(array('class' => $model, 'ds' => $connection));
+ try {
+ $Object = ClassRegistry::init(array('class' => $model, 'ds' => $connection));
+ } catch (CakeException $e) {
+ continue;
+ }
+
$db = $Object->getDataSource();
if (is_object($Object) && $Object->useTable !== false) {
$fulltable = $table = $db->fullTableName($Object, false, false);
View
3  lib/Cake/Model/ConnectionManager.php
@@ -24,6 +24,9 @@
/**
* Manages loaded instances of DataSource objects
*
+ * Provides an interface for loading and enumerating connections defined in
+ * app/Config/database.php
+ *
* @package Cake.Model
*/
class ConnectionManager {
View
15 lib/Cake/Model/Datasource/Database/Postgres.php
@@ -22,8 +22,6 @@
/**
* PostgreSQL layer for DBO.
*
- * Long description for class
- *
* @package Cake.Model.Datasource.Database
*/
class Postgres extends DboSource {
@@ -297,12 +295,12 @@ public function getSequence($table, $field = 'id') {
*
* @param mixed $table A string or model class representing the table to be truncated
* @param boolean $reset true for resetting the sequence, false to leave it as is.
- * and if 1, sequences are not modified
+ * and if 1, sequences are not modified
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
*/
- public function truncate($table, $reset = 0) {
- $table = $this->fullTableName($table, false, false);
- if (!isset($this->_sequenceMap[$table])) {
+ public function truncate($table, $reset = false) {
+ $fullTable = $this->fullTableName($table, false);
+ if (!isset($this->_sequenceMap[$fullTable])) {
$cache = $this->cacheSources;
$this->cacheSources = false;
$this->describe($table);
@@ -310,9 +308,8 @@ public function truncate($table, $reset = 0) {
}
if ($this->execute('DELETE FROM ' . $this->fullTableName($table))) {
$schema = $this->config['schema'];
- $table = $this->fullTableName($table, false, false);
- if (isset($this->_sequenceMap[$table]) && $reset !== 1) {
- foreach ($this->_sequenceMap[$table] as $field => $sequence) {
+ if (isset($this->_sequenceMap[$fullTable]) && $reset != true) {
+ foreach ($this->_sequenceMap[$fullTable] as $field => $sequence) {
$this->_execute("ALTER SEQUENCE \"{$schema}\".\"{$sequence}\" RESTART WITH 1");
}
}
View
2  lib/Cake/Model/Datasource/Database/Sqlserver.php
@@ -585,6 +585,7 @@ public function value($data, $column = null) {
return parent::value($data, $column);
}
}
+
/**
* Returns an array of all result rows for a given SQL query.
* Returns false if no rows matched.
@@ -742,6 +743,7 @@ public function lastAffected($source = null) {
}
return $affected;
}
+
/**
* Executes given SQL statement.
*
View
28 lib/Cake/Model/Model.php
@@ -19,9 +19,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Included libs
- */
App::uses('ClassRegistry', 'Utility');
App::uses('Validation', 'Utility');
App::uses('String', 'Utility');
@@ -709,6 +706,11 @@ public function __construct($id = false, $table = null, $ds = null) {
} elseif ($this->table === false) {
$this->table = Inflector::tableize($this->name);
}
+
+ if ($this->tablePrefix === null) {
+ unset($this->tablePrefix);
+ }
+
$this->_createLinks();
$this->Behaviors->init($this->alias, $this->actsAs);
}
@@ -808,6 +810,13 @@ public function __get($name) {
if ($name === 'displayField') {
return $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey));
}
+ if ($name === 'tablePrefix') {
+ $this->setDataSource();
+ if (property_exists($this, 'tablePrefix')) {
+ return $this->tablePrefix;
+ }
+ return $this->tablePrefix = null;
+ }
if (isset($this->{$name})) {
return $this->{$name};
}
@@ -1193,12 +1202,14 @@ public function deconstruct($field, $data) {
}
}
- $format = $this->getDataSource()->columns[$type]['format'];
- $day = empty($date['Y']) ? null : $date['Y'] . '-' . $date['m'] . '-' . $date['d'] . ' ';
- $hour = empty($date['H']) ? null : $date['H'] . ':' . $date['i'] . ':' . $date['s'];
- $date = new DateTime($day . $hour);
if ($useNewDate && !empty($date)) {
- return $date->format($format);
+ $format = $this->getDataSource()->columns[$type]['format'];
+ foreach (array('m', 'd', 'H', 'i', 's') as $index) {
+ if (isset($date[$index])) {
+ $date[$index] = sprintf('%02d', $date[$index]);
+ }
+ }
+ return str_replace(array_keys($date), array_values($date), $format);
}
}
return $data;
@@ -3090,6 +3101,7 @@ protected function _validateWithModels($options) {
}
return $valid;
}
+
/**
* Marks a field as invalid, optionally setting the name of validation
* rule (in case of multiple validation for field) that was broken.
View
3  lib/Cake/Model/Permission.php
@@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Load Model and AppModel
- */
App::uses('AppModel', 'Model');
/**
View
2  lib/Cake/Network/CakeRequest.php
@@ -223,7 +223,7 @@ protected function _url() {
$uri = substr($uri, strlen($base));
}
if (strpos($uri, '?') !== false) {
- $uri = parse_url($uri, PHP_URL_PATH);
+ list($uri) = explode('?', $uri, 2);
}
if (empty($uri) || $uri == '/' || $uri == '//') {
return '/';
View
1  lib/Cake/Network/CakeSocket.php
@@ -16,6 +16,7 @@
* @since CakePHP(tm) v 1.2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
App::uses('Validation', 'Utility');
/**
View
2  lib/Cake/Network/Email/AbstractTransport.php
@@ -18,7 +18,7 @@
*/
/**
- * Abstract class
+ * Abstract transport for sending email
*
* @package Cake.Network.Email
*/
View
1  lib/Cake/Network/Email/CakeEmail.php
@@ -16,6 +16,7 @@
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
App::uses('Validation', 'Utility');
App::uses('Multibyte', 'I18n');
App::uses('AbstractTransport', 'Network/Email');
View
2  lib/Cake/Network/Email/MailTransport.php
@@ -18,7 +18,7 @@
*/
/**
- * Mail class
+ * Send mail using mail() function
*
* @package Cake.Network.Email
*/
View
3  lib/Cake/Network/Email/SmtpTransport.php
@@ -16,10 +16,11 @@
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
App::uses('CakeSocket', 'Network');
/**
- * SendEmail class
+ * Send mail using SMTP protocol
*
* @package Cake.Network.Email
*/
View
2  lib/Cake/Network/Http/HttpResponse.php
@@ -18,7 +18,7 @@
*/
/**
- * HTTP Response
+ * HTTP Response from HttpSocket.
*
* @package Cake.Network.Http
*/
View
35 lib/Cake/Network/Http/HttpSocket.php
@@ -159,7 +159,30 @@ public function __construct($config = array()) {
}
/**
- * Set authentication settings
+ * Set authentication settings.
+ *
+ * Accepts two forms of parameters. If all you need is a username + password, as with
+ * Basic authentication you can do the following:
+ *
+ * {{{
+ * $http->configAuth('Basic', 'mark', 'secret');
+ * }}}
+ *
+ * If you are using an authentication strategy that requires more inputs, like Digest authentication
+ * you can call `configAuth()` with an array of user information.
+ *
+ * {{{
+ * $http->configAuth('Digest', array(
+ * 'user' => 'mark',
+ * 'pass' => 'secret',
+ * 'realm' => 'my-realm',
+ * 'nonce' => 1235
+ * ));
+ * }}}
+ *
+ * To remove any set authentication strategy, call `configAuth()` with no parameters:
+ *
+ * `$http->configAuth();`
*
* @param string $method Authentication method (ie. Basic, Digest). If empty, disable authentication
* @param mixed $user Username for authentication. Can be an array with settings to authentication class
@@ -275,17 +298,17 @@ public function request($request = array()) {
if (!empty($this->request['cookies'])) {
$cookies = $this->buildCookies($this->request['cookies']);
}
- $schema = '';
+ $scheme = '';
$port = 0;
- if (isset($this->request['uri']['schema'])) {
- $schema = $this->request['uri']['schema'];
+ if (isset($this->request['uri']['scheme'])) {
+ $scheme = $this->request['uri']['scheme'];
}
if (isset($this->request['uri']['port'])) {
$port = $this->request['uri']['port'];
}
if (
- ($schema === 'http' && $port != 80) ||
- ($schema === 'https' && $port != 443) ||
+ ($scheme === 'http' && $port != 80) ||
+ ($scheme === 'https' && $port != 443) ||
($port != 80 && $port != 443)
) {
$Host .= ':' . $port;
View
3  lib/Cake/Routing/Dispatcher.php
@@ -20,9 +20,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * List of helpers to include
- */
App::uses('Router', 'Routing');
App::uses('CakeRequest', 'Network');
App::uses('CakeResponse', 'Network');
View
1  lib/Cake/Routing/Route/CakeRoute.php
@@ -11,6 +11,7 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
App::uses('Set', 'Utility');
/**
View
20 lib/Cake/Routing/Route/PluginShortRoute.php
@@ -1,11 +1,5 @@
<?php
-App::uses('CakeRoute', 'Routing/Route');
/**
- * Plugin short route, that copies the plugin param to the controller parameters
- * It is used for supporting /:plugin routes.
- *
- * PHP5
- *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -14,14 +8,22 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
- * @package Cake.Routing.Route
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
+App::uses('CakeRoute', 'Routing/Route');
+
+/**
+ * Plugin short route, that copies the plugin param to the controller parameters
+ * It is used for supporting /:plugin routes.
+ *
+ * @package Cake.Routing.Route
+ */
class PluginShortRoute extends CakeRoute {
/**
- * Parses a string url into an array. If a plugin key is found, it will be copied to the
+ * Parses a string url into an array. If a plugin key is found, it will be copied to the
* controller parameter
*
* @param string $url The url to parse
@@ -37,7 +39,7 @@ public function parse($url) {
}
/**
- * Reverse route plugin shortcut urls. If the plugin and controller
+ * Reverse route plugin shortcut urls. If the plugin and controller
* are not the same the match is an auto fail.
*
* @param array $url Array of parameters to convert to a string.
View
24 lib/Cake/Routing/Route/RedirectRoute.php
@@ -1,14 +1,5 @@
<?php
-App::uses('CakeResponse', 'Network');
-App::uses('CakeRoute', 'Routing/Route');
-
/**
- * Redirect route will perform an immediate redirect. Redirect routes
- * are useful when you want to have Routing layer redirects occur in your
- * application, for when URLs move.
- *
- * PHP5
- *
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@@ -21,6 +12,17 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
+App::uses('CakeResponse', 'Network');
+App::uses('CakeRoute', 'Routing/Route');
+
+/**
+ * Redirect route will perform an immediate redirect. Redirect routes
+ * are useful when you want to have Routing layer redirects occur in your
+ * application, for when URLs move.
+ *
+ * @package Cake.Routing.Route
+ */
class RedirectRoute extends CakeRoute {
/**
@@ -31,7 +33,7 @@ class RedirectRoute extends CakeRoute {
public $response = null;
/**
- * The location to redirect to. Either a string or a cake array url.
+ * The location to redirect to. Either a string or a cake array url.
*
* @var mixed
*/
@@ -100,7 +102,7 @@ public function match($url) {
}
/**
- * Stop execution of the current script. Wraps exit() making
+ * Stop execution of the current script. Wraps exit() making
* testing easier.
*
* @param integer|string $status see http://php.net/exit for values
View
1  lib/Cake/Test/Case/BasicsTest.php
@@ -80,6 +80,7 @@ public function testArrayDiffKey() {
$this->assertEquals($result, array());
}
+
/**
* testHttpBase method
*
View
2  lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
@@ -45,7 +45,7 @@ public function setUp() {
}
/**
- * teardown method
+ * tearDown method
*
* @return void
*/
View
1  lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
@@ -364,6 +364,7 @@ public function testClear() {
Cache::clear(false, 'memcache2');
}
+
/**
* test that a 0 duration can succesfully write.
*
View
4 lib/Cake/Test/Case/Configure/IniReaderTest.php
@@ -32,8 +32,8 @@ class IniReaderTest extends CakeTestCase {
*
* @return void
*/
- public function setup() {
- parent::setup();
+ public function setUp() {
+ parent::setUp();
$this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
}
View
1  lib/Cake/Test/Case/Configure/PhpReaderTest.php
@@ -28,6 +28,7 @@ public function setUp() {
parent::setUp();
$this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
}
+
/**
* test reading files
*
View
3  lib/Cake/Test/Case/Console/Command/AclShellTest.php
@@ -37,11 +37,12 @@ class AclShellTest extends CakeTestCase {
public $fixtures = array('core.aco', 'core.aro', 'core.aros_aco');
/**
- * setup method
+ * setUp method
*
* @return void
*/
public function setUp() {
+ parent::setUp();
Configure::write('Acl.database', 'test');
Configure::write('Acl.classname', 'DbAcl');
View
2  lib/Cake/Test/Case/Console/Command/BakeShellTest.php
@@ -59,7 +59,7 @@ public function setUp() {
}
/**
- * teardown method
+ * tearDown method
*
* @return void
*/
View
2  lib/Cake/Test/Case/Console/Command/CommandListShellTest.php
@@ -60,7 +60,7 @@ public function setUp() {
}
/**
- * teardown
+ * tearDown
*
* @return void
*/
View
2  lib/Cake/Test/Case/Console/Command/SchemaShellTest.php
@@ -97,7 +97,7 @@ class SchemaShellTest extends CakeTestCase {
);
/**
- * setup method
+ * setUp method
*
* @return void
*/
View
6 lib/Cake/Test/Case/Console/Command/Task/ControllerTaskTest.php
@@ -64,6 +64,7 @@ class ControllerTaskTest extends CakeTestCase {
* @return void
*/
public function setUp() {
+ parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ControllerTask',
@@ -86,14 +87,15 @@ public function setUp() {
}
/**
- * teardown method
+ * tearDown method
*
* @return void
*/
- public function teardown() {
+ public function tearDown() {
unset($this->Task);
ClassRegistry::flush();
App::build();
+ parent::tearDown();
}
/**
View
2  lib/Cake/Test/Case/Console/Command/Task/DbConfigTaskTest.php
@@ -31,7 +31,7 @@
class DbConfigTaskTest extends CakeTestCase {
/**
- * setup method
+ * setUp method
*
* @return void
*/
View
87 lib/Cake/Test/Case/Console/Command/Task/ModelTaskTest.php
@@ -95,7 +95,7 @@ protected function _setupOtherMocks() {
}
/**
- * teardown method
+ * tearDown method
*
* @return void
*/
@@ -205,7 +205,7 @@ public function testGetTableNameCustom() {
*
* @return void
*/
- public function testGetTableOddTable() {
+ public function testGetTableOddTableInteractive() {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask',
@@ -234,6 +234,34 @@ public function testGetTableOddTable() {
}
/**
+ * test getTable with non-conventional tablenames
+ *
+ * @return void
+ */
+ public function testGetTableOddTable() {
+ $out = $this->getMock('ConsoleOutput', array(), array(), '', false);
+ $in = $this->getMock('ConsoleInput', array(), array(), '', false);
+ $this->Task = $this->getMock('ModelTask',
+ array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables'),
+ array($out, $out, $in)
+ );
+ $this->_setupOtherMocks();
+
+ $this->Task->connection = 'test';
+ $this->Task->path = '/my/path/';
+ $this->Task->interactive = false;
+ $this->Task->args = array('BakeOdd');
+
+ $this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
+
+ $this->Task->listAll();
+
+ $result = $this->Task->getTable('BakeOdd');
+ $expected = 'bake_odd';
+ $this->assertEquals($expected, $result);
+ }
+
+/**
* test that initializing the validations works.
*
* @return void
@@ -971,6 +999,61 @@ public function testExecuteIntoAllOddTables() {
}
/**
+ * test that odd tablenames arent inflected back from modelname
+ *
+ * @return void
+ */
+ public function testExecuteIntoBakeOddTables() {
+ $out = $this->getMock('ConsoleOutput', array(), array(), '', false);
+ $in = $this->getMock('ConsoleInput', array(), array(), '', false);
+ $this->Task = $this->getMock('ModelTask',
+ array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables', '_getModelObject', 'bake', 'bakeFixture'),
+ array($out, $out, $in)
+ );
+ $this->_setupOtherMocks();
+
+ $this->Task->connection = 'test';
+ $this->Task->path = '/my/path/';
+ $this->Task->args = array('BakeOdd');
+ $this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
+ $this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
+ $object = new Model(array('name' => 'BakeOdd', 'table' => 'bake_odd', 'ds' => 'test'));
+ $this->Task->expects($this->once())->method('_getModelObject')->with('BakeOdd', 'bake_odd')->will($this->returnValue($object));
+ $this->Task->expects($this->once())->method('bake')->with($object, false)->will($this->returnValue(true));
+ $this->Task->expects($this->once())->method('bakeFixture')->with('BakeOdd', 'bake_odd');
+
+ $this->Task->execute();
+
+ $out = $this->getMock('ConsoleOutput', array(), array(), '', false);
+ $in = $this->getMock('ConsoleInput', array(), array(), '', false);
+ $this->Task = $this->getMock('ModelTask',
+ array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables', '_getModelObject', 'doAssociations', 'doValidation', 'createFile'),
+ array($out, $out, $in)
+ );
+ $this->_setupOtherMocks();
+
+ $this->Task->connection = 'test';
+ $this->Task->path = '/my/path/';
+ $this->Task->args = array('BakeOdd');
+ $this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
+ $this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
+ $object = new Model(array('name' => 'BakeOdd', 'table' => 'bake_odd', 'ds' => 'test'));
+ $this->Task->expects($this->once())->method('_getModelObject')->will($this->returnValue($object));
+ $this->Task->expects($this->once())->method('doAssociations')->will($this->returnValue(array()));
+ $this->Task->expects($this->once())->method('doValidation')->will($this->returnValue(array()));
+
+ $filename = '/my/path/BakeOdd.php';
+ $this->Task->expects($this->once())->method('createFile')
+ ->with($filename, $this->stringContains('class BakeOdd'));
+
+ $filename = '/my/path/BakeOdd.php';
+ $this->Task->expects($this->once())->method('createFile')
+ ->with($filename, $this->stringContains('public $useTable = \'bake_odd\''));
+
+ $this->Task->execute();
+ }
+
+/**
* test that skipTables changes how all() works.
*
* @return void
View
2  lib/Cake/Test/Case/Console/Command/Task/PluginTaskTest.php
@@ -36,7 +36,7 @@
class PluginTaskTest extends CakeTestCase {
/**
- * setup method
+ * setUp method
*
* @return void
*/
View
4 lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php
@@ -35,7 +35,7 @@
class ProjectTaskTest extends CakeTestCase {
/**
- * setup method
+ * setUp method
*
* @return void
*/
@@ -52,7 +52,7 @@ public function setUp() {
}
/**
- * teardown method
+ * tearDown method
*
* @return void
*/
View
8 lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
@@ -19,12 +19,12 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-
App::uses('ShellDispatcher', 'Console');
App::uses('ConsoleOutput', 'Console');
App::uses('ConsoleInput', 'Console');
App::uses('Shell', 'Console');
App::uses('TemplateTask', 'Console/Command/Task');
+
/**
* TemplateTaskTest class
*
@@ -33,11 +33,11 @@
class TemplateTaskTest extends CakeTestCase {
/**
- * setup method
+ * setUp method
*
* @return void
*/
- public function setup() {
+ public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
@@ -49,7 +49,7 @@ public function setup() {
}
/**
- * teardown method
+ * tearDown method
*
* @return void
*/
View
6 lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
@@ -220,12 +220,12 @@ class TestTaskTest extends CakeTestCase {
public $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/**
- * setup method
+ * setUp method
*
* @return void
*/
- public function setup() {
- parent::setup();
+ public function setUp() {
+ parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
View
2  lib/Cake/Test/Case/Console/ConsoleErrorHandlerTest.php
@@ -38,7 +38,7 @@ public function setUp() {
}
/**
- * teardown
+ * tearDown
*
* @return void
*/
View
2  lib/Cake/Test/Case/Console/ShellDispatcherTest.php
@@ -422,6 +422,8 @@ public function testGetShell() {
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('test_plugin.example');
$this->assertInstanceOf('ExampleShell', $result);
+ $this->assertEquals('TestPlugin', $result->plugin);
+ $this->assertEquals('Example', $result->name);
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('TestPlugin.example');
View
13 lib/Cake/Test/Case/Console/ShellTest.php
@@ -841,4 +841,17 @@ public function testShellNaming() {
$expected = 'TestApple';
$this->assertEquals($expected, $this->Shell->TestApple->name);
}
+
+/**
+ * Test that option parsers are created with the correct name/command.
+ *
+ * @return void
+ */
+ public function testGetOptionParser() {
+ $this->Shell->name = 'test';
+ $this->Shell->plugin = 'plugin';
+ $parser = $this->Shell->getOptionParser();
+
+ $this->assertEquals('plugin.test', $parser->command());
+ }
}
View
23 lib/Cake/Test/Case/Console/TaskCollectionTest.php
@@ -22,23 +22,25 @@
class TaskCollectionTest extends CakeTestCase {
/**
- * setup
+ * setUp
*
* @return void
*/
- public function setup() {
+ public function setUp() {
+ parent::setUp();
$shell = $this->getMock('Shell', array(), array(), '', false);
$dispatcher = $this->getMock('ShellDispatcher', array(), array(), '', false);
$this->Tasks = new TaskCollection($shell, $dispatcher);
}
/**
- * teardown
+ * tearDown
*
* @return void
*/
- public function teardown() {
+ public function tearDown() {
unset($this->Tasks);
+ parent::tearDown();
}
/**
@@ -56,6 +58,19 @@ public function testLoad() {
}
/**
+ * test load and enable = false
+ *
+ * @return void
+ */
+ public function testLoadWithEnableFalse() {
+ $result = $this->Tasks->load('DbConfig', array('enabled' => false));
+ $this->assertInstanceOf('DbConfigTask', $result);
+ $this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig);
+
+ $this->assertFalse($this->Tasks->enabled('DbConfig'), 'DbConfigTask should be disabled');
+ }
+
+/**
* test missingtask exception
*
* @expectedException MissingTaskException
View
2  lib/Cake/Test/Case/Controller/Component/Auth/ActionsAuthorizeTest.php
@@ -26,7 +26,7 @@
class ActionsAuthorizeTest extends CakeTestCase {
/**
- * setup
+ * setUp
*
* @return void
*/
View
3  lib/Cake/Test/Case/Controller/Component/Auth/BasicAuthenticateTest.php
@@ -57,7 +57,7 @@ public function setUp() {
}
/**
- * teardown
+ * tearDown
*
* @return void
*/
@@ -163,6 +163,7 @@ public function testAuthenticateChallenge() {
$result = $this->auth->authenticate($request, $this->response);
$this->assertFalse($result);
}
+
/**
* test authenticate sucesss
*
View
2  lib/Cake/Test/Case/Controller/Component/Auth/DigestAuthenticateTest.php
@@ -59,7 +59,7 @@ public function setUp() {
}
/**
- * teardown
+ * tearDown
*
* @return void
*/
View
1  lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
@@ -499,6 +499,7 @@ public function testDeleteRemovesChildren() {
$this->assertNull($this->Cookie->read('User.email'));
$this->Cookie->destroy();
}
+
/**
* Test deleting recursively with keys that don't exist.
*
View
1  lib/Cake/Test/Case/Controller/Component/DbAclTest.php
@@ -470,6 +470,7 @@ public function testRevoke() {
$this->Acl->deny('Bobs', 'ROOT/printers/DoesNotExist', 'create');
}
+
/**
* debug function - to help editing/creating test cases for the ACL component
*
View
1  lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
@@ -45,6 +45,7 @@ public function destination() {
$this->viewPath = 'Posts';
$this->render('index');
}
+
/**
* test method for ajax redirection + parameter parsing
*
View
11 lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
@@ -29,21 +29,23 @@ class CookieAliasComponent extends CookieComponent {
class ComponentCollectionTest extends CakeTestCase {
/**
- * setup
+ * setUp
*
* @return void
*/
- public function setup() {
+ public function setUp() {
+ parent::setUp();
$this->Components = new ComponentCollection();
}
/**
- * teardown
+ * tearDown
*
* @return void
*/
- public function teardown() {
+ public function tearDown() {
unset($this->Components);
+ parent::tearDown();
}
/**
@@ -108,6 +110,7 @@ public function testLoadWithEnableFalse() {
$this->assertFalse($this->Components->enabled('Cookie'), 'Cookie should be disabled');
}
+
/**
* test missingcomponent exception
*
View
2  lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php
@@ -34,6 +34,7 @@ class MergeVarsAppController extends Controller {
* @var array
*/
public $components = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false));
+
/**
* helpers
*
@@ -42,7 +43,6 @@ class MergeVarsAppController extends Controller {
public $helpers = array('MergeVar' => array('format' => 'html', 'terse'));
}
-
/**
* MergeVar Component
*
View
18 lib/Cake/Test/Case/Controller/ControllerTest.php
@@ -35,12 +35,14 @@ class ControllerTestAppController extends Controller {
* @var array
*/
public $helpers = array('Html');
+
/**
* uses property
*
* @var array
*/
public $uses = array('ControllerPost');
+
/**
* components property
*
@@ -305,6 +307,7 @@ class TestComponent extends Object {
*/
public function beforeRedirect() {
}
+
/**
* initialize method
*
@@ -320,6 +323,7 @@ public function initialize(&$controller) {