diff --git a/app/Config/Schema/db_acl.php b/app/Config/Schema/db_acl.php
index e03a8950f..149ded03e 100644
--- a/app/Config/Schema/db_acl.php
+++ b/app/Config/Schema/db_acl.php
@@ -1,6 +1,4 @@
array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
- 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'model' => array('type'=>'string', 'null' => true),
- 'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'alias' => array('type'=>'string', 'null' => true),
- 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
- );
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'model' => array('type' => 'string', 'null' => true),
+ 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'alias' => array('type' => 'string', 'null' => true),
+ 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
public $aros = array(
- 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
- 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'model' => array('type'=>'string', 'null' => true),
- 'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'alias' => array('type'=>'string', 'null' => true),
- 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
- 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
- );
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'model' => array('type' => 'string', 'null' => true),
+ 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'alias' => array('type' => 'string', 'null' => true),
+ 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
public $aros_acos = array(
- 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
- 'aro_id' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
- 'aco_id' => array('type'=>'integer', 'null' => false, 'length' => 10),
- '_create' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
- '_read' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
- '_update' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
- '_delete' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
- 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
- );
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+ 'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
+ '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
+ );
}
diff --git a/app/Config/Schema/i18n.php b/app/Config/Schema/i18n.php
index 8ca081c99..8de0052dd 100644
--- a/app/Config/Schema/i18n.php
+++ b/app/Config/Schema/i18n.php
@@ -1,6 +1,4 @@
array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
- 'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
- 'model' => array('type'=>'string', 'null' => false, 'key' => 'index'),
- 'foreign_key' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
- 'field' => array('type'=>'string', 'null' => false, 'key' => 'index'),
- 'content' => array('type'=>'text', 'null' => true, 'default' => NULL),
- 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
- );
+ 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+ 'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
+ 'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
+ 'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+ 'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
+ 'content' => array('type' => 'text', 'null' => true, 'default' => null),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
+ );
}
diff --git a/app/Config/Schema/sessions.php b/app/Config/Schema/sessions.php
index 7b7db69ab..e98ca060f 100644
--- a/app/Config/Schema/sessions.php
+++ b/app/Config/Schema/sessions.php
@@ -1,6 +1,4 @@
array('type'=>'string', 'null' => false, 'key' => 'primary'),
- 'data' => array('type'=>'text', 'null' => true, 'default' => NULL),
- 'expires' => array('type'=>'integer', 'null' => true, 'default' => NULL),
- 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
- );
+ 'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
+ 'data' => array('type' => 'text', 'null' => true, 'default' => null),
+ 'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
}
diff --git a/app/Console/cake.php b/app/Console/cake.php
index 9732be9ef..edef89473 100644
--- a/app/Console/cake.php
+++ b/app/Console/cake.php
@@ -22,10 +22,10 @@ $dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
if (function_exists('ini_set')) {
$root = dirname(dirname(dirname(__FILE__)));
- ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+ ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
-if (!include($dispatcher)) {
+if (!include ($dispatcher)) {
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
}
unset($paths, $path, $dispatcher, $root, $ds);
diff --git a/app/Controller/PagesController.php b/app/Controller/PagesController.php
index 4759719ae..5a2e57db4 100644
--- a/app/Controller/PagesController.php
+++ b/app/Controller/PagesController.php
@@ -38,7 +38,6 @@ class PagesController extends AppController {
*/
public $name = 'Pages';
-
/**
* This controller does not use a model
*
diff --git a/app/webroot/index.php b/app/webroot/index.php
index 36090de65..e125e09da 100644
--- a/app/webroot/index.php
+++ b/app/webroot/index.php
@@ -21,9 +21,9 @@
/**
* Use the DS to separate the directories in other defines
*/
- if (!defined('DS')) {
- define('DS', DIRECTORY_SEPARATOR);
- }
+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.
@@ -34,16 +34,16 @@
* The full path to the directory which holds "app", WITHOUT a trailing DS.
*
*/
- if (!defined('ROOT')) {
- define('ROOT', dirname(dirname(dirname(__FILE__))));
- }
+if (!defined('ROOT')) {
+ define('ROOT', dirname(dirname(dirname(__FILE__))));
+}
/**
* The actual directory name for the "app".
*
*/
- if (!defined('APP_DIR')) {
- define('APP_DIR', basename(dirname(dirname(__FILE__))));
- }
+if (!defined('APP_DIR')) {
+ define('APP_DIR', basename(dirname(dirname(__FILE__))));
+}
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
@@ -63,30 +63,30 @@
* Change at your own risk.
*
*/
- if (!defined('WEBROOT_DIR')) {
- define('WEBROOT_DIR', basename(dirname(__FILE__)));
- }
- if (!defined('WWW_ROOT')) {
- define('WWW_ROOT', dirname(__FILE__) . DS);
- }
+if (!defined('WEBROOT_DIR')) {
+ define('WEBROOT_DIR', basename(dirname(__FILE__)));
+}
+if (!defined('WWW_ROOT')) {
+ define('WWW_ROOT', dirname(__FILE__) . DS);
+}
- if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- if (function_exists('ini_set')) {
- ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
- }
- if (!include('Cake' . DS . 'bootstrap.php')) {
- $failed = true;
- }
- } else {
- if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
- $failed = true;
- }
+if (!defined('CAKE_CORE_INCLUDE_PATH')) {
+ if (function_exists('ini_set')) {
+ ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
- if (!empty($failed)) {
- trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
+ if (!include ('Cake' . DS . 'bootstrap.php')) {
+ $failed = true;
}
+} else {
+ if (!include (CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
+ $failed = true;
+ }
+}
+if (!empty($failed)) {
+ trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
+}
- App::uses('Dispatcher', 'Routing');
+App::uses('Dispatcher', 'Routing');
- $Dispatcher = new Dispatcher();
- $Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
+$Dispatcher = new Dispatcher();
+$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
diff --git a/app/webroot/test.php b/app/webroot/test.php
index 9a3a072ad..39bea7a91 100644
--- a/app/webroot/test.php
+++ b/app/webroot/test.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing
+ * @link http://book.cakephp.org/2.0/en/development/testing.html
* @package app.webroot
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -21,9 +21,9 @@ ini_set('display_errors', 1);
/**
* Use the DS to separate the directories in other defines
*/
- if (!defined('DS')) {
- define('DS', DIRECTORY_SEPARATOR);
- }
+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.
@@ -34,16 +34,16 @@ ini_set('display_errors', 1);
* The full path to the directory which holds "app", WITHOUT a trailing DS.
*
*/
- if (!defined('ROOT')) {
- define('ROOT', dirname(dirname(dirname(__FILE__))));
- }
+if (!defined('ROOT')) {
+ define('ROOT', dirname(dirname(dirname(__FILE__))));
+}
/**
* The actual directory name for the "app".
*
*/
- if (!defined('APP_DIR')) {
- define('APP_DIR', basename(dirname(dirname(__FILE__))));
- }
+if (!defined('APP_DIR')) {
+ define('APP_DIR', basename(dirname(dirname(__FILE__))));
+}
/**
* The absolute path to the "Cake" directory, WITHOUT a trailing DS.
@@ -71,11 +71,11 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
if (function_exists('ini_set')) {
ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
- if (!include('Cake' . DS . 'bootstrap.php')) {
+ if (!include ('Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
} else {
- if (!include(CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
+ if (!include (CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
$failed = true;
}
}
diff --git a/index.php b/index.php
index 480a9c732..b54f617f3 100644
--- a/index.php
+++ b/index.php
@@ -20,21 +20,23 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+
/**
* Get Cake's root directory
*/
- define('APP_DIR', 'app');
- define('DS', DIRECTORY_SEPARATOR);
- define('ROOT', dirname(__FILE__));
- define('WEBROOT_DIR', 'webroot');
- define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);
+define('APP_DIR', 'app');
+define('DS', DIRECTORY_SEPARATOR);
+define('ROOT', dirname(__FILE__));
+define('WEBROOT_DIR', 'webroot');
+define('WWW_ROOT', ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS);
+
/**
* This only needs to be changed if the "cake" directory is located
* outside of the distributed structure.
* Full path to the directory containing "cake". Do not add trailing directory separator
*/
- if (!defined('CAKE_CORE_INCLUDE_PATH')) {
- define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
- }
+if (!defined('CAKE_CORE_INCLUDE_PATH')) {
+ define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+}
- require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
+require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
diff --git a/lib/Cake/Configure/IniReader.php b/lib/Cake/Configure/IniReader.php
index f47713294..debd685c6 100644
--- a/lib/Cake/Configure/IniReader.php
+++ b/lib/Cake/Configure/IniReader.php
@@ -16,13 +16,15 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+App::uses('Hash', 'Utility');
/**
- * Ini file configuration parser. Since IniReader uses parse_ini_file underneath,
- * you should be aware that this class shares the same behavior, especially with
- * regards to boolean and null values.
+ * Ini file configuration engine.
*
- * In addition to the native parse_ini_file features, IniReader also allows you
+ * Since IniReader uses parse_ini_file underneath, you should be aware that this
+ * class shares the same behavior, especially with regards to boolean and null values.
+ *
+ * In addition to the native `parse_ini_file` features, IniReader also allows you
* to create nested array structures through usage of `.` delimited names. This allows
* you to create nested arrays structures in an ini config file. For example:
*
@@ -126,6 +128,7 @@ class IniReader implements ConfigReaderInterface {
if ($value === '') {
$value = false;
}
+ unset($values[$key]);
if (strpos($key, '.') !== false) {
$values = Hash::insert($values, $key, $value);
} else {
@@ -135,4 +138,47 @@ class IniReader implements ConfigReaderInterface {
return $values;
}
+/**
+ * Dumps the state of Configure data into an ini formatted string.
+ *
+ * @param string $filename The filename on $this->_path to save into.
+ * @param array $data The data to convert to ini file.
+ * @return int Bytes saved.
+ */
+ public function dump($filename, $data) {
+ $result = array();
+ foreach ($data as $key => $value) {
+ if ($key[0] != '[') {
+ $result[] = "[$key]";
+ }
+ if (is_array($value)) {
+ $keyValues = Hash::flatten($value, '.');
+ foreach ($keyValues as $k => $v) {
+ $result[] = "$k = " . $this->_value($v);
+ }
+ }
+ }
+ $contents = join("\n", $result);
+ return file_put_contents($this->_path . $filename, $contents);
+ }
+
+/**
+ * Converts a value into the ini equivalent
+ *
+ * @param mixed $value to export.
+ * @return string String value for ini file.
+ */
+ protected function _value($val) {
+ if ($val === null) {
+ return 'null';
+ }
+ if ($val === true) {
+ return 'true';
+ }
+ if ($val === false) {
+ return 'false';
+ }
+ return (string)$val;
+ }
+
}
diff --git a/lib/Cake/Configure/PhpReader.php b/lib/Cake/Configure/PhpReader.php
index 2043351b8..f5d961961 100644
--- a/lib/Cake/Configure/PhpReader.php
+++ b/lib/Cake/Configure/PhpReader.php
@@ -4,7 +4,6 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
@@ -88,4 +87,17 @@ class PhpReader implements ConfigReaderInterface {
return $config;
}
+/**
+ * Converts the provided $data into a string of PHP code that can
+ * be used saved into a file and loaded later.
+ *
+ * @param string $filename The filename to create on $this->_path.
+ * @param array $data Data to dump.
+ * @return int Bytes saved.
+ */
+ public function dump($filename, $data) {
+ $contents = '_path . $filename, $contents);
+ }
+
}
diff --git a/lib/Cake/Console/Command/Task/FixtureTask.php b/lib/Cake/Console/Command/Task/FixtureTask.php
index c4bf93d62..92e5154c6 100644
--- a/lib/Cake/Console/Command/Task/FixtureTask.php
+++ b/lib/Cake/Console/Command/Task/FixtureTask.php
@@ -362,6 +362,9 @@ class FixtureTask extends BakeTask {
$values = array();
foreach ($record as $field => $value) {
$val = var_export($value, true);
+ if ($val === 'NULL') {
+ $val = 'null';
+ }
$values[] = "\t\t\t'$field' => $val";
}
$out .= "\t\tarray(\n";
diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php
index 92135906a..03386dc99 100644
--- a/lib/Cake/Console/Command/Task/ProjectTask.php
+++ b/lib/Cake/Console/Command/Task/ProjectTask.php
@@ -70,12 +70,6 @@ class ProjectTask extends AppShell {
$success = true;
if ($this->bake($project)) {
$path = Folder::slashTerm($project);
- if ($this->createHome($path)) {
- $this->out(__d('cake_console', ' * Welcome page created'));
- } else {
- $this->err(__d('cake_console', 'The Welcome page was NOT created'));
- $success = false;
- }
if ($this->securitySalt($path) === true) {
$this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\''));
@@ -220,20 +214,6 @@ class ProjectTask extends AppShell {
}
}
-/**
- * Writes a file with a default home page to the project.
- *
- * @param string $dir Path to project
- * @return boolean Success
- */
- public function createHome($dir) {
- $app = basename($dir);
- $path = $dir . 'View' . DS . 'Pages' . DS;
- $source = CAKE . 'Console' . DS . 'Templates' . DS . 'default' . DS . 'views' . DS . 'home.ctp';
- include $source;
- return $this->createFile($path . 'home.ctp', $output);
- }
-
/**
* Generates the correct path to the CakePHP libs that are generating the project
* and points app/console/cake.php to the right place
diff --git a/lib/Cake/Console/Command/Task/TemplateTask.php b/lib/Cake/Console/Command/Task/TemplateTask.php
index d9a0e3f43..34da4f00c 100644
--- a/lib/Cake/Console/Command/Task/TemplateTask.php
+++ b/lib/Cake/Console/Command/Task/TemplateTask.php
@@ -55,11 +55,18 @@ class TemplateTask extends AppShell {
* Find the paths to all the installed shell themes in the app.
*
* Bake themes are directories not named `skel` inside a `Console/Templates` path.
- *
+ * They are listed in this order: app -> plugin -> default
+ *
* @return array Array of bake themes that are installed.
*/
protected function _findThemes() {
- $paths = array();
+ $paths = App::path('Console');
+
+ $plugins = App::objects('plugin');
+ foreach ($plugins as $plugin) {
+ $paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
+ }
+
$core = current(App::core('Console'));
$separator = DS === '/' ? '/' : '\\\\';
$core = preg_replace('#shells' . $separator . '$#', '', $core);
@@ -69,13 +76,7 @@ class TemplateTask extends AppShell {
$contents = $Folder->read();
$themeFolders = $contents[0];
- $plugins = App::objects('plugin');
$paths[] = $core;
- foreach ($plugins as $plugin) {
- $paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
- }
-
- $paths = array_merge($paths, App::path('Console'));
// TEMPORARY TODO remove when all paths are DS terminated
foreach ($paths as $i => $path) {
diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php
index 6b86f7fbe..feb107e07 100644
--- a/lib/Cake/Console/Command/Task/TestTask.php
+++ b/lib/Cake/Console/Command/Task/TestTask.php
@@ -77,7 +77,7 @@ class TestTask extends BakeTask {
}
if (count($this->args) > 1) {
- $type = Inflector::underscore($this->args[0]);
+ $type = Inflector::classify($this->args[0]);
if ($this->bake($type, $this->args[1])) {
$this->out('Done ');
}
@@ -139,7 +139,7 @@ class TestTask extends BakeTask {
$methods = $this->getTestableMethods($fullClassName);
}
$mock = $this->hasMockClass($type, $fullClassName);
- list($preConstruct, $construction, $postConstruct) = $this->generateConstructor($type, $fullClassName);
+ list($preConstruct, $construction, $postConstruct) = $this->generateConstructor($type, $fullClassName, $plugin);
$uses = $this->generateUses($type, $realType, $fullClassName);
$this->out("\n" . __d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET);
@@ -241,6 +241,12 @@ class TestTask extends BakeTask {
*/
public function isLoadableClass($package, $class) {
App::uses($class, $package);
+ list($plugin, $ns) = pluginSplit($package);
+ if ($plugin) {
+ App::uses("{$plugin}AppController", $package);
+ App::uses("{$plugin}AppModel", $package);
+ App::uses("{$plugin}AppHelper", $package);
+ }
return class_exists($class);
}
@@ -440,13 +446,14 @@ class TestTask extends BakeTask {
*
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $fullClassName The Classname of the class the test is being generated for.
+ * @param string $plugin The plugin name.
* @return array Constructor snippets for the thing you are building.
*/
- public function generateConstructor($type, $fullClassName) {
+ public function generateConstructor($type, $fullClassName, $plugin) {
$type = strtolower($type);
$pre = $post = '';
if ($type == 'model') {
- $construct = "ClassRegistry::init('$fullClassName');\n";
+ $construct = "ClassRegistry::init('{$plugin}$fullClassName');\n";
}
if ($type == 'behavior') {
$construct = "new $fullClassName();\n";
diff --git a/lib/Cake/Console/Command/TestShell.php b/lib/Cake/Console/Command/TestShell.php
index a3b410ba0..e5b76b900 100644
--- a/lib/Cake/Console/Command/TestShell.php
+++ b/lib/Cake/Console/Command/TestShell.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
diff --git a/lib/Cake/Console/Command/TestsuiteShell.php b/lib/Cake/Console/Command/TestsuiteShell.php
index 71decbeff..2f858c23b 100644
--- a/lib/Cake/Console/Command/TestsuiteShell.php
+++ b/lib/Cake/Console/Command/TestsuiteShell.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php
index 87c3c6e02..40c27cc15 100644
--- a/lib/Cake/Console/ShellDispatcher.php
+++ b/lib/Cake/Console/ShellDispatcher.php
@@ -160,9 +160,11 @@ class ShellDispatcher {
$errorHandler = new ConsoleErrorHandler();
if (empty($error['consoleHandler'])) {
$error['consoleHandler'] = array($errorHandler, 'handleError');
+ Configure::write('error', $error);
}
if (empty($exception['consoleHandler'])) {
$exception['consoleHandler'] = array($errorHandler, 'handleException');
+ Configure::write('exception', $exception);
}
set_exception_handler($exception['consoleHandler']);
set_error_handler($error['consoleHandler'], Configure::read('Error.level'));
diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp
index c0921c2c4..e34c382d5 100644
--- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp
+++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp
@@ -31,6 +31,7 @@
/**
* view method
*
+ * @throws NotFoundException
* @param string $id
* @return void
*/
@@ -85,6 +86,7 @@
/**
* edit method
*
+ * @throws NotFoundException
* @param string $id
* @return void
*/
@@ -129,6 +131,8 @@
/**
* delete method
*
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
* @param string $id
* @return void
*/
@@ -154,4 +158,4 @@
$this->flash(__(' was not deleted'), array('action' => 'index'));
$this->redirect(array('action' => 'index'));
- }
\ No newline at end of file
+ }
diff --git a/lib/Cake/Console/Templates/default/classes/controller.ctp b/lib/Cake/Console/Templates/default/classes/controller.ctp
index 741e06b00..6e27d0d19 100644
--- a/lib/Cake/Console/Templates/default/classes/controller.ctp
+++ b/lib/Cake/Console/Templates/default/classes/controller.ctp
@@ -46,36 +46,36 @@ class Controller extends App
* @var mixed
*/
public $scaffold;
-
-
-
}
diff --git a/lib/Cake/Console/Templates/default/classes/fixture.ctp b/lib/Cake/Console/Templates/default/classes/fixture.ctp
index 48f6c7834..2bec6a549 100644
--- a/lib/Cake/Console/Templates/default/classes/fixture.ctp
+++ b/lib/Cake/Console/Templates/default/classes/fixture.ctp
@@ -25,6 +25,7 @@
*
*/
class Fixture extends CakeTestFixture {
+
/**
* Table name
@@ -32,6 +33,7 @@ class Fixture extends CakeTestFixture {
* @var string
*/
public $table = '';
+
/**
@@ -40,8 +42,8 @@ class Fixture extends CakeTestFixture {
* @var array
*/
public $import = ;
-
+
/**
* Fields
@@ -49,8 +51,8 @@ class Fixture extends CakeTestFixture {
* @var array
*/
public $fields = ;
-
+
/**
* Records
@@ -58,5 +60,6 @@ class Fixture extends CakeTestFixture {
* @var array
*/
public $records = ;
+
}
diff --git a/lib/Cake/Console/Templates/default/classes/model.ctp b/lib/Cake/Console/Templates/default/classes/model.ctp
index 3634b802f..f7895da2b 100644
--- a/lib/Cake/Console/Templates/default/classes/model.ctp
+++ b/lib/Cake/Console/Templates/default/classes/model.ctp
@@ -36,6 +36,7 @@ foreach (array('hasOne', 'belongsTo', 'hasMany', 'hasAndBelongsToMany') as $asso
?>
*/
class extends AppModel {
+
/**
* Use database config
@@ -43,12 +44,15 @@ class extends AppModel {
* @var string
*/
public $useDbConfig = '';
-
-
/**
* Primary key field
@@ -56,7 +60,9 @@ if ($primaryKey !== 'id'): ?>
* @var string
*/
public $primaryKey = '';
+
/**
* Display field
@@ -64,6 +70,7 @@ if ($displayField): ?>
* @var string
*/
public $displayField = '';
+
', '');
-
+
/**
* Test
*
*/
class Test extends {
+
/**
* Auto render
*
@@ -47,6 +48,7 @@ class Test extends {
public function redirect($url, $status = null, $exit = true) {
$this->redirectUrl = $url;
}
+
}
@@ -55,13 +57,16 @@ class Test extends {
*
*/
class Test extends CakeTestCase {
+
/**
* Fixtures
*
* @var array
*/
- public $fixtures = array('');
+ public $fixtures = array(
+ ''
+ );
/**
@@ -94,7 +99,7 @@ class Test extends CakeTestCase {
* @return void
*/
public function test() {
-
}
+
}
diff --git a/lib/Cake/Console/Templates/default/views/home.ctp b/lib/Cake/Console/Templates/default/views/home.ctp
deleted file mode 100644
index 424051981..000000000
--- a/lib/Cake/Console/Templates/default/views/home.ctp
+++ /dev/null
@@ -1,113 +0,0 @@
-
- For updates and important announcements, visit http://cakefest.org
-\n";
-$output .= "Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP! \n";
-$output .="
- 0):
- Debugger::checkSecurityKeys();
-endif;
-?>
-
-=')):
- echo '';
- echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.');
- echo ' ';
- else:
- echo '';
- echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.');
- echo ' ';
- endif;
-?>
-
-
-';
- echo __d('cake_dev', 'Your tmp directory is writable.');
- echo '';
- else:
- echo '';
- echo __d('cake_dev', 'Your tmp directory is NOT writable.');
- echo ' ';
- endif;
-?>
-
-
-';
- echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/core.php ', ''. \$settings['engine'] . 'Engine ');
- echo '';
- else:
- echo '';
- echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in APP/Config/core.php');
- echo ' ';
- endif;
-?>
-
-
-';
- echo __d('cake_dev', 'Your database configuration file is present.');
- \$filePresent = true;
- echo '';
- else:
- echo '';
- echo __d('cake_dev', 'Your database configuration file is NOT present.');
- echo ' ';
- echo __d('cake_dev', 'Rename APP/Config/database.php.default to APP/Config/database.php');
- echo ' ';
- endif;
-?>
-
-
-
- isConnected()):
- echo '';
- echo __d('cake_dev', 'Cake is able to connect to the database.');
- echo ' ';
- else:
- echo '';
- echo __d('cake_dev', 'Cake is NOT able to connect to the database.');
- echo ' ';
- endif;
- ?>
-
-
-';
- __d('cake_dev', 'PCRE has not been compiled with Unicode support.');
- echo ' ';
- __d('cake_dev', 'Recompile PCRE with Unicode support by adding --enable-unicode-properties
when configuring');
- echo '
';
- }
-?>\n";
-$output .= " \n";
-$output .= "\n";
-$output .= "', APP . 'View' . DS . 'Layouts' . DS . 'default.ctp. ', APP . 'webroot' . DS . 'css');\n";
-$output .= "?>\n";
-$output .= "
\n";
-?>
diff --git a/lib/Cake/Console/Templates/skel/webroot/test.php b/lib/Cake/Console/Templates/skel/webroot/test.php
index c28757943..37b7f2528 100644
--- a/lib/Cake/Console/Templates/skel/webroot/test.php
+++ b/lib/Cake/Console/Templates/skel/webroot/test.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing
+ * @link http://book.cakephp.org/2.0/en/development/testing.html
* @package app.webroot
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Controller/Component.php b/lib/Cake/Controller/Component.php
index cecf39e05..876174e8c 100644
--- a/lib/Cake/Controller/Component.php
+++ b/lib/Cake/Controller/Component.php
@@ -35,7 +35,7 @@ App::uses('ComponentCollection', 'Controller');
* - `beforeRedirect()` - Fired before a redirect() is done.
*
* @package Cake.Controller
- * @link http://book.cakephp.org/view/993/Components
+ * @link http://book.cakephp.org/2.0/en/controllers/components.html
* @see Controller::$components
*/
class Component extends Object {
diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php b/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
index 560da028f..d9dc7248f 100644
--- a/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
+++ b/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php
@@ -30,6 +30,7 @@ abstract class BaseAuthenticate {
* - `scope` Additional conditions to use when looking up and authenticating users,
* i.e. `array('User.is_active' => 1).`
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
+ * - `contain` Extra models to contain and store in session.
*
* @var array
*/
@@ -40,7 +41,8 @@ abstract class BaseAuthenticate {
),
'userModel' => 'User',
'scope' => array(),
- 'recursive' => 0
+ 'recursive' => 0,
+ 'contain' => null,
);
/**
@@ -82,13 +84,16 @@ abstract class BaseAuthenticate {
}
$result = ClassRegistry::init($userModel)->find('first', array(
'conditions' => $conditions,
- 'recursive' => (int)$this->settings['recursive']
+ 'recursive' => (int)$this->settings['recursive'],
+ 'contain' => $this->settings['contain'],
));
if (empty($result) || empty($result[$model])) {
return false;
}
- unset($result[$model][$fields['password']]);
- return $result[$model];
+ $user = $result[$model];
+ unset($user[$fields['password']]);
+ unset($result[$model]);
+ return array_merge($user, $result);
}
/**
diff --git a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php
index c8e772e1c..df65e9c71 100644
--- a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php
+++ b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php
@@ -50,6 +50,7 @@ class BasicAuthenticate extends BaseAuthenticate {
* - `scope` Additional conditions to use when looking up and authenticating users,
* i.e. `array('User.is_active' => 1).`
* - `recursive` The value of the recursive key passed to find(). Defaults to 0.
+ * - `contain` Extra models to contain and store in session.
* - `realm` The realm authentication is for. Defaults the server name.
*
* @var array
@@ -62,6 +63,7 @@ class BasicAuthenticate extends BaseAuthenticate {
'userModel' => 'User',
'scope' => array(),
'recursive' => 0,
+ 'contain' => null,
'realm' => '',
);
diff --git a/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php b/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
index 27722a9c7..bdea7d8aa 100644
--- a/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
+++ b/lib/Cake/Controller/Component/Auth/DigestAuthenticate.php
@@ -63,6 +63,8 @@ class DigestAuthenticate extends BaseAuthenticate {
* - `userModel` The model name of the User, defaults to User.
* - `scope` Additional conditions to use when looking up and authenticating users,
* i.e. `array('User.is_active' => 1).`
+ * - `recursive` The value of the recursive key passed to find(). Defaults to 0.
+ * - `contain` Extra models to contain and store in session.
* - `realm` The realm authentication is for, Defaults to the servername.
* - `nonce` A nonce used for authentication. Defaults to `uniqid()`.
* - `qop` Defaults to auth, no other values are supported at this time.
@@ -79,6 +81,7 @@ class DigestAuthenticate extends BaseAuthenticate {
'userModel' => 'User',
'scope' => array(),
'recursive' => 0,
+ 'contain' => null,
'realm' => '',
'qop' => 'auth',
'nonce' => '',
diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php
index 9a60083eb..b8d6395e2 100644
--- a/lib/Cake/Controller/Component/AuthComponent.php
+++ b/lib/Cake/Controller/Component/AuthComponent.php
@@ -117,7 +117,7 @@ class AuthComponent extends Component {
* You can also use AuthComponent::ALL instead of the string 'all'
*
* @var mixed
- * @link http://book.cakephp.org/view/1275/authorize
+ * @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#authorization
*/
public $authorize = false;
diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php
index 5c66f0509..6341a4901 100644
--- a/lib/Cake/Controller/Controller.php
+++ b/lib/Cake/Controller/Controller.php
@@ -100,6 +100,7 @@ class Controller extends Object implements CakeEventListener {
* additional information about the request.
*
* @var CakeRequest
+ * @link http://book.cakephp.org/2.0/en/controllers/request-response.html#cakerequest
*/
public $request;
@@ -107,6 +108,7 @@ class Controller extends Object implements CakeEventListener {
* An instance of a CakeResponse object that contains information about the impending response
*
* @var CakeResponse
+ * @link http://book.cakephp.org/2.0/en/controllers/request-response.html#cakeresponse
*/
public $response;
@@ -184,7 +186,7 @@ class Controller extends Object implements CakeEventListener {
* Example: `public $components = array('Session', 'RequestHandler', 'Acl');`
*
* @var array
- * @link http://book.cakephp.org/view/961/components-helpers-and-uses
+ * @link http://book.cakephp.org/2.0/en/controllers/components.html
*/
public $components = array('Session');
@@ -196,7 +198,8 @@ class Controller extends Object implements CakeEventListener {
public $viewClass = 'View';
/**
- * Instance of the View created during rendering. Won't be set until after Controller::render() is called.
+ * Instance of the View created during rendering. Won't be set until after
+ * Controller::render() is called.
*
* @var View
*/
@@ -234,7 +237,7 @@ class Controller extends Object implements CakeEventListener {
* marks all the actions in the controller for view caching.
*
* @var mixed
- * @link http://book.cakephp.org/view/1380/Caching-in-the-Controller
+ * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/cache.html#additional-configuration-options
*/
public $cacheAction = false;
@@ -249,13 +252,13 @@ class Controller extends Object implements CakeEventListener {
* Triggers Scaffolding
*
* @var mixed
- * @link http://book.cakephp.org/view/1103/Scaffolding
+ * @link http://book.cakephp.org/2.0/en/controllers/scaffolding.html
*/
public $scaffold = false;
/**
- * Holds current methods of the controller. This is a list of all the methods reachable
- * via url. Modifying this array, will allow you to change which methods can be reached.
+ * Holds current methods of the controller. This is a list of all the methods reachable
+ * via url. Modifying this array, will allow you to change which methods can be reached.
*
* @var array
*/
@@ -767,18 +770,18 @@ class Controller extends Object implements CakeEventListener {
session_write_close();
}
- if (!empty($status) && is_string($status)) {
+ if ($url !== null) {
+ $this->response->header('Location', Router::url($url, true));
+ }
+
+ if (is_string($status)) {
$codes = array_flip($this->response->httpCodes());
if (isset($codes[$status])) {
$status = $codes[$status];
}
}
- if ($url !== null) {
- $this->response->header('Location', Router::url($url, true));
- }
-
- if (!empty($status) && ($status >= 300 && $status < 400)) {
+ if ($status) {
$this->response->statusCode($status);
}
diff --git a/lib/Cake/Controller/Scaffold.php b/lib/Cake/Controller/Scaffold.php
index 1d0fd3e1a..854312686 100644
--- a/lib/Cake/Controller/Scaffold.php
+++ b/lib/Cake/Controller/Scaffold.php
@@ -305,11 +305,11 @@ class Scaffold {
throw new NotFoundException(__d('cake', 'Invalid %s', Inflector::humanize($this->modelClass)));
}
if ($this->ScaffoldModel->delete()) {
- $message = __d('cake', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id);
+ $message = __d('cake', 'The %1$s with id: %2$s has been deleted.', Inflector::humanize($this->modelClass), $id);
return $this->_sendMessage($message);
} else {
$message = __d('cake',
- 'There was an error deleting the %1$s with id: %2$d',
+ 'There was an error deleting the %1$s with id: %2$s',
Inflector::humanize($this->modelClass),
$id
);
diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php
index 01e0d1ae6..071faa7a6 100644
--- a/lib/Cake/Core/App.php
+++ b/lib/Cake/Core/App.php
@@ -913,7 +913,11 @@ class App {
return;
}
- $errorHandler = Configure::read('Error.handler');
+ if (PHP_SAPI === 'cli') {
+ $errorHandler = Configure::read('Error.consoleHandler');
+ } else {
+ $errorHandler = Configure::read('Error.handler');
+ }
if (!is_callable($errorHandler)) {
return;
}
diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php
index 45e60fd2d..b90fcfc6d 100644
--- a/lib/Cake/Core/Configure.php
+++ b/lib/Cake/Core/Configure.php
@@ -278,6 +278,45 @@ class Configure {
return self::write($values);
}
+/**
+ * Dump data currently in Configure into $filename. The serialization format
+ * is decided by the config reader attached as $config. For example, if the
+ * 'default' adapter is a PhpReader, the generated file will be a PHP
+ * configuration file loadable by the PhpReader.
+ *
+ * ## Usage
+ *
+ * Given that the 'default' reader is an instance of PhpReader.
+ * Save all data in Configure to the file `my_config.php`:
+ *
+ * `Configure::dump('my_config.php', 'default');`
+ *
+ * Save only the error handling configuration:
+ *
+ * `Configure::dump('error.php', 'default', array('Error', 'Exception');`
+ *
+ * @param string $key The identifier to create in the config adapter.
+ * This could be a filename or a cache key depending on the adapter being used.
+ * @param string $config The name of the configured adapter to dump data with.
+ * @param array $keys The name of the top-level keys you want to dump.
+ * This allows you save only some data stored in Configure.
+ * @return boolean success
+ * @throws ConfigureException if the adapter does not implement a `dump` method.
+ */
+ public static function dump($key, $config = 'default', $keys = array()) {
+ if (empty(self::$_readers[$config])) {
+ throw new ConfigureException(__d('cake', 'There is no "%s" adapter.', $config));
+ }
+ if (!method_exists(self::$_readers[$config], 'dump')) {
+ throw new ConfigureException(__d('cake', 'The "%s" adapter, does not have a dump() method.', $config));
+ }
+ $values = self::$_values;
+ if (!empty($keys) && is_array($keys)) {
+ $values = array_intersect_key($values, array_flip($keys));
+ }
+ return (bool)self::$_readers[$config]->dump($key, $values);
+ }
+
/**
* Used to determine the current version of CakePHP.
*
diff --git a/lib/Cake/Error/ErrorHandler.php b/lib/Cake/Error/ErrorHandler.php
index 0a25b1c27..99b589655 100644
--- a/lib/Cake/Error/ErrorHandler.php
+++ b/lib/Cake/Error/ErrorHandler.php
@@ -204,7 +204,10 @@ class ErrorHandler {
return false;
}
- ob_clean();
+ if (ob_get_level()) {
+ ob_clean();
+ }
+
if (Configure::read('debug')) {
call_user_func($exceptionHandler, new FatalErrorException($description, 500, $file, $line));
} else {
diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php
index adb6d4cce..d471b3123 100644
--- a/lib/Cake/Error/ExceptionRenderer.php
+++ b/lib/Cake/Error/ExceptionRenderer.php
@@ -147,8 +147,12 @@ class ExceptionRenderer {
}
$response = new CakeResponse(array('charset' => Configure::read('App.encoding')));
try {
- $controller = new CakeErrorController($request, $response);
+ if (class_exists('AppController')) {
+ $controller = new CakeErrorController($request, $response);
+ }
} catch (Exception $e) {
+ }
+ if (empty($controller)) {
$controller = new Controller($request, $response);
$controller->viewPath = 'Errors';
}
@@ -264,6 +268,11 @@ class ExceptionRenderer {
$this->controller->afterFilter();
$this->controller->response->send();
} catch (Exception $e) {
+ $this->controller->set(array(
+ 'error' => $e,
+ 'name' => $e->getMessage(),
+ 'code' => $e->getCode(),
+ ));
$this->_outputMessageSafe('error500');
}
}
diff --git a/lib/Cake/Error/exceptions.php b/lib/Cake/Error/exceptions.php
index fea1eacdf..53c1cb9d3 100644
--- a/lib/Cake/Error/exceptions.php
+++ b/lib/Cake/Error/exceptions.php
@@ -12,7 +12,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html
* @package Cake.Error
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -555,3 +555,18 @@ class FatalErrorException extends CakeException {
}
}
+
+/**
+ * Not Implemented Exception - used when an API method is not implemented
+ *
+ * @package Cake.Error
+ */
+class NotImplementedException extends CakeException {
+
+ protected $_messageTemplate = '%s is not implemented.';
+
+ public function __construct($message, $code = 501) {
+ parent::__construct($message, $code);
+ }
+
+}
diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php
index bce937cca..83378a6c2 100644
--- a/lib/Cake/Model/Behavior/TranslateBehavior.php
+++ b/lib/Cake/Model/Behavior/TranslateBehavior.php
@@ -310,6 +310,42 @@ class TranslateBehavior extends ModelBehavior {
* @return boolean
*/
public function beforeValidate(Model $model) {
+ unset($this->runtime[$model->alias]['beforeSave']);
+ $this->_setRuntimeData($model);
+ return true;
+ }
+
+/**
+ * beforeSave callback.
+ *
+ * Copies data into the runtime property when `$options['validate']` is
+ * disabled. Or the runtime data hasn't been set yet.
+ *
+ * @param Model $model Model save was called on.
+ * @return boolean true.
+ */
+ public function beforeSave(Model $model, $options = array()) {
+ if (isset($options['validate']) && $options['validate'] == false) {
+ unset($this->runtime[$model->alias]['beforeSave']);
+ }
+ if (isset($this->runtime[$model->alias]['beforeSave'])) {
+ return true;
+ }
+ $this->_setRuntimeData($model);
+ return true;
+ }
+
+/**
+ * Sets the runtime data.
+ *
+ * Used from beforeValidate() and beforeSave() for compatibility issues,
+ * and to allow translations to be persisted even when validation
+ * is disabled.
+ *
+ * @param Model $model
+ * @return void
+ */
+ protected function _setRuntimeData(Model $model) {
$locale = $this->_getLocale($model);
if (empty($locale)) {
return true;
@@ -333,7 +369,6 @@ class TranslateBehavior extends ModelBehavior {
}
}
$this->runtime[$model->alias]['beforeSave'] = $tempData;
- return true;
}
/**
@@ -344,12 +379,17 @@ class TranslateBehavior extends ModelBehavior {
* @return void
*/
public function afterSave(Model $model, $created) {
- if (!isset($this->runtime[$model->alias]['beforeSave'])) {
+ if (!isset($this->runtime[$model->alias]['beforeValidate']) && !isset($this->runtime[$model->alias]['beforeSave'])) {
return true;
}
$locale = $this->_getLocale($model);
- $tempData = $this->runtime[$model->alias]['beforeSave'];
- unset($this->runtime[$model->alias]['beforeSave']);
+ if (isset($this->runtime[$model->alias]['beforeValidate'])) {
+ $tempData = $this->runtime[$model->alias]['beforeValidate'];
+ } else {
+ $tempData = $this->runtime[$model->alias]['beforeSave'];
+ }
+
+ unset($this->runtime[$model->alias]['beforeValidate'], $this->runtime[$model->alias]['beforeSave']);
$conditions = array('model' => $model->alias, 'foreign_key' => $model->id);
$RuntimeModel = $this->translateModel($model);
diff --git a/lib/Cake/Model/CakeSchema.php b/lib/Cake/Model/CakeSchema.php
index b9ae0ad0d..35698a347 100644
--- a/lib/Cake/Model/CakeSchema.php
+++ b/lib/Cake/Model/CakeSchema.php
@@ -414,12 +414,12 @@ class CakeSchema extends Object {
unset($value['type']);
$col .= join(', ', $this->_values($value));
} elseif ($field == 'indexes') {
- $col = "\t\t'indexes' => array(";
+ $col = "\t\t'indexes' => array(\n\t\t\t";
$props = array();
foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(" . join(', ', $this->_values($index)) . ")";
}
- $col .= join(', ', $props);
+ $col .= join(",\n\t\t\t", $props) . "\n\t\t";
} elseif ($field == 'tableParameters') {
$col = "\t\t'tableParameters' => array(";
$props = array();
@@ -577,6 +577,9 @@ class CakeSchema extends Object {
$vals[] = "'{$key}' => array('" . implode("', '", $val) . "')";
} elseif (!is_numeric($key)) {
$val = var_export($val, true);
+ if ($val === 'NULL') {
+ $val = 'null';
+ }
$vals[] = "'{$key}' => {$val}";
}
}
diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php
index 70c51366c..9506a8a94 100644
--- a/lib/Cake/Model/Datasource/Database/Mysql.php
+++ b/lib/Cake/Model/Datasource/Database/Mysql.php
@@ -681,8 +681,8 @@ class Mysql extends DboSource {
*
* @return boolean
*/
- public function supportNestedTransaction() {
- return $this->nestedTransaction && version_compare($this->getVersion(), '4.1', '>=');
+ public function nestedTransactionSupported() {
+ return $this->useNestedTransactions && version_compare($this->getVersion(), '4.1', '>=');
}
}
diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php
index 35f568aad..132e822c1 100644
--- a/lib/Cake/Model/Datasource/Database/Postgres.php
+++ b/lib/Cake/Model/Datasource/Database/Postgres.php
@@ -900,8 +900,8 @@ class Postgres extends DboSource {
*
* @return boolean
*/
- public function supportNestedTransaction() {
- return $this->nestedTransaction && version_compare($this->getVersion(), '8.0', '>=');
+ public function nestedTransactionSupported() {
+ return $this->useNestedTransactions && version_compare($this->getVersion(), '8.0', '>=');
}
}
diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php
index 419709892..4c5b3e541 100644
--- a/lib/Cake/Model/Datasource/Database/Sqlite.php
+++ b/lib/Cake/Model/Datasource/Database/Sqlite.php
@@ -564,8 +564,8 @@ class Sqlite extends DboSource {
*
* @return boolean
*/
- public function supportNestedTransaction() {
- return $this->nestedTransaction && version_compare($this->getVersion(), '3.6.8', '>=');
+ public function nestedTransactionSupported() {
+ return $this->useNestedTransactions && version_compare($this->getVersion(), '3.6.8', '>=');
}
}
diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php
index 0ba0eb3e2..0878efdd5 100644
--- a/lib/Cake/Model/Datasource/DboSource.php
+++ b/lib/Cake/Model/Datasource/DboSource.php
@@ -76,7 +76,7 @@ class DboSource extends DataSource {
*
* @var boolean
*/
- public $nestedTransaction = false;
+ public $useNestedTransactions = false;
/**
* Print full query debug info?
@@ -2031,7 +2031,7 @@ class DboSource extends DataSource {
*
* @return boolean
*/
- public function supportNestedTransaction() {
+ public function nestedTransactionSupported() {
return false;
}
@@ -2044,7 +2044,7 @@ class DboSource extends DataSource {
*/
public function begin() {
if ($this->_transactionStarted) {
- if ($this->supportNestedTransaction()) {
+ if ($this->nestedTransactionSupported()) {
return $this->_beginNested();
}
$this->_transactionNesting++;
@@ -2092,7 +2092,7 @@ class DboSource extends DataSource {
return $this->_connection->commit();
}
- if ($this->supportNestedTransaction()) {
+ if ($this->nestedTransactionSupported()) {
return $this->_commitNested();
}
@@ -2134,7 +2134,7 @@ class DboSource extends DataSource {
return $this->_connection->rollBack();
}
- if ($this->supportNestedTransaction()) {
+ if ($this->nestedTransactionSupported()) {
return $this->_rollbackNested();
}
diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php
index 5dc04a134..62ac03e18 100644
--- a/lib/Cake/Model/Model.php
+++ b/lib/Cake/Model/Model.php
@@ -60,7 +60,7 @@ class Model extends Object implements CakeEventListener {
* Custom database table name, or null/false if no table association is desired.
*
* @var string
- * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#useTable
+ * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#usetable
*/
public $useTable = null;
@@ -70,7 +70,7 @@ class Model extends Object implements CakeEventListener {
* This field is also used in `find('list')` when called with no extra parameters in the fields list
*
* @var string
- * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#displayField
+ * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#displayfield
*/
public $displayField = null;
@@ -262,7 +262,7 @@ class Model extends Object implements CakeEventListener {
* caching only, the results are not stored beyond the current request.
*
* @var boolean
- * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#cacheQueries
+ * @link http://book.cakephp.org/2.0/en/models/model-attributes.html#cachequeries
*/
public $cacheQueries = false;
@@ -1454,7 +1454,7 @@ class Model extends Object implements CakeEventListener {
$defaults = array();
$this->id = false;
$this->data = array();
- $this->validationErrors = $this->validator()->validationErrors = array();
+ $this->validationErrors = array();
if ($data !== null && $data !== false) {
foreach ($this->schema() as $field => $properties) {
@@ -2041,7 +2041,7 @@ class Model extends Object implements CakeEventListener {
}
$options = array_merge(array('validate' => 'first', 'atomic' => true, 'deep' => false), $options);
- $validationErrors = array();
+ $this->validationErrors = $validationErrors = array();
if (empty($data) && $options['validate'] !== false) {
$result = $this->save($data, $options);
@@ -2109,6 +2109,10 @@ class Model extends Object implements CakeEventListener {
* - fieldList: Equivalent to the $fieldList parameter in Model::save()
* - deep: If set to true, all associated data will be validated as well.
*
+ * Warning: This method could potentially change the passed argument `$data`,
+ * If you do not want this to happen, make a copy of `$data` before passing it
+ * to this method
+ *
* @param array $data Record data to validate. This should be a numerically-indexed array
* @param array $options Options to use when validating record data (see above), See also $options of validates().
* @return boolean True on success, or false on failure.
@@ -2152,7 +2156,7 @@ class Model extends Object implements CakeEventListener {
}
$options = array_merge(array('validate' => 'first', 'atomic' => true, 'deep' => false), $options);
- $validationErrors = array();
+ $this->validationErrors = $validationErrors = array();
if (empty($data) && $options['validate'] !== false) {
$result = $this->save($data, $options);
@@ -2285,14 +2289,74 @@ class Model extends Object implements CakeEventListener {
* - fieldList: Equivalent to the $fieldList parameter in Model::save()
* - deep: If set to true, not only directly associated data , but deeper nested associated data is validated as well.
*
+ * Warning: This method could potentially change the passed argument `$data`,
+ * If you do not want this to happen, make a copy of `$data` before passing it
+ * to this method
+ *
* @param array $data Record data to validate. This should be an array indexed by association name.
* @param array $options Options to use when validating record data (see above), See also $options of validates().
* @return array|boolean If atomic: True on success, or false on failure.
* Otherwise: array similar to the $data array passed, but values are set to true/false
* depending on whether each record validated successfully.
*/
- public function validateAssociated($data, $options = array()) {
- return $this->validator()->validateAssociated($data, $options);
+ public function validateAssociated(&$data, $options = array()) {
+ $options = array_merge(array('atomic' => true, 'deep' => false), $options);
+ $this->validationErrors = $validationErrors = $return = array();
+ if (!($this->create($data) && $this->validates($options))) {
+ $validationErrors[$this->alias] = $this->validationErrors;
+ $return[$this->alias] = false;
+ } else {
+ $return[$this->alias] = true;
+ }
+
+ if (empty($options['deep'])) {
+ $data = $this->data;
+ } else {
+ $modelData = $this->data;
+ $recordData = $modelData[$this->alias];
+ unset($modelData[$this->alias]);
+ $data = $modelData + array_merge($data, $recordData);
+ }
+
+ $associations = $this->getAssociated();
+ foreach ($data as $association => &$values) {
+ $validates = true;
+ if (isset($associations[$association])) {
+ if (in_array($associations[$association], array('belongsTo', 'hasOne'))) {
+ if ($options['deep']) {
+ $validates = $this->{$association}->validateAssociated($values, $options);
+ } else {
+ $validates = $this->{$association}->create($values) !== null && $this->{$association}->validates($options);
+ }
+ if (is_array($validates)) {
+ if (in_array(false, $validates, true)) {
+ $validates = false;
+ } else {
+ $validates = true;
+ }
+ }
+ $return[$association] = $validates;
+ } elseif ($associations[$association] === 'hasMany') {
+ $validates = $this->{$association}->validateMany($values, $options);
+ $return[$association] = $validates;
+ }
+ if (!$validates || (is_array($validates) && in_array(false, $validates, true))) {
+ $validationErrors[$association] = $this->{$association}->validationErrors;
+ }
+ }
+ }
+
+ $this->validationErrors = $validationErrors;
+ if (isset($validationErrors[$this->alias])) {
+ $this->validationErrors = $validationErrors[$this->alias];
+ }
+ if (!$options['atomic']) {
+ return $return;
+ }
+ if ($return[$this->alias] === false || !empty($this->validationErrors)) {
+ return false;
+ }
+ return true;
}
/**
@@ -3239,7 +3303,7 @@ class Model extends Object implements CakeEventListener {
* @param array $queryData Data used to execute this query, i.e. conditions, order, etc.
* @return mixed true if the operation should continue, false if it should abort; or, modified
* $queryData to continue with new $queryData
- * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeFind-1049
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforefind
*/
public function beforeFind($queryData) {
return true;
@@ -3252,7 +3316,7 @@ class Model extends Object implements CakeEventListener {
* @param mixed $results The results of the find operation
* @param boolean $primary Whether this model is being queried directly (vs. being queried as an association)
* @return mixed Result of the find operation
- * @link http://book.cakephp.org/view/1048/Callback-Methods#afterFind-1050
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#afterfind
*/
public function afterFind($results, $primary = false) {
return $results;
@@ -3264,7 +3328,7 @@ class Model extends Object implements CakeEventListener {
*
* @param array $options
* @return boolean True if the operation should continue, false if it should abort
- * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeSave-1052
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforesave
*/
public function beforeSave($options = array()) {
return true;
@@ -3275,7 +3339,7 @@ class Model extends Object implements CakeEventListener {
*
* @param boolean $created True if this save created a new record
* @return void
- * @link http://book.cakephp.org/view/1048/Callback-Methods#afterSave-1053
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#aftersave
*/
public function afterSave($created) {
}
@@ -3285,7 +3349,7 @@ class Model extends Object implements CakeEventListener {
*
* @param boolean $cascade If true records that depend on this record will also be deleted
* @return boolean True if the operation should continue, false if it should abort
- * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeDelete-1054
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforedelete
*/
public function beforeDelete($cascade = true) {
return true;
@@ -3295,7 +3359,7 @@ class Model extends Object implements CakeEventListener {
* Called after every deletion operation.
*
* @return void
- * @link http://book.cakephp.org/view/1048/Callback-Methods#afterDelete-1055
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#afterdelete
*/
public function afterDelete() {
}
@@ -3306,7 +3370,7 @@ class Model extends Object implements CakeEventListener {
*
* @param array $options Options passed from model::save(), see $options of model::save().
* @return boolean True if validate operation should continue, false to abort
- * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeValidate-1051
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate
*/
public function beforeValidate($options = array()) {
return true;
@@ -3324,7 +3388,7 @@ class Model extends Object implements CakeEventListener {
* Called when a DataSource-level error occurs.
*
* @return void
- * @link http://book.cakephp.org/view/1048/Callback-Methods#onError-1056
+ * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#onerror
*/
public function onError() {
}
diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php
index 591ae6421..aa760aa65 100644
--- a/lib/Cake/Network/CakeResponse.php
+++ b/lib/Cake/Network/CakeResponse.php
@@ -80,6 +80,10 @@ class CakeResponse {
* @var array
*/
protected $_mimeTypes = array(
+ 'html' => array('text/html', '*/*'),
+ 'json' => 'application/json',
+ 'xml' => array('application/xml', 'text/xml'),
+ 'rss' => 'application/rss+xml',
'ai' => 'application/postscript',
'bcpio' => 'application/x-bcpio',
'bin' => 'application/octet-stream',
@@ -206,7 +210,6 @@ class CakeResponse {
'f90' => 'text/plain',
'h' => 'text/plain',
'hh' => 'text/plain',
- 'html' => array('text/html', '*/*'),
'htm' => array('text/html', '*/*'),
'ics' => 'text/calendar',
'm' => 'text/plain',
@@ -218,7 +221,6 @@ class CakeResponse {
'tpl' => 'text/template',
'txt' => 'text/plain',
'text' => 'text/plain',
- 'xml' => array('application/xml', 'text/xml'),
'avi' => 'video/x-msvideo',
'fli' => 'video/x-fli',
'mov' => 'video/quicktime',
@@ -261,12 +263,10 @@ class CakeResponse {
'pdb' => 'chemical/x-pdb',
'xyz' => 'chemical/x-pdb',
'javascript' => 'text/javascript',
- 'json' => 'application/json',
'form' => 'application/x-www-form-urlencoded',
'file' => 'multipart/form-data',
'xhtml' => array('application/xhtml+xml', 'application/xhtml', 'text/xhtml'),
'xhtml-mobile' => 'application/vnd.wap.xhtml+xml',
- 'rss' => 'application/rss+xml',
'atom' => 'application/atom+xml',
'amf' => 'application/x-amf',
'wap' => array('text/vnd.wap.wml', 'text/vnd.wap.wmlscript', 'image/vnd.wap.wbmp'),
@@ -328,7 +328,7 @@ class CakeResponse {
/**
* Holds cookies to be sent to the client
- *
+ *
* @var array
*/
protected $_cookies = array();
@@ -384,7 +384,7 @@ class CakeResponse {
* Sets the cookies that have been added via static method CakeResponse::addCookie()
* before any other output is sent to the client.
* Will set the cookies in the order they have been set.
- *
+ *
* @return void
*/
protected function _setCookies() {
@@ -595,7 +595,7 @@ class CakeResponse {
* Sets the response content type. It can be either a file extension
* which will be mapped internally to a mime-type or a string representing a mime-type
* if $contentType is null the current content type is returned
- * if $contentType is an associative array, it will be stored as a content type definition
+ * if $contentType is an associative array, content type definitions will be stored/replaced
*
* ### Setting the content type
*
@@ -605,9 +605,9 @@ class CakeResponse {
*
* e.g `type();`
*
- * ### Storing a content type definition
+ * ### Storing content type definitions
*
- * e.g `type(array('keynote' => 'application/keynote'));`
+ * e.g `type(array('keynote' => 'application/keynote', 'bat' => 'application/bat'));`
*
* ### Replacing a content type definition
*
@@ -621,9 +621,9 @@ class CakeResponse {
return $this->_contentType;
}
if (is_array($contentType)) {
- $type = key($contentType);
- $defitition = current($contentType);
- $this->_mimeTypes[$type] = $defitition;
+ foreach ($contentType as $type => $definition) {
+ $this->_mimeTypes[$type] = $definition;
+ }
return $this->_contentType;
}
if (isset($this->_mimeTypes[$contentType])) {
@@ -800,12 +800,12 @@ class CakeResponse {
/**
* Sets the Cache-Control must-revalidate directive.
- * must-revalidate indicates that the response should not be served
- * stale by a cache under any cirumstance without first revalidating
+ * must-revalidate indicates that the response should not be served
+ * stale by a cache under any cirumstance without first revalidating
* with the origin.
* If called with no parameters, this function will return wheter must-revalidate is present.
*
- * @param int $seconds if null, the method will return the current
+ * @param int $seconds if null, the method will return the current
* must-revalidate value
* @return boolean
*/
@@ -886,8 +886,8 @@ class CakeResponse {
}
/**
- * Sets the response as Not Modified by removing any body contents
- * setting the status code to "304 Not Modified" and removing all
+ * Sets the response as Not Modified by removing any body contents
+ * setting the status code to "304 Not Modified" and removing all
* conflicting headers
*
* @return void
@@ -911,11 +911,11 @@ class CakeResponse {
/**
* Sets the Vary header for the response, if an array is passed,
- * values will be imploded into a comma separated string. If no
- * parameters are passed, then an array with the current Vary header
+ * values will be imploded into a comma separated string. If no
+ * parameters are passed, then an array with the current Vary header
* value is returned
*
- * @param string|array $cacheVariances a single Vary string or a array
+ * @param string|array $cacheVariances a single Vary string or a array
* containig the list for variances.
* @return array
**/
@@ -932,22 +932,22 @@ class CakeResponse {
/**
* Sets the response Etag, Etags are a strong indicative that a response
- * can be cached by a HTTP client. A bad way of generaing Etags is
- * creating a hash of the response output, instead generate a unique
- * hash of the unique components that identifies a request, such as a
- * modification time, a resource Id, and anything else you consider it
+ * can be cached by a HTTP client. A bad way of generaing Etags is
+ * creating a hash of the response output, instead generate a unique
+ * hash of the unique components that identifies a request, such as a
+ * modification time, a resource Id, and anything else you consider it
* makes it unique.
*
- * Second parameter is used to instuct clients that the content has
- * changed, but sematicallly, it can be used as the same thing. Think
- * for instance of a page with a hit counter, two different page views
- * are equivalent, but they differ by a few bytes. This leaves off to
+ * Second parameter is used to instuct clients that the content has
+ * changed, but sematicallly, it can be used as the same thing. Think
+ * for instance of a page with a hit counter, two different page views
+ * are equivalent, but they differ by a few bytes. This leaves off to
* the Client the decision of using or not the cached page.
*
* If no parameters are passed, current Etag header is returned.
*
* @param string $hash the unique has that identifies this resposnse
- * @param boolean $weak whether the response is semantically the same as
+ * @param boolean $weak whether the response is semantically the same as
* other with th same hash or not
* @return string
**/
@@ -965,7 +965,7 @@ class CakeResponse {
* Returns a DateTime object initialized at the $time param and using UTC
* as timezone
*
- * @param string|int|DateTime $time
+ * @param string|int|DateTime $time
* @return DateTime
*/
protected function _getUTCDate($time = null) {
@@ -1043,16 +1043,16 @@ class CakeResponse {
}
/**
- * Checks whether a response has not been modified according to the 'If-None-Match'
- * (Etags) and 'If-Modified-Since' (last modification date) request
- * headers headers. If the response is detected to be not modified, it
+ * Checks whether a response has not been modified according to the 'If-None-Match'
+ * (Etags) and 'If-Modified-Since' (last modification date) request
+ * headers headers. If the response is detected to be not modified, it
* is marked as so accordingly so the client can be informed of that.
*
- * In order to mark a response as not modified, you need to set at least
- * the Last-Modified response header or a response etag to be compared
+ * In order to mark a response as not modified, you need to set at least
+ * the Last-Modified response header or a response etag to be compared
* with the request itself
*
- * @return boolean whether the response was marked as not modified or
+ * @return boolean whether the response was marked as not modified or
* not
**/
public function checkNotModified(CakeRequest $request) {
@@ -1087,19 +1087,19 @@ class CakeResponse {
/**
* Getter/Setter for cookie configs
- *
+ *
* This method acts as a setter/getter depending on the type of the argument.
* If the method is called with no arguments, it returns all configurations.
- *
+ *
* If the method is called with a string as argument, it returns either the
* given configuration if it is set, or null, if it's not set.
- *
+ *
* If the method is called with an array as argument, it will set the cookie
* configuration to the cookie container.
- *
+ *
* @param $options Either null to get all cookies, string for a specific cookie
* or array to set cookie.
- *
+ *
* ### Options (when setting a configuration)
* - name: The Cookie name
* - value: Value of the cookie
@@ -1108,21 +1108,21 @@ class CakeResponse {
* - domain: Domain the cookie is for.
* - secure: Is the cookie https?
* - httpOnly: Is the cookie available in the client?
- *
+ *
* ## Examples
- *
+ *
* ### Getting all cookies
- *
+ *
* `$this->cookie()`
- *
+ *
* ### Getting a certain cookie configuration
- *
+ *
* `$this->cookie('MyCookie')`
- *
+ *
* ### Setting a cookie configuration
- *
+ *
* `$this->cookie((array) $options)`
- *
+ *
* @return mixed
*/
public function cookie($options = null) {
diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php
index 7f6257da5..acd212da1 100644
--- a/lib/Cake/Network/Email/CakeEmail.php
+++ b/lib/Cake/Network/Email/CakeEmail.php
@@ -1238,9 +1238,6 @@ class CakeEmail {
$formatted[] = '';
continue;
}
- if ($line[0] === '.') {
- $line = '.' . $line;
- }
if (!preg_match('/\<[a-z]/i', $line)) {
$formatted = array_merge($formatted, explode("\n", wordwrap($line, self::LINE_LENGTH_SHOULD, "\n")));
continue;
diff --git a/lib/Cake/Network/Email/SmtpTransport.php b/lib/Cake/Network/Email/SmtpTransport.php
index e89b21557..636e5a31b 100644
--- a/lib/Cake/Network/Email/SmtpTransport.php
+++ b/lib/Cake/Network/Email/SmtpTransport.php
@@ -168,7 +168,16 @@ class SmtpTransport extends AbstractTransport {
$headers = $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'subject'));
$headers = $this->_headersToString($headers);
- $message = implode("\r\n", $this->_cakeEmail->message());
+ $lines = $this->_cakeEmail->message();
+ $messages = array();
+ foreach ($lines as $line) {
+ if ((!empty($line)) && ($line[0] === '.')) {
+ $messages[] = '.' . $line;
+ } else {
+ $messages[] = $line;
+ }
+ }
+ $message = implode("\r\n", $messages);
$this->_smtpSend($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n.");
$this->_content = array('headers' => $headers, 'message' => $message);
}
diff --git a/lib/Cake/Routing/Route/CakeRoute.php b/lib/Cake/Routing/Route/CakeRoute.php
index 4744a3077..b3121de39 100644
--- a/lib/Cake/Routing/Route/CakeRoute.php
+++ b/lib/Cake/Routing/Route/CakeRoute.php
@@ -478,8 +478,11 @@ class CakeRoute {
* @return string Composed route string.
*/
protected function _writeUrl($params) {
- if (isset($params['prefix'], $params['action'])) {
- $params['action'] = str_replace($params['prefix'] . '_', '', $params['action']);
+ if (isset($params['prefix'])) {
+ $prefixed = $params['prefix'] . '_';
+ }
+ if (isset($prefixed, $params['action']) && strpos($params['action'], $prefixed) === 0) {
+ $params['action'] = substr($params['action'], strlen($prefixed) * -1);
unset($params['prefix']);
}
diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php
index ee081adc2..9c2945d34 100644
--- a/lib/Cake/Routing/Router.php
+++ b/lib/Cake/Routing/Router.php
@@ -157,7 +157,7 @@ class Router {
*
* @var string
*/
- protected static $_routeClass = 'CakeRoute';
+ protected static $_routeClass = 'CakeRoute';
/**
* Set the default route class to use or return the current one
@@ -893,8 +893,9 @@ class Router {
list($args, $named) = array(Hash::filter($args), Hash::filter($named));
foreach (self::$_prefixes as $prefix) {
- if (!empty($url[$prefix])) {
- $url['action'] = str_replace($prefix . '_', '', $url['action']);
+ $prefixed = $prefix . '_';
+ if (!empty($url[$prefix]) && strpos($url['action'], $prefixed) === 0) {
+ $url['action'] = substr($url['action'], strlen($prefixed) * -1);
break;
}
}
@@ -956,12 +957,19 @@ class Router {
$out = '';
if (is_array($q)) {
- $q = array_merge($extra, $q);
+ $q = array_merge($q, $extra);
} else {
$out = $q;
$q = $extra;
}
- $out .= http_build_query($q, null, $join);
+ $addition = http_build_query($q, null, $join);
+
+ if ($out && $addition && substr($out, strlen($join) * -1, strlen($join)) != $join) {
+ $out .= $join;
+ }
+
+ $out .= $addition;
+
if (isset($out[0]) && $out[0] != '?') {
$out = '?' . $out;
}
diff --git a/lib/Cake/Test/Case/BasicsTest.php b/lib/Cake/Test/Case/BasicsTest.php
index e0280e0e9..cd00c1f43 100644
--- a/lib/Cake/Test/Case/BasicsTest.php
+++ b/lib/Cake/Test/Case/BasicsTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Cache/CacheTest.php b/lib/Cake/Test/Case/Cache/CacheTest.php
index 85e4ff62e..b4cb35820 100644
--- a/lib/Cake/Test/Case/Cache/CacheTest.php
+++ b/lib/Cake/Test/Case/Cache/CacheTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Cache
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php
index aa73ca6f3..d1e7605f3 100644
--- a/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php
+++ b/lib/Cake/Test/Case/Cache/Engine/ApcEngineTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Cache.Engine
* @since CakePHP(tm) v 1.2.0.5434
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
index b3fd48d5f..a091fbd6e 100644
--- a/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
+++ b/lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Cache.Engine
* @since CakePHP(tm) v 1.2.0.5434
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
index 47a7f0d21..a1c2abd5b 100644
--- a/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
+++ b/lib/Cake/Test/Case/Cache/Engine/MemcacheEngineTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Cache.Engine
* @since CakePHP(tm) v 1.2.0.5434
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php
index ace401147..12eed5357 100644
--- a/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php
+++ b/lib/Cake/Test/Case/Cache/Engine/WincacheEngineTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Cache.Engine
* @since CakePHP(tm) v 1.2.0.5434
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php b/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php
index 3f4911a8e..985977e79 100644
--- a/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php
+++ b/lib/Cake/Test/Case/Cache/Engine/XcacheEngineTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Cache.Engine
* @since CakePHP(tm) v 1.2.0.5434
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Configure/IniReaderTest.php b/lib/Cake/Test/Case/Configure/IniReaderTest.php
index 43ad3ce72..e4b463450 100644
--- a/lib/Cake/Test/Case/Configure/IniReaderTest.php
+++ b/lib/Cake/Test/Case/Configure/IniReaderTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Configure
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -21,11 +21,24 @@ App::uses('IniReader', 'Configure');
class IniReaderTest extends CakeTestCase {
/**
- * The test file that will be read.
+ * Test data to serialize and unserialize.
*
- * @var string
+ * @var array
*/
- public $file;
+ public $testData = array(
+ 'One' => array(
+ 'two' => 'value',
+ 'three' => array(
+ 'four' => 'value four'
+ ),
+ 'is_null' => null,
+ 'bool_false' => false,
+ 'bool_true' => true,
+ ),
+ 'Asset' => array(
+ 'timestamp' => 'force'
+ ),
+ );
/**
* setup
@@ -92,6 +105,8 @@ class IniReaderTest extends CakeTestCase {
$this->assertTrue(isset($config['database']['db']['username']));
$this->assertEquals('mark', $config['database']['db']['username']);
$this->assertEquals(3, $config['nesting']['one']['two']['three']);
+ $this->assertFalse(isset($config['database.db.username']));
+ $this->assertFalse(isset($config['database']['db.username']));
}
/**
@@ -125,4 +140,49 @@ class IniReaderTest extends CakeTestCase {
$config = $reader->read('nested');
$this->assertTrue($config['bools']['test_on']);
}
+
+/**
+ * test dump method.
+ *
+ * @return void
+ */
+ public function testDump() {
+ $reader = new IniReader(TMP);
+ $result = $reader->dump('test.ini', $this->testData);
+ $this->assertTrue($result > 0);
+
+ $expected = <<assertTextEquals($expected, $result);
+ }
+
+/**
+ * Test that dump() makes files read() can read.
+ *
+ * @return void
+ */
+ public function testDumpRead() {
+ $reader = new IniReader(TMP);
+ $reader->dump('test.ini', $this->testData);
+ $result = $reader->read('test.ini');
+ unlink(TMP . 'test.ini');
+
+ $expected = $this->testData;
+ $expected['One']['is_null'] = false;
+
+ $this->assertEquals($expected, $result);
+ }
+
}
diff --git a/lib/Cake/Test/Case/Configure/PhpReaderTest.php b/lib/Cake/Test/Case/Configure/PhpReaderTest.php
index ea34d8b3e..08982cb4e 100644
--- a/lib/Cake/Test/Case/Configure/PhpReaderTest.php
+++ b/lib/Cake/Test/Case/Configure/PhpReaderTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Configure
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -20,6 +20,26 @@ App::uses('PhpReader', 'Configure');
class PhpReaderTest extends CakeTestCase {
+/**
+ * Test data to serialize and unserialize.
+ *
+ * @var array
+ */
+ public $testData = array(
+ 'One' => array(
+ 'two' => 'value',
+ 'three' => array(
+ 'four' => 'value four'
+ ),
+ 'is_null' => null,
+ 'bool_false' => false,
+ 'bool_true' => true,
+ ),
+ 'Asset' => array(
+ 'timestamp' => 'force'
+ ),
+ );
+
/**
* setup
*
@@ -96,4 +116,55 @@ class PhpReaderTest extends CakeTestCase {
$this->assertTrue(isset($result['plugin_load']));
CakePlugin::unload();
}
+
+/**
+ * Test dumping data to PHP format.
+ *
+ * @return void
+ */
+ public function testDump() {
+ $reader = new PhpReader(TMP);
+ $result = $reader->dump('test.php', $this->testData);
+ $this->assertTrue($result > 0);
+ $expected = <<
+ array (
+ 'two' => 'value',
+ 'three' =>
+ array (
+ 'four' => 'value four',
+ ),
+ 'is_null' => NULL,
+ 'bool_false' => false,
+ 'bool_true' => true,
+ ),
+ 'Asset' =>
+ array (
+ 'timestamp' => 'force',
+ ),
+);
+PHP;
+ $file = TMP . 'test.php';
+ $contents = file_get_contents($file);
+
+ unlink($file);
+ $this->assertTextEquals($expected, $contents);
+ }
+
+/**
+ * Test that dump() makes files read() can read.
+ *
+ * @return void
+ */
+ public function testDumpRead() {
+ $reader = new PhpReader(TMP);
+ $reader->dump('test.php', $this->testData);
+ $result = $reader->read('test.php');
+ unlink(TMP . 'test.php');
+
+ $this->assertEquals($this->testData, $result);
+ }
+
}
diff --git a/lib/Cake/Test/Case/Console/AllConsoleLibsTest.php b/lib/Cake/Test/Case/Console/AllConsoleLibsTest.php
index 4d13c5df1..5a6846b9e 100644
--- a/lib/Cake/Test/Case/Console/AllConsoleLibsTest.php
+++ b/lib/Cake/Test/Case/Console/AllConsoleLibsTest.php
@@ -38,7 +38,10 @@ class AllConsoleLibsTest extends PHPUnit_Framework_TestSuite {
if (!$file->isFile() || strpos($file, 'All') === 0) {
continue;
}
- $suite->addTestFile($file->getRealPath());
+ $fileName = $file->getRealPath();
+ if (substr($fileName, -4) === '.php') {
+ $suite->addTestFile($file->getRealPath());
+ }
}
return $suite;
}
diff --git a/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
index ad4589360..d2df394bb 100644
--- a/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
+++ b/lib/Cake/Test/Case/Console/Command/Task/TemplateTaskTest.php
@@ -107,15 +107,15 @@ class TemplateTaskTest extends CakeTestCase {
$result = $this->Task->getThemePath();
$this->assertEquals($defaultTheme, $result);
- $this->Task->templatePaths = array('default' => $defaultTheme, 'other' => '/some/path');
+ $this->Task->templatePaths = array('other' => '/some/path', 'default' => $defaultTheme);
$this->Task->params['theme'] = 'other';
$result = $this->Task->getThemePath();
$this->assertEquals('/some/path', $result);
$this->Task->params = array();
$result = $this->Task->getThemePath();
- $this->assertEquals($defaultTheme, $result);
- $this->assertEquals('default', $this->Task->params['theme']);
+ $this->assertEquals('/some/path', $result);
+ $this->assertEquals('other', $this->Task->params['theme']);
}
/**
@@ -134,7 +134,7 @@ class TemplateTaskTest extends CakeTestCase {
$result = $this->Task->generate('classes', 'test_object', array('test' => 'foo'));
$expected = "I got rendered\nfoo";
- $this->assertEquals($expected, $result);
+ $this->assertTextEquals($expected, $result);
}
/**
diff --git a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
index 37f854b2e..bc5877a49 100644
--- a/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
+++ b/lib/Cake/Test/Case/Console/Command/Task/TestTaskTest.php
@@ -487,21 +487,83 @@ class TestTaskTest extends CakeTestCase {
$this->assertContains("'app.articles_tag'", $result);
}
+/**
+ * test baking component test files,
+ *
+ * @return void
+ */
+ public function testBakeComponentTest() {
+ $this->Task->expects($this->once())->method('createFile')->will($this->returnValue(true));
+
+ $result = $this->Task->bake('Component', 'Example');
+
+ $this->assertContains("App::uses('ExampleComponent', 'Controller/Component')", $result);
+ $this->assertContains('class ExampleComponentTest extends CakeTestCase', $result);
+
+ $this->assertContains('function setUp()', $result);
+ $this->assertContains("\$Collection = new ComponentCollection()", $result);
+ $this->assertContains("\$this->Example = new ExampleComponent(\$Collection)", $result);
+
+ $this->assertContains('function tearDown()', $result);
+ $this->assertContains('unset($this->Example)', $result);
+ }
+
+/**
+ * test baking behavior test files,
+ *
+ * @return void
+ */
+ public function testBakeBehaviorTest() {
+ $this->Task->expects($this->once())->method('createFile')->will($this->returnValue(true));
+
+ $result = $this->Task->bake('Behavior', 'Example');
+
+ $this->assertContains("App::uses('ExampleBehavior', 'Model/Behavior')", $result);
+ $this->assertContains('class ExampleBehaviorTest extends CakeTestCase', $result);
+
+ $this->assertContains('function setUp()', $result);
+ $this->assertContains("\$this->Example = new ExampleBehavior()", $result);
+
+ $this->assertContains('function tearDown()', $result);
+ $this->assertContains('unset($this->Example)', $result);
+ }
+
+/**
+ * test baking helper test files,
+ *
+ * @return void
+ */
+ public function testBakeHelperTest() {
+ $this->Task->expects($this->once())->method('createFile')->will($this->returnValue(true));
+
+ $result = $this->Task->bake('Helper', 'Example');
+
+ $this->assertContains("App::uses('ExampleHelper', 'View/Helper')", $result);
+ $this->assertContains('class ExampleHelperTest extends CakeTestCase', $result);
+
+ $this->assertContains('function setUp()', $result);
+ $this->assertContains("\$View = new View()", $result);
+ $this->assertContains("\$this->Example = new ExampleHelper(\$View)", $result);
+
+ $this->assertContains('function tearDown()', $result);
+ $this->assertContains('unset($this->Example)', $result);
+ }
+
/**
* test Constructor generation ensure that constructClasses is called for controllers
*
* @return void
*/
public function testGenerateConstructor() {
- $result = $this->Task->generateConstructor('controller', 'PostsController');
+ $result = $this->Task->generateConstructor('controller', 'PostsController', null);
$expected = array('', "new TestPostsController();\n", "\$this->Posts->constructClasses();\n");
$this->assertEquals($expected, $result);
- $result = $this->Task->generateConstructor('model', 'Post');
+ $result = $this->Task->generateConstructor('model', 'Post', null);
$expected = array('', "ClassRegistry::init('Post');\n", '');
$this->assertEquals($expected, $result);
- $result = $this->Task->generateConstructor('helper', 'FormHelper');
+ $result = $this->Task->generateConstructor('helper', 'FormHelper', null);
$expected = array("\$View = new View();\n", "new FormHelper(\$View);\n", '');
$this->assertEquals($expected, $result);
}
diff --git a/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php b/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
index ba2310c42..0677b09c4 100644
--- a/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
+++ b/lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Console/ConsoleOutputTest.php b/lib/Cake/Test/Case/Console/ConsoleOutputTest.php
index 6baef3dbd..a9cd0564c 100644
--- a/lib/Cake/Test/Case/Console/ConsoleOutputTest.php
+++ b/lib/Cake/Test/Case/Console/ConsoleOutputTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Console
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Console/HelpFormatterTest.php b/lib/Cake/Test/Case/Console/HelpFormatterTest.php
index 71fd6c468..7af5c1e83 100644
--- a/lib/Cake/Test/Case/Console/HelpFormatterTest.php
+++ b/lib/Cake/Test/Case/Console/HelpFormatterTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Console/ShellDispatcherTest.php b/lib/Cake/Test/Case/Console/ShellDispatcherTest.php
index 1b3adfabd..f7705c47a 100644
--- a/lib/Cake/Test/Case/Console/ShellDispatcherTest.php
+++ b/lib/Cake/Test/Case/Console/ShellDispatcherTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Console
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -437,7 +437,7 @@ class ShellDispatcherTest extends CakeTestCase {
*/
public function testDispatchShellWithMain() {
$Dispatcher = new TestShellDispatcher();
- $Mock = $this->getMock('Shell', array(), array(&$Dispatcher), 'MockWithMainShell');
+ $Mock = $this->getMock('Shell', array(), array(), 'MockWithMainShell');
$Mock->expects($this->once())->method('initialize');
$Mock->expects($this->once())->method('loadTasks');
@@ -460,9 +460,9 @@ class ShellDispatcherTest extends CakeTestCase {
*/
public function testDispatchShellWithoutMain() {
$Dispatcher = new TestShellDispatcher();
- $Shell = $this->getMock('Shell', array(), array(&$Dispatcher), 'MockWithoutMainShell');
+ $Shell = $this->getMock('Shell', array(), array(), 'MockWithoutMainShell');
- $Shell = new MockWithoutMainShell($Dispatcher);
+ $Shell = new MockWithoutMainShell();
$this->mockObjects[] = $Shell;
$Shell->expects($this->once())->method('initialize');
diff --git a/lib/Cake/Test/Case/Console/TaskCollectionTest.php b/lib/Cake/Test/Case/Console/TaskCollectionTest.php
index a681b490b..9317e7711 100644
--- a/lib/Cake/Test/Case/Console/TaskCollectionTest.php
+++ b/lib/Cake/Test/Case/Console/TaskCollectionTest.php
@@ -11,7 +11,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
index 4e0ca4171..44fd6e318 100644
--- a/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/Acl/DbAclTest.php
@@ -349,14 +349,14 @@ class DbAclTest extends CakeTestCase {
* @return void
*/
public function testCheckMissingPermission() {
- $this->Acl->check('users', 'NonExistant', 'read');
+ $this->Acl->check('users', 'NonExistent', 'read');
}
/**
* testDbAclCascadingDeny function
*
* Setup the acl permissions such that Bobs inherits from admin.
- * deny Admin delete access to a specific resource, check the permisssions are inherited.
+ * deny Admin delete access to a specific resource, check the permissions are inherited.
*
* @return void
*/
@@ -483,7 +483,7 @@ class DbAclTest extends CakeTestCase {
/**
* debug function - to help editing/creating test cases for the ACL component
*
- * To check the overal ACL status at any time call $this->__debug();
+ * To check the overall ACL status at any time call $this->__debug();
* Generates a list of the current aro and aco structures and a grid dump of the permissions that are defined
* Only designed to work with the db based ACL
*
diff --git a/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php
index 7261a8222..b16d7af71 100644
--- a/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/AclComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5435
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
index e2d1fcb84..7fa504de0 100644
--- a/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/AuthComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5347
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
index 87c5bd7d6..80065a7f4 100644
--- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5435
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
index 80abc7fb0..4e8183315 100644
--- a/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5347
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
index 1811a4c3b..2da48c869 100644
--- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
index 69931710c..fb6c431e6 100644
--- a/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/RequestHandlerComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5435
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
index c97626df5..364bcb039 100644
--- a/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/SecurityComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5435
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php
index ffcf78a05..0920186c5 100644
--- a/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/Component/SessionComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller.Component
* @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php b/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
index 87cc1d833..11f5e6acd 100644
--- a/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
+++ b/lib/Cake/Test/Case/Controller/ComponentCollectionTest.php
@@ -11,7 +11,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/ComponentTest.php b/lib/Cake/Test/Case/Controller/ComponentTest.php
index 3504013fe..499fe4ac2 100644
--- a/lib/Cake/Test/Case/Controller/ComponentTest.php
+++ b/lib/Cake/Test/Case/Controller/ComponentTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller
* @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php b/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php
index df96b2bee..93a5cecac 100644
--- a/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php
+++ b/lib/Cake/Test/Case/Controller/ControllerMergeVarsTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller
* @since CakePHP(tm) v 1.2.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php
index 83b791ccb..33bc9678b 100644
--- a/lib/Cake/Test/Case/Controller/ControllerTest.php
+++ b/lib/Cake/Test/Case/Controller/ControllerTest.php
@@ -728,7 +728,8 @@ class ControllerTest extends CakeTestCase {
array(303, "See Other"),
array(304, "Not Modified"),
array(305, "Use Proxy"),
- array(307, "Temporary Redirect")
+ array(307, "Temporary Redirect"),
+ array(403, "Forbidden"),
);
}
diff --git a/lib/Cake/Test/Case/Controller/PagesControllerTest.php b/lib/Cake/Test/Case/Controller/PagesControllerTest.php
index 829a940d9..614edea91 100644
--- a/lib/Cake/Test/Case/Controller/PagesControllerTest.php
+++ b/lib/Cake/Test/Case/Controller/PagesControllerTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller
* @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Controller/ScaffoldTest.php b/lib/Cake/Test/Case/Controller/ScaffoldTest.php
index cd5ac89cb..14fe18264 100644
--- a/lib/Cake/Test/Case/Controller/ScaffoldTest.php
+++ b/lib/Cake/Test/Case/Controller/ScaffoldTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller
* @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Core/ConfigureTest.php b/lib/Cake/Test/Case/Core/ConfigureTest.php
index 2d222b311..7351f83f1 100644
--- a/lib/Cake/Test/Case/Core/ConfigureTest.php
+++ b/lib/Cake/Test/Case/Core/ConfigureTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Core
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -362,4 +362,47 @@ class ConfigureTest extends CakeTestCase {
$this->assertNull(Configure::read('debug'));
$this->assertNull(Configure::read('test'));
}
+
+/**
+ * @expectedException ConfigureException
+ */
+ public function testDumpNoAdapter() {
+ Configure::dump(TMP . 'test.php', 'does_not_exist');
+ }
+
+/**
+ * test dump integrated with the PhpReader.
+ *
+ * @return void
+ */
+ public function testDump() {
+ Configure::config('test_reader', new PhpReader(TMP));
+
+ $result = Configure::dump('config_test.php', 'test_reader');
+ $this->assertTrue($result > 0);
+ $result = file_get_contents(TMP . 'config_test.php');
+ $this->assertContains('assertContains('$config = ', $result);
+ @unlink(TMP . 'config_test.php');
+ }
+
+/**
+ * Test dumping only some of the data.
+ *
+ * @return
+ */
+ public function testDumpPartial() {
+ Configure::config('test_reader', new PhpReader(TMP));
+
+ $result = Configure::dump('config_test.php', 'test_reader', array('Error'));
+ $this->assertTrue($result > 0);
+ $result = file_get_contents(TMP . 'config_test.php');
+ $this->assertContains('assertContains('$config = ', $result);
+ $this->assertContains('Error', $result);
+ $this->assertNotContains('debug', $result);
+
+ @unlink(TMP . 'config_test.php');
+ }
+
}
diff --git a/lib/Cake/Test/Case/Core/ObjectTest.php b/lib/Cake/Test/Case/Core/ObjectTest.php
index e2e5d8cc2..222a231a7 100644
--- a/lib/Cake/Test/Case/Core/ObjectTest.php
+++ b/lib/Cake/Test/Case/Core/ObjectTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Core
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Error/ErrorHandlerTest.php b/lib/Cake/Test/Case/Error/ErrorHandlerTest.php
index 96c62d72b..9b4500e6d 100644
--- a/lib/Cake/Test/Case/Error/ErrorHandlerTest.php
+++ b/lib/Cake/Test/Case/Error/ErrorHandlerTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Error
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
index 103b33322..4e236aefe 100644
--- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
+++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Error
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -639,7 +639,7 @@ class ExceptionRendererTest extends CakeTestCase {
->with('missingHelper')
->will($this->throwException($exception));
- $ExceptionRenderer->controller->expects($this->at(4))
+ $ExceptionRenderer->controller->expects($this->at(5))
->method('render')
->with('error500')
->will($this->returnValue(true));
@@ -671,7 +671,7 @@ class ExceptionRendererTest extends CakeTestCase {
->with('error400')
->will($this->throwException($exception));
- $ExceptionRenderer->controller->expects($this->at(3))
+ $ExceptionRenderer->controller->expects($this->at(4))
->method('render')
->with('error500')
->will($this->returnValue(true));
diff --git a/lib/Cake/Test/Case/I18n/I18nTest.php b/lib/Cake/Test/Case/I18n/I18nTest.php
index 3f6dff13d..e86628bb4 100644
--- a/lib/Cake/Test/Case/I18n/I18nTest.php
+++ b/lib/Cake/Test/Case/I18n/I18nTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.I18n
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/I18n/L10nTest.php b/lib/Cake/Test/Case/I18n/L10nTest.php
index c79ee2831..d52c3a60d 100644
--- a/lib/Cake/Test/Case/I18n/L10nTest.php
+++ b/lib/Cake/Test/Case/I18n/L10nTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.I18n
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/I18n/MultibyteTest.php b/lib/Cake/Test/Case/I18n/MultibyteTest.php
index d2bbe1664..927b84405 100644
--- a/lib/Cake/Test/Case/I18n/MultibyteTest.php
+++ b/lib/Cake/Test/Case/I18n/MultibyteTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.I18n
* @since CakePHP(tm) v 1.2.0.6833
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Log/CakeLogTest.php b/lib/Cake/Test/Case/Log/CakeLogTest.php
index 89e3e3e86..a24731a01 100644
--- a/lib/Cake/Test/Case/Log/CakeLogTest.php
+++ b/lib/Cake/Test/Case/Log/CakeLogTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Log
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Log/Engine/FileLogTest.php b/lib/Cake/Test/Case/Log/Engine/FileLogTest.php
index 2dc3153bf..b4c13c8a8 100644
--- a/lib/Cake/Test/Case/Log/Engine/FileLogTest.php
+++ b/lib/Cake/Test/Case/Log/Engine/FileLogTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Log.Engine
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/AclNodeTest.php b/lib/Cake/Test/Case/Model/AclNodeTest.php
index 605e9a0c5..4e0fb4263 100644
--- a/lib/Cake/Test/Case/Model/AclNodeTest.php
+++ b/lib/Cake/Test/Case/Model/AclNodeTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
index 360094fa8..8345c87d6 100644
--- a/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/ContainableBehaviorTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Behavior
* @since CakePHP(tm) v 1.2.0.5669
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
index d280f7fac..b4a8c4fa5 100644
--- a/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
@@ -4,21 +4,18 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Behavior
* @since CakePHP(tm) v 1.2.0.5669
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
- define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
-}
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
@@ -110,7 +107,11 @@ class TranslateBehaviorTest extends CakeTestCase {
$TestModel->locale = false;
$result = $TestModel->read(null, 1);
- $expected = array('TranslatedItem' => array('id' => 1, 'slug' => 'first_translated'));
+ $expected = array('TranslatedItem' => array(
+ 'id' => 1,
+ 'slug' => 'first_translated',
+ 'translated_article_id' => 1,
+ ));
$this->assertEquals($expected, $result);
$result = $TestModel->find('all', array('fields' => array('slug')));
@@ -138,7 +139,7 @@ class TranslateBehaviorTest extends CakeTestCase {
$result = $TestModel->read(null, 1);
$expected = array(
- 'TranslatedItem' => array('id' => 1, 'slug' => 'first_translated'),
+ 'TranslatedItem' => array('id' => 1, 'slug' => 'first_translated', 'translated_article_id' => 1),
'Title' => array(
array('id' => 1, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Title #1'),
array('id' => 3, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Titel #1'),
@@ -194,7 +195,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Title #1',
- 'content' => 'Content #1'
+ 'content' => 'Content #1',
+ 'translated_article_id' => 1,
)
);
$this->assertEquals($expected, $result);
@@ -207,7 +209,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Title #1',
- 'content' => 'Content #1'
+ 'content' => 'Content #1',
+ 'translated_article_id' => 1,
)
),
array(
@@ -216,7 +219,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'second_translated',
'locale' => 'eng',
'title' => 'Title #2',
- 'content' => 'Content #2'
+ 'content' => 'Content #2',
+ 'translated_article_id' => 1,
)
),
array(
@@ -225,7 +229,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'third_translated',
'locale' => 'eng',
'title' => 'Title #3',
- 'content' => 'Content #3'
+ 'content' => 'Content #3',
+ 'translated_article_id' => 1,
)
)
);
@@ -250,7 +255,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Title #1',
- 'content' => 'Content #1'
+ 'content' => 'Content #1',
+ 'translated_article_id' => 1,
)
)
);
@@ -264,7 +270,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Title #1',
- 'content' => 'Content #1'
+ 'content' => 'Content #1',
+ 'translated_article_id' => 1,
)
)
);
@@ -292,7 +299,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Title #1',
- 'content' => 'Content #1'
+ 'content' => 'Content #1',
+ 'translated_article_id' => 1,
),
'Title' => array(
array('id' => 1, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Title #1'),
@@ -313,17 +321,35 @@ class TranslateBehaviorTest extends CakeTestCase {
$result = $TestModel->find('all', array('fields' => array('TranslatedItem.title')));
$expected = array(
array(
- 'TranslatedItem' => array('id' => 1, 'locale' => 'eng', 'title' => 'Title #1', 'slug' => 'first_translated'),
+ 'TranslatedItem' => array(
+ 'id' => 1,
+ 'locale' => 'eng',
+ 'title' => 'Title #1',
+ 'slug' => 'first_translated',
+ 'translated_article_id' => 1,
+ ),
'Title' => array(array('foreign_key' => 1, 'content' => 'Title #1')),
'Content' => array(array('foreign_key' => 1, 'content' => 'Content #1'))
),
array(
- 'TranslatedItem' => array('id' => 2, 'locale' => 'eng', 'title' => 'Title #2', 'slug' => 'second_translated'),
+ 'TranslatedItem' => array(
+ 'id' => 2,
+ 'locale' => 'eng',
+ 'title' => 'Title #2',
+ 'slug' => 'second_translated',
+ 'translated_article_id' => 1,
+ ),
'Title' => array(array('foreign_key' => 2, 'content' => 'Title #2')),
'Content' => array(array('foreign_key' => 2, 'content' => 'Content #2'))
),
array(
- 'TranslatedItem' => array('id' => 3, 'locale' => 'eng', 'title' => 'Title #3','slug' => 'third_translated'),
+ 'TranslatedItem' => array(
+ 'id' => 3,
+ 'locale' => 'eng',
+ 'title' => 'Title #3',
+ 'slug' => 'third_translated',
+ 'translated_article_id' => 1,
+ ),
'Title' => array(array('foreign_key' => 3, 'content' => 'Title #3')),
'Content' => array(array('foreign_key' => 3, 'content' => 'Content #3'))
)
@@ -349,7 +375,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'deu',
'title' => 'Titel #1',
- 'content' => 'Inhalt #1'
+ 'content' => 'Inhalt #1',
+ 'translated_article_id' => 1,
)
);
$this->assertEquals($expected, $result);
@@ -361,7 +388,7 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'deu',
'content' => 'Inhalt #1',
- 'title' => 'Titel #1'
+ 'title' => 'Titel #1',
)
),
array(
@@ -369,7 +396,7 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'second_translated',
'locale' => 'deu',
'title' => 'Titel #2',
- 'content' => 'Inhalt #2'
+ 'content' => 'Inhalt #2',
)
),
array(
@@ -377,7 +404,7 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'third_translated',
'locale' => 'deu',
'title' => 'Titel #3',
- 'content' => 'Inhalt #3'
+ 'content' => 'Inhalt #3',
)
)
);
@@ -406,7 +433,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'rus',
'title' => '',
- 'content' => ''
+ 'content' => '',
+ 'translated_article_id' => 1,
)
);
$this->assertEquals($expected, $result);
@@ -490,7 +518,12 @@ class TranslateBehaviorTest extends CakeTestCase {
$TestModel = new TranslatedItem();
$TestModel->locale = 'spa';
- $data = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4', 'content' => 'Contenido #4');
+ $data = array(
+ 'slug' => 'fourth_translated',
+ 'title' => 'Leyenda #4',
+ 'content' => 'Contenido #4',
+ 'translated_article_id' => 1,
+ );
$TestModel->create($data);
$TestModel->save();
$result = $TestModel->read();
@@ -508,7 +541,7 @@ class TranslateBehaviorTest extends CakeTestCase {
$TestModel = new TranslatedItem();
$TestModel->locale = 'spa';
- $oldData = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4');
+ $oldData = array('slug' => 'fourth_translated', 'title' => 'Leyenda #4', 'translated_article_id' => 1);
$TestModel->create($oldData);
$TestModel->save();
$id = $TestModel->id;
@@ -545,7 +578,14 @@ class TranslateBehaviorTest extends CakeTestCase {
$result = $TestModel->read();
$expected = array(
- 'TranslatedItem' => array('id' => 4, 'slug' => 'new_translated', 'locale' => 'eng', 'title' => 'New title', 'content' => 'New content'),
+ 'TranslatedItem' => array(
+ 'id' => 4,
+ 'slug' => 'new_translated',
+ 'locale' => 'eng',
+ 'title' => 'New title',
+ 'content' => 'New content',
+ 'translated_article_id' => null,
+ ),
'Title' => array(
array('id' => 21, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 4, 'field' => 'title', 'content' => 'New title'),
array('id' => 22, 'locale' => 'spa', 'model' => 'TranslatedItem', 'foreign_key' => 4, 'field' => 'title', 'content' => 'Nuevo leyenda')
@@ -582,7 +622,14 @@ class TranslateBehaviorTest extends CakeTestCase {
$TestModel->bindTranslation($translations, false);
$result = $TestModel->read(null, 1);
$expected = array(
- 'TranslatedItem' => array('id' => '1', 'slug' => 'first_translated', 'locale' => 'eng', 'title' => 'New Title #1', 'content' => 'New Content #1'),
+ 'TranslatedItem' => array(
+ 'id' => '1',
+ 'slug' => 'first_translated',
+ 'locale' => 'eng',
+ 'title' => 'New Title #1',
+ 'content' => 'New Content #1',
+ 'translated_article_id' => 1,
+ ),
'Title' => array(
array('id' => 1, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'New Title #1'),
array('id' => 3, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Neue Titel #1'),
@@ -625,7 +672,14 @@ class TranslateBehaviorTest extends CakeTestCase {
$result['Title'] = Hash::sort($result['Title'], '{n}.id', 'asc');
$result['Content'] = Hash::sort($result['Content'], '{n}.id', 'asc');
$expected = array(
- 'TranslatedItem' => array('id' => 1, 'slug' => 'first_translated', 'locale' => 'cze', 'title' => 'Titulek #1', 'content' => 'Upraveny obsah #1'),
+ 'TranslatedItem' => array(
+ 'id' => 1,
+ 'slug' => 'first_translated',
+ 'locale' => 'cze',
+ 'title' => 'Titulek #1',
+ 'content' => 'Upraveny obsah #1',
+ 'translated_article_id' => 1,
+ ),
'Title' => array(
array('id' => 1, 'locale' => 'eng', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Updated Title #1'),
array('id' => 3, 'locale' => 'deu', 'model' => 'TranslatedItem', 'foreign_key' => 1, 'field' => 'title', 'content' => 'Titel #1'),
@@ -641,6 +695,49 @@ class TranslateBehaviorTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
+/**
+ * Test that saveAll() works with hasMany associations that contain
+ * translations.
+ *
+ * @return void
+ */
+ public function testSaveAllTranslatedAssociations() {
+ $this->loadFixtures('Translate', 'TranslateArticle', 'TranslatedItem', 'TranslatedArticle', 'User');
+ $Model = new TranslatedArticle();
+ $Model->locale = 'eng';
+
+ $data = array(
+ 'TranslatedArticle' => array(
+ 'id' => 4,
+ 'user_id' => 1,
+ 'published' => 'Y',
+ 'title' => 'Title (eng) #1',
+ 'body' => 'Body (eng) #1'
+ ),
+ 'TranslatedItem' => array(
+ array(
+ 'slug' => '',
+ 'title' => 'Nuevo leyenda #1',
+ 'content' => 'Upraveny obsah #1'
+ ),
+ array(
+ 'slug' => '',
+ 'title' => 'New Title #2',
+ 'content' => 'New Content #2'
+ ),
+ )
+ );
+ $result = $Model->saveAll($data);
+ $this->assertTrue($result);
+
+ $result = $Model->TranslatedItem->find('all', array(
+ 'conditions' => array('translated_article_id' => $Model->id)
+ ));
+ $this->assertCount(2, $result);
+ $this->assertEquals($data['TranslatedItem'][0]['title'], $result[0]['TranslatedItem']['title']);
+ $this->assertEquals($data['TranslatedItem'][1]['title'], $result[1]['TranslatedItem']['title']);
+ }
+
/**
* testValidation method
*
@@ -652,11 +749,13 @@ class TranslateBehaviorTest extends CakeTestCase {
$TestModel = new TranslatedItem();
$TestModel->locale = 'eng';
$TestModel->validate['title'] = '/Only this title/';
- $data = array('TranslatedItem' => array(
- 'id' => 1,
- 'title' => array('eng' => 'New Title #1', 'deu' => 'Neue Titel #1', 'cze' => 'Novy Titulek #1'),
- 'content' => array('eng' => 'New Content #1', 'deu' => 'Neue Inhalt #1', 'cze' => 'Novy Obsah #1')
- ));
+ $data = array(
+ 'TranslatedItem' => array(
+ 'id' => 1,
+ 'title' => array('eng' => 'New Title #1', 'deu' => 'Neue Titel #1', 'cze' => 'Novy Titulek #1'),
+ 'content' => array('eng' => 'New Content #1', 'deu' => 'Neue Inhalt #1', 'cze' => 'Novy Obsah #1')
+ )
+ );
$TestModel->create();
$this->assertFalse($TestModel->save($data));
$this->assertEquals(array('This field cannot be left blank'), $TestModel->validationErrors['title']);
@@ -739,7 +838,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'title' => 'Another Title #1',
- 'content' => 'Another Content #1'
+ 'content' => 'Another Content #1',
+ 'translated_article_id' => 1,
)
);
$this->assertEquals($expected, $result);
@@ -751,7 +851,7 @@ class TranslateBehaviorTest extends CakeTestCase {
* @return void
*/
public function testTranslateWithAssociations() {
- $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'User', 'Comment', 'ArticlesTag', 'Tag');
+ $this->loadFixtures('TranslateArticle', 'TranslatedArticle', 'TranslatedItem', 'User', 'Comment', 'ArticlesTag', 'Tag');
$TestModel = new TranslatedArticle();
$TestModel->locale = 'eng';
@@ -775,6 +875,23 @@ class TranslateBehaviorTest extends CakeTestCase {
'password' => '5f4dcc3b5aa765d61d8327deb882cf99',
'created' => '2007-03-17 01:16:23',
'updated' => '2007-03-17 01:18:31'
+ ),
+ 'TranslatedItem' => array(
+ array(
+ 'id' => 1,
+ 'translated_article_id' => 1,
+ 'slug' => 'first_translated'
+ ),
+ array(
+ 'id' => 2,
+ 'translated_article_id' => 1,
+ 'slug' => 'second_translated'
+ ),
+ array(
+ 'id' => 3,
+ 'translated_article_id' => 1,
+ 'slug' => 'third_translated'
+ ),
)
);
$this->assertEquals($expected, $result);
@@ -854,7 +971,8 @@ class TranslateBehaviorTest extends CakeTestCase {
'slug' => 'first_translated',
'locale' => 'eng',
'content' => 'Content #1',
- 'title' => 'Title #1'
+ 'title' => 'Title #1',
+ 'translated_article_id' => 1,
));
$this->assertEquals($expected, $result);
}
diff --git a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorAfterTest.php b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorAfterTest.php
index 86077a92c..4e8ae4c85 100644
--- a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorAfterTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorAfterTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Behavior
* @since CakePHP(tm) v 1.2.0.5330
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
index ab78edf9e..17552f40d 100644
--- a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorNumberTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Behavior
* @since CakePHP(tm) v 1.2.0.5330
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php
index bb0d1704a..b9e829758 100644
--- a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Behavior
* @since CakePHP(tm) v 1.2.0.5330
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorUuidTest.php b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorUuidTest.php
index 64d5c61cf..a69445ef9 100644
--- a/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorUuidTest.php
+++ b/lib/Cake/Test/Case/Model/Behavior/TreeBehaviorUuidTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Behavior
* @since CakePHP(tm) v 1.2.0.5330
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/CakeSchemaTest.php b/lib/Cake/Test/Case/Model/CakeSchemaTest.php
index a6a640417..07265f5c5 100644
--- a/lib/Cake/Test/Case/Model/CakeSchemaTest.php
+++ b/lib/Cake/Test/Case/Model/CakeSchemaTest.php
@@ -5,14 +5,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.5550
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php
index 3bb1bc0c3..a35d06b20 100644
--- a/lib/Cake/Test/Case/Model/ConnectionManagerTest.php
+++ b/lib/Cake/Test/Case/Model/ConnectionManagerTest.php
@@ -10,7 +10,7 @@
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.5550
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
index b31539fe3..70a180235 100644
--- a/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Datasource
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Datasource/DataSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DataSourceTest.php
index b347e0032..3bb9bd0d7 100644
--- a/lib/Cake/Test/Case/Model/Datasource/DataSourceTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/DataSourceTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Datasource
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
index e0d4a1b93..7e8defc37 100644
--- a/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
@@ -3586,10 +3586,10 @@ class MysqlTest extends CakeTestCase {
* @return void
*/
public function testNestedTransaction() {
- $nested = $this->Dbo->nestedTransaction;
- $this->Dbo->nestedTransaction = true;
- if ($this->Dbo->supportNestedTransaction() === false) {
- $this->Dbo->nestedTransaction = $nested;
+ $nested = $this->Dbo->useNestedTransactions;
+ $this->Dbo->useNestedTransactions = true;
+ if ($this->Dbo->nestedTransactionSupported() === false) {
+ $this->Dbo->useNestedTransactions = $nested;
$this->skipIf(true, 'The MySQL server do not support nested transaction');
}
@@ -3617,7 +3617,7 @@ class MysqlTest extends CakeTestCase {
$this->assertTrue($this->Dbo->rollback());
$this->assertNotEmpty($model->read(null, 1));
- $this->Dbo->nestedTransaction = $nested;
+ $this->Dbo->useNestedTransactions = $nested;
}
}
diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
index eb249e4d3..e7612614f 100644
--- a/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
@@ -915,7 +915,7 @@ class PostgresTest extends CakeTestCase {
* @return void
*/
public function testNestedTransaction() {
- $this->skipIf($this->Dbo->supportNestedTransaction() === false, 'The Postgres server do not support nested transaction');
+ $this->skipIf($this->Dbo->nestedTransactionSupported() === false, 'The Postgres server do not support nested transaction');
$this->loadFixtures('Article');
$model = new Article();
diff --git a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
index a5a82cae1..f590cc7a0 100644
--- a/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/Database/SqliteTest.php
@@ -389,7 +389,7 @@ class SqliteTest extends CakeTestCase {
* @return void
*/
public function testNestedTransaction() {
- $this->skipIf($this->Dbo->supportNestedTransaction() === false, 'The Sqlite version do not support nested transaction');
+ $this->skipIf($this->Dbo->nestedTransactionSupported() === false, 'The Sqlite version do not support nested transaction');
$this->loadFixtures('User');
$model = new User();
diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
index 16952bb57..c74f037df 100644
--- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model.Datasource
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -53,8 +53,8 @@ class DboTestSource extends DboSource {
$this->_connection = $conn;
}
- public function supportNestedTransaction() {
- return $this->nestedTransaction && $this->nestedSupport;
+ public function nestedTransactionSupported() {
+ return $this->useNestedTransactions && $this->nestedSupport;
}
}
@@ -849,7 +849,7 @@ class DboSourceTest extends CakeTestCase {
$conn = $this->getMock('MockPDO');
$db = new DboTestSource();
$db->setConnection($conn);
- $db->nestedTransaction = true;
+ $db->useNestedTransactions = true;
$db->nestedSupport = true;
$conn->expects($this->at(0))->method('beginTransaction')->will($this->returnValue(true));
@@ -871,7 +871,7 @@ class DboSourceTest extends CakeTestCase {
$conn = $this->getMock('MockPDO');
$db = new DboTestSource();
$db->setConnection($conn);
- $db->nestedTransaction = true;
+ $db->useNestedTransactions = true;
$db->nestedSupport = false;
$conn->expects($this->once())->method('beginTransaction')->will($this->returnValue(true));
@@ -890,7 +890,7 @@ class DboSourceTest extends CakeTestCase {
$conn = $this->getMock('MockPDO');
$db = new DboTestSource();
$db->setConnection($conn);
- $db->nestedTransaction = false;
+ $db->useNestedTransactions = false;
$db->nestedSupport = true;
$conn->expects($this->once())->method('beginTransaction')->will($this->returnValue(true));
diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php
index 5fa971230..d696d7cd8 100644
--- a/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/Session/CacheSessionTest.php
@@ -4,7 +4,7 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
diff --git a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
index b52dabe80..3276ae864 100644
--- a/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
+++ b/lib/Cake/Test/Case/Model/Datasource/Session/DatabaseSessionTest.php
@@ -4,7 +4,7 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
diff --git a/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php b/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php
index 0bf7ecd06..57f1bc3de 100644
--- a/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php
+++ b/lib/Cake/Test/Case/Model/ModelCrossSchemaHabtmTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 2.1
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/ModelDeleteTest.php b/lib/Cake/Test/Case/Model/ModelDeleteTest.php
index 37e7c8695..329eef387 100644
--- a/lib/Cake/Test/Case/Model/ModelDeleteTest.php
+++ b/lib/Cake/Test/Case/Model/ModelDeleteTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php
index f574821a6..a7063c0fd 100644
--- a/lib/Cake/Test/Case/Model/ModelIntegrationTest.php
+++ b/lib/Cake/Test/Case/Model/ModelIntegrationTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/ModelReadTest.php b/lib/Cake/Test/Case/Model/ModelReadTest.php
index 6d1ebf12a..5c9bf482e 100644
--- a/lib/Cake/Test/Case/Model/ModelReadTest.php
+++ b/lib/Cake/Test/Case/Model/ModelReadTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/ModelTestBase.php b/lib/Cake/Test/Case/Model/ModelTestBase.php
index 8e563c209..80be40954 100644
--- a/lib/Cake/Test/Case/Model/ModelTestBase.php
+++ b/lib/Cake/Test/Case/Model/ModelTestBase.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Model/ModelValidationTest.php b/lib/Cake/Test/Case/Model/ModelValidationTest.php
index 2fe7780f8..021efff8e 100644
--- a/lib/Cake/Test/Case/Model/ModelValidationTest.php
+++ b/lib/Cake/Test/Case/Model/ModelValidationTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -316,12 +316,16 @@ class ModelValidationTest extends BaseModelTest {
$data = array('TestValidate' => array('modified' => ''));
$result = $TestModel->create($data);
$this->assertEquals($data, $result);
+ $result = $TestModel->validates();
+ $this->assertFalse($result);
$data = array('TestValidate' => array(
'modified' => '2007-05-01'
));
$result = $TestModel->create($data);
$this->assertEquals($data, $result);
+ $result = $TestModel->validates();
+ $this->assertTrue($result);
$TestModel->validate['slug'] = array('allowEmpty' => false, 'rule' => array('maxLength', 45));
@@ -1895,4 +1899,84 @@ class ModelValidationTest extends BaseModelTest {
$TestModel->validates();
}
+/**
+ * Tests that altering data in a beforeValidate callback will lead to saving those
+ * values in database
+ *
+ * @return void
+ */
+ public function testValidateFirstWithBeforeValidate() {
+ $this->loadFixtures('Article', 'User');
+ $model = new CustomArticle();
+ $model->validate = array(
+ 'title' => array(
+ 'notempty' => array(
+ 'rule' => 'notEmpty',
+ 'required' => true,
+ 'allowEmpty' => false
+ )
+ )
+ );
+ $data = array(
+ 'CustomArticle' => array(
+ 'body' => 'foo0'
+ )
+ );
+ $result = $model->saveAll($data, array('validate' => 'first'));
+ $this->assertTrue($result);
+
+ $title = $model->field('title', array('body' => 'foo0'));
+ $this->assertEquals('foo', $title);
+
+ $data = array(
+ array('body' => 'foo1'),
+ array('body' => 'foo2'),
+ array('body' => 'foo3')
+ );
+
+ $result = $model->saveAll($data, array('validate' => 'first'));
+ $this->assertTrue($result);
+
+ $this->assertEquals('foo', $model->field('title', array('body' => 'foo1')));
+ $this->assertEquals('foo', $model->field('title', array('body' => 'foo2')));
+ $this->assertEquals('foo', $model->field('title', array('body' => 'foo3')));
+ }
+
+/**
+ * Tests that altering data in a beforeValidate callback will lead to saving those
+ * values in database
+ *
+ * @return void
+ */
+ public function testValidateAssociatedWithBeforeValidate() {
+ $this->loadFixtures('Article', 'User');
+ $model = new CustomArticle();
+ $model->validate = array(
+ 'title' => array(
+ 'notempty' => array(
+ 'rule' => 'notEmpty',
+ 'required' => true
+ )
+ )
+ );
+ $articles = array(
+ array('body' => 'foo1'),
+ array('body' => 'foo2'),
+ array('body' => 'foo3')
+ );
+ $user = new User();
+ $user->hasMany['CustomArticle'] = array('foreignKey' => 'user_id');
+ $data = array(
+ 'User' => array('user' => 'foo', 'password' => 'bar'),
+ 'CustomArticle' => $articles
+ );
+ $result = $user->saveAll($data, array('validate' => 'first'));
+ $this->assertTrue($result);
+
+ $this->assertEquals('foo', $model->field('title', array('body' => 'foo1')));
+ $this->assertEquals('foo', $model->field('title', array('body' => 'foo2')));
+ $this->assertEquals('foo', $model->field('title', array('body' => 'foo3')));
+ }
+
+
}
diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php
index 6caed12d0..a49f8d887 100644
--- a/lib/Cake/Test/Case/Model/ModelWriteTest.php
+++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -3244,6 +3244,281 @@ class ModelWriteTest extends BaseModelTest {
$result = $TestModel->saveAll($data, array('deep' => true));
$this->assertTrue($result);
}
+/**
+ * testSaveAllDeepValidateOnly
+ * tests the validate methods with deeper recursive data
+ *
+ * @return void
+ */
+ public function testSaveAllDeepValidateOnly() {
+ $this->loadFixtures('Article', 'Comment', 'User', 'Attachment');
+ $TestModel = new Article();
+ $TestModel->hasMany['Comment']['order'] = array('Comment.created' => 'ASC');
+ $TestModel->hasAndBelongsToMany = array();
+ $TestModel->Comment->Attachment->validate['attachment'] = 'notEmpty';
+ $TestModel->Comment->validate['comment'] = 'notEmpty';
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => 'newuser', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'deep' => true)
+ );
+ $this->assertTrue($result);
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => '', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'deep' => true)
+ );
+ $this->assertFalse($result);
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => 'newuser', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'atomic' => false, 'deep' => true)
+ );
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(
+ true,
+ true
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => '', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'atomic' => false, 'deep' => true)
+ );
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(
+ false,
+ true
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->saveAll(array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'Third new comment', 'published' => 'Y', 'user_id' => 5),
+ array('comment' => 'Fourth new comment', 'published' => 'Y', 'user_id' => 2, 'Attachment' => array('attachment' => 'deepsaved'))
+ )
+ ),
+ array('validate' => 'only', 'deep' => true)
+ );
+ $this->assertTrue($result);
+
+ $result = $TestModel->saveAll(array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'Third new comment', 'published' => 'Y', 'user_id' => 5),
+ array('comment' => 'Fourth new comment', 'published' => 'Y', 'user_id' => 2, 'Attachment' => array('attachment' => ''))
+ )
+ ),
+ array('validate' => 'only', 'deep' => true)
+ );
+ $this->assertFalse($result);
+
+ $result = $TestModel->saveAll(array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'Third new comment', 'published' => 'Y', 'user_id' => 5),
+ array('comment' => 'Fourth new comment', 'published' => 'Y', 'user_id' => 2, 'Attachment' => array('attachment' => 'deepsave'))
+ )
+ ),
+ array('validate' => 'only', 'atomic' => false, 'deep' => true)
+ );
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(
+ true,
+ true
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->saveAll(array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array('comment' => 'Third new comment', 'published' => 'Y', 'user_id' => 5),
+ array('comment' => 'Fourth new comment', 'published' => 'Y', 'user_id' => 2, 'Attachment' => array('attachment' => ''))
+ )
+ ),
+ array('validate' => 'only', 'atomic' => false, 'deep' => true)
+ );
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(
+ true,
+ false
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $expected = array(
+ 'Comment' => array(
+ 1 => array(
+ 'Attachment' => array(
+ 'attachment' => array('This field cannot be left blank')
+ )
+ )
+ )
+ );
+ $result = $TestModel->validationErrors;
+ $this->assertSame($expected, $result);
+
+ $data = array(
+ 'Attachment' => array(
+ 'attachment' => 'deepsave insert',
+ ),
+ 'Comment' => array(
+ 'comment' => 'First comment deepsave insert',
+ 'published' => 'Y',
+ 'user_id' => 5,
+ 'Article' => array(
+ 'title' => 'First Article deepsave insert',
+ 'body' => 'First Article Body deepsave insert',
+ 'User' => array(
+ 'user' => 'deepsave',
+ 'password' => 'magic'
+ ),
+ ),
+ )
+ );
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => true));
+ $this->assertTrue($result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
+ $expected = array(
+ 'Attachment' => true,
+ 'Comment' => true
+ );
+ $this->assertSame($expected, $result);
+
+ $data = array(
+ 'Attachment' => array(
+ 'attachment' => 'deepsave insert',
+ ),
+ 'Comment' => array(
+ 'comment' => 'First comment deepsave insert',
+ 'published' => 'Y',
+ 'user_id' => 5,
+ 'Article' => array(
+ 'title' => 'First Article deepsave insert',
+ 'body' => 'First Article Body deepsave insert',
+ 'User' => array(
+ 'user' => '',
+ 'password' => 'magic'
+ ),
+ ),
+ )
+ );
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => true));
+ $this->assertFalse($result);
+
+ $result = $TestModel->Comment->Attachment->validationErrors;
+ $expected = array(
+ 'Comment' => array(
+ 'Article' => array(
+ 'User' => array(
+ 'user' => array('This field cannot be left blank')
+ )
+ )
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
+ $expected = array(
+ 'Attachment' => true,
+ 'Comment' => false
+ );
+ $this->assertEquals($expected, $result);
+
+ $data['Comment']['Article']['body'] = '';
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => true));
+ $this->assertFalse($result);
+
+ $result = $TestModel->Comment->Attachment->validationErrors;
+ $expected = array(
+ 'Comment' => array(
+ 'Article' => array(
+ 'body' => array('This field cannot be left blank')
+ )
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
+ $expected = array(
+ 'Attachment' => true,
+ 'Comment' => false
+ );
+ $this->assertEquals($expected, $result);
+
+ $data['Comment']['comment'] = '';
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => true));
+ $this->assertFalse($result);
+
+ $result = $TestModel->Comment->Attachment->validationErrors;
+ $expected = array(
+ 'Comment' => array(
+ 'comment' => array('This field cannot be left blank')
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
+ $expected = array(
+ 'Attachment' => true,
+ 'Comment' => false
+ );
+ $this->assertEquals($expected, $result);
+
+ $data['Attachment']['attachment'] = '';
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => true));
+ $this->assertFalse($result);
+
+ $result = $TestModel->Comment->Attachment->validationErrors;
+ $expected = array('attachment' => array('This field cannot be left blank'));
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->validationErrors;
+ $expected = array('comment' => array('This field cannot be left blank'));
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => true));
+ $expected = array(
+ 'Attachment' => false,
+ 'Comment' => false
+ );
+ $this->assertEquals($expected, $result);
+ }
/**
* testSaveAllNotDeepAssociated method
@@ -3391,6 +3666,148 @@ class ModelWriteTest extends BaseModelTest {
$result = $TestModel->saveAll($data, array('deep' => false));
$this->assertTrue($result);
}
+/**
+ * testSaveAllNotDeepValidateOnly
+ * tests the validate methods to not validate deeper recursive data
+ *
+ * @return void
+ */
+ public function testSaveAllNotDeepValidateOnly() {
+ $this->loadFixtures('Article', 'Comment', 'User', 'Attachment');
+ $TestModel = new Article();
+ $TestModel->hasMany['Comment']['order'] = array('Comment.created' => 'ASC');
+ $TestModel->hasAndBelongsToMany = array();
+ $TestModel->Comment->Attachment->validate['attachment'] = 'notEmpty';
+ $TestModel->Comment->validate['comment'] = 'notEmpty';
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2, 'body' => ''),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => '', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'deep' => false)
+ );
+ $this->assertFalse($result);
+
+ $expected = array('body' => array('This field cannot be left blank'));
+ $result = $TestModel->validationErrors;
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2, 'body' => 'Ignore invalid user data'),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => '', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'deep' => false)
+ );
+ $this->assertTrue($result);
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2, 'body' => 'Ignore invalid user data'),
+ 'Comment' => array(
+ array('comment' => 'First new comment', 'published' => 'Y', 'User' => array('user' => '', 'password' => 'newuserpass')),
+ array('comment' => 'Second new comment', 'published' => 'Y', 'user_id' => 2)
+ )
+ ),
+ array('validate' => 'only', 'atomic' => false, 'deep' => false)
+ );
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(
+ true,
+ true
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->saveAll(array(
+ 'Article' => array('id' => 2, 'body' => 'Ignore invalid attachment data'),
+ 'Comment' => array(
+ array('comment' => 'Third new comment', 'published' => 'Y', 'user_id' => 5),
+ array('comment' => 'Fourth new comment', 'published' => 'Y', 'user_id' => 2, 'Attachment' => array('attachment' => ''))
+ )
+ ),
+ array('validate' => 'only', 'deep' => false)
+ );
+ $this->assertTrue($result);
+
+ $result = $TestModel->saveAll(array(
+ 'Article' => array('id' => 2, 'body' => 'Ignore invalid attachment data'),
+ 'Comment' => array(
+ array('comment' => 'Third new comment', 'published' => 'Y', 'user_id' => 5),
+ array('comment' => 'Fourth new comment', 'published' => 'Y', 'user_id' => 2, 'Attachment' => array('attachment' => ''))
+ )
+ ),
+ array('validate' => 'only', 'atomic' => false, 'deep' => false)
+ );
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(
+ true,
+ true
+ )
+ );
+ $this->assertSame($expected, $result);
+
+ $expected = array();
+ $result = $TestModel->validationErrors;
+ $this->assertSame($expected, $result);
+
+ $data = array(
+ 'Attachment' => array(
+ 'attachment' => 'deepsave insert',
+ ),
+ 'Comment' => array(
+ 'comment' => 'First comment deepsave insert',
+ 'published' => 'Y',
+ 'user_id' => 5,
+ 'Article' => array(
+ 'title' => 'First Article deepsave insert ignored',
+ 'body' => 'First Article Body deepsave insert',
+ 'User' => array(
+ 'user' => '',
+ 'password' => 'magic'
+ ),
+ ),
+ )
+ );
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => false));
+ $this->assertTrue($result);
+
+ $result = $TestModel->Comment->Attachment->validationErrors;
+ $expected = array();
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => false));
+ $expected = array(
+ 'Attachment' => true,
+ 'Comment' => true
+ );
+ $this->assertEquals($expected, $result);
+
+ $data['Comment']['Article']['body'] = '';
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'deep' => false));
+ $this->assertTrue($result);
+
+ $result = $TestModel->Comment->Attachment->validationErrors;
+ $expected = array();
+ $this->assertSame($expected, $result);
+
+ $result = $TestModel->Comment->Attachment->saveAll($data, array('validate' => 'only', 'atomic' => false, 'deep' => false));
+ $expected = array(
+ 'Attachment' => true,
+ 'Comment' => true
+ );
+ $this->assertEquals($expected, $result);
+ }
/**
* testSaveAllHasMany method
@@ -3850,7 +4267,7 @@ class ModelWriteTest extends BaseModelTest {
'author_id' => '3',
'title' => 'Just update the title',
'body' => 'Second Post Body',
- 'published' => 'Y',
+ 'published' => 'N',
'created' => '2007-03-18 10:41:23'
)),
array(
@@ -3939,7 +4356,7 @@ class ModelWriteTest extends BaseModelTest {
'author_id' => '3',
'title' => 'Just update the title',
'body' => 'Second Post Body',
- 'published' => 'Y',
+ 'published' => 'N',
'created' => '2007-03-18 10:41:23'
)
),
@@ -3999,6 +4416,59 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($errors, $TestModel->validationErrors);
}
+/**
+ * testSaveAllValidationOnly method
+ *
+ * @return void
+ */
+ public function testSaveAllValidationOnly() {
+ $this->loadFixtures('Comment', 'Attachment');
+ $TestModel = new Comment();
+ $TestModel->Attachment->validate = array('attachment' => 'notEmpty');
+
+ $data = array(
+ 'Comment' => array(
+ 'comment' => 'This is the comment'
+ ),
+ 'Attachment' => array(
+ 'attachment' => ''
+ )
+ );
+
+ $result = $TestModel->saveAll($data, array('validate' => 'only'));
+ $this->assertFalse($result);
+
+ $TestModel = new Article();
+ $TestModel->validate = array('title' => 'notEmpty');
+ $result = $TestModel->saveAll(
+ array(
+ 0 => array('title' => ''),
+ 1 => array('title' => 'title 1'),
+ 2 => array('title' => 'title 2'),
+ ),
+ array('validate' => 'only')
+ );
+ $this->assertFalse($result);
+ $expected = array(
+ 0 => array('title' => array('This field cannot be left blank')),
+ );
+ $this->assertEquals($expected, $TestModel->validationErrors);
+
+ $result = $TestModel->saveAll(
+ array(
+ 0 => array('title' => 'title 0'),
+ 1 => array('title' => ''),
+ 2 => array('title' => 'title 2'),
+ ),
+ array('validate' => 'only')
+ );
+ $this->assertFalse($result);
+ $expected = array(
+ 1 => array('title' => array('This field cannot be left blank')),
+ );
+ $this->assertEquals($expected, $TestModel->validationErrors);
+ }
+
/**
* testSaveAllValidateFirst method
*
@@ -4071,8 +4541,8 @@ class ModelWriteTest extends BaseModelTest {
$result = $model->find('all');
$this->assertEquals(
- 'Post with Author saveAlled from comment',
- $result[0]['Article']['title']
+ $result[0]['Article']['title'],
+ 'Post with Author saveAlled from comment'
);
$this->assertEquals('Only new comment', $result[0]['Comment'][0]['comment']);
}
@@ -4137,6 +4607,82 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($expected, $result);
}
+/**
+ * testSaveAllHasManyValidationOnly method
+ *
+ * @return void
+ */
+ public function testSaveAllHasManyValidationOnly() {
+ $this->loadFixtures('Article', 'Comment', 'Attachment');
+ $TestModel = new Article();
+ $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array();
+ $TestModel->Comment->validate = array('comment' => 'notEmpty');
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array(
+ 'id' => 1,
+ 'comment' => '',
+ 'published' => 'Y',
+ 'user_id' => 1),
+ array(
+ 'id' => 2,
+ 'comment' =>
+ 'comment',
+ 'published' => 'Y',
+ 'user_id' => 1
+ ))),
+ array('validate' => 'only')
+ );
+ $this->assertFalse($result);
+
+ $result = $TestModel->saveAll(
+ array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array(
+ 'id' => 1,
+ 'comment' => '',
+ 'published' => 'Y',
+ 'user_id' => 1
+ ),
+ array(
+ 'id' => 2,
+ 'comment' => 'comment',
+ 'published' => 'Y',
+ 'user_id' => 1
+ ),
+ array(
+ 'id' => 3,
+ 'comment' => '',
+ 'published' => 'Y',
+ 'user_id' => 1
+ ))),
+ array(
+ 'validate' => 'only',
+ 'atomic' => false
+ ));
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(false, true, false)
+ );
+ $this->assertSame($expected, $result);
+
+ $expected = array('Comment' => array(
+ 0 => array('comment' => array('This field cannot be left blank')),
+ 2 => array('comment' => array('This field cannot be left blank'))
+ ));
+ $this->assertEquals($expected, $TestModel->validationErrors);
+
+ $expected = array(
+ 0 => array('comment' => array('This field cannot be left blank')),
+ 2 => array('comment' => array('This field cannot be left blank'))
+ );
+ $this->assertEquals($expected, $TestModel->Comment->validationErrors);
+ }
+
/**
* test that saveAll behaves like plain save() when supplied empty data
*
@@ -5077,7 +5623,7 @@ class ModelWriteTest extends BaseModelTest {
'author_id' => '3',
'title' => 'Just update the title',
'body' => 'Second Post Body',
- 'published' => 'Y',
+ 'published' => 'N',
'created' => '2007-03-18 10:41:23'
)
),
@@ -5173,7 +5719,7 @@ class ModelWriteTest extends BaseModelTest {
'author_id' => '3',
'title' => 'Just update the title',
'body' => 'Second Post Body',
- 'published' => 'Y',
+ 'published' => 'N',
)),
array(
'Post' => array(
@@ -5217,6 +5763,39 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($errors, $TestModel->validationErrors);
}
+/**
+ * testValidateMany method
+ *
+ * @return void
+ */
+ public function testValidateMany() {
+ $TestModel = new Article();
+ $TestModel->validate = array('title' => 'notEmpty');
+ $data = array(
+ 0 => array('title' => ''),
+ 1 => array('title' => 'title 1'),
+ 2 => array('title' => 'title 2'),
+ );
+ $result = $TestModel->validateMany($data);
+ $this->assertFalse($result);
+ $expected = array(
+ 0 => array('title' => array('This field cannot be left blank')),
+ );
+ $this->assertEquals($expected, $TestModel->validationErrors);
+
+ $data = array(
+ 0 => array('title' => 'title 0'),
+ 1 => array('title' => ''),
+ 2 => array('title' => 'title 2'),
+ );
+ $result = $TestModel->validateMany($data);
+ $this->assertFalse($result);
+ $expected = array(
+ 1 => array('title' => array('This field cannot be left blank')),
+ );
+ $this->assertEquals($expected, $TestModel->validationErrors);
+ }
+
/**
* testSaveAssociatedValidateFirst method
*
@@ -5354,6 +5933,92 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($expected, $result);
}
+/**
+ * testValidateAssociated method
+ *
+ * @return void
+ */
+ public function testValidateAssociated() {
+ $TestModel = new Comment();
+ $TestModel->Attachment->validate = array('attachment' => 'notEmpty');
+
+ $data = array(
+ 'Comment' => array(
+ 'comment' => 'This is the comment'
+ ),
+ 'Attachment' => array(
+ 'attachment' => ''
+ )
+ );
+
+ $result = $TestModel->validateAssociated($data);
+ $this->assertFalse($result);
+
+ $TestModel = new Article();
+ $TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array();
+ $TestModel->Comment->validate = array('comment' => 'notEmpty');
+
+ $data = array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array(
+ 'id' => 1,
+ 'comment' => '',
+ 'published' => 'Y',
+ 'user_id' => 1),
+ array(
+ 'id' => 2,
+ 'comment' =>
+ 'comment',
+ 'published' => 'Y',
+ 'user_id' => 1
+ )));
+ $result = $TestModel->validateAssociated($data);
+ $this->assertFalse($result);
+
+ $data = array(
+ 'Article' => array('id' => 2),
+ 'Comment' => array(
+ array(
+ 'id' => 1,
+ 'comment' => '',
+ 'published' => 'Y',
+ 'user_id' => 1
+ ),
+ array(
+ 'id' => 2,
+ 'comment' => 'comment',
+ 'published' => 'Y',
+ 'user_id' => 1
+ ),
+ array(
+ 'id' => 3,
+ 'comment' => '',
+ 'published' => 'Y',
+ 'user_id' => 1
+ )));
+ $result = $TestModel->validateAssociated($data, array(
+ 'atomic' => false
+ ));
+ $expected = array(
+ 'Article' => true,
+ 'Comment' => array(false, true, false)
+ );
+ $this->assertSame($expected, $result);
+
+ $expected = array('Comment' => array(
+ 0 => array('comment' => array('This field cannot be left blank')),
+ 2 => array('comment' => array('This field cannot be left blank'))
+ ));
+ $this->assertEquals($expected, $TestModel->validationErrors);
+
+ $expected = array(
+ 0 => array('comment' => array('This field cannot be left blank')),
+ 2 => array('comment' => array('This field cannot be left blank'))
+ );
+ $this->assertEquals($expected, $TestModel->Comment->validationErrors);
+ }
+
/**
* test that saveMany behaves like plain save() when suplied empty data
*
@@ -5802,6 +6467,42 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals('', $result[0]['Comment'][1]['comment']);
}
+/**
+ * testSaveAllFieldListHasOne method
+ *
+ * @return void
+ */
+ public function testSaveAllFieldListHasOne() {
+ $this->loadFixtures('Attachment', 'Comment', 'Article', 'User');
+ $TestModel = new Comment();
+
+ $TestModel->validate = array('comment' => 'notEmpty');
+ $TestModel->Attachment->validate = array('attachment' => 'notEmpty');
+
+ $record = array(
+ 'Comment' => array(
+ 'user_id' => 1,
+ 'article_id' => 1,
+ 'comment' => '',
+ ),
+ 'Attachment' => array(
+ 'attachment' => ''
+ )
+ );
+ $result = $TestModel->saveAll($record, array('validate' => 'only'));
+ $this->assertFalse($result);
+
+ $fieldList = array(
+ 'Comment' => array('id', 'article_id', 'user_id'),
+ 'Attachment' => array('comment_id')
+ );
+ $result = $TestModel->saveAll($record, array(
+ 'fieldList' => $fieldList, 'validate' => 'only'
+ ));
+ $this->assertTrue($result);
+ $this->assertEmpty($TestModel->validationErrors);
+ }
+
/**
* testSaveAllDeepFieldListValidateBelongsTo
*
diff --git a/lib/Cake/Test/Case/Model/models.php b/lib/Cake/Test/Case/Model/models.php
index a206b0790..fe0db80a2 100644
--- a/lib/Cake/Test/Case/Model/models.php
+++ b/lib/Cake/Test/Case/Model/models.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Model
* @since CakePHP(tm) v 1.2.0.6464
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -2537,15 +2537,15 @@ class NumberTree extends CakeTestModel {
* @param mixed $currentLevel
* @param mixed $parent_id
* @param string $prefix
- * @param bool $hierachial
+ * @param bool $hierarchal
* @return void
*/
- public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierachial = true) {
+ public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierarchal = true) {
if (!$parentId) {
$db = ConnectionManager::getDataSource($this->useDbConfig);
$db->truncate($this->table);
$this->save(array($this->name => array('name' => '1. Root')));
- $this->initialize($levelLimit, $childLimit, 1, $this->id, '1', $hierachial);
+ $this->initialize($levelLimit, $childLimit, 1, $this->id, '1', $hierarchal);
$this->create(array());
}
@@ -2558,7 +2558,7 @@ class NumberTree extends CakeTestModel {
$data = array($this->name => array('name' => $name));
$this->create($data);
- if ($hierachial) {
+ if ($hierarchal) {
if ($this->name == 'UnconventionalTree') {
$data[$this->name]['join'] = $parentId;
} else {
@@ -2566,7 +2566,7 @@ class NumberTree extends CakeTestModel {
}
}
$this->save($data);
- $this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierachial);
+ $this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierarchal);
}
}
@@ -3119,7 +3119,7 @@ class TranslatedItem2 extends CakeTestModel {
/**
* translateModel property
*
- * @var string 'TranslateTestModel'
+ * @var string
*/
public $translateModel = 'TranslateWithPrefix';
@@ -3163,7 +3163,7 @@ class TranslatedItemWithTable extends CakeTestModel {
/**
* translateModel property
*
- * @var string 'TranslateTestModel'
+ * @var string
*/
public $translateModel = 'TranslateTestModel';
@@ -3248,6 +3248,13 @@ class TranslatedArticle extends CakeTestModel {
*/
public $belongsTo = array('User');
+/**
+ * belongsTo property
+ *
+ * @var array
+ */
+ public $hasMany = array('TranslatedItem');
+
}
class CounterCacheUser extends CakeTestModel {
@@ -4941,6 +4948,13 @@ class CustomArticle extends AppModel {
*/
public $findMethods = array('unPublished' => true);
+/**
+ * belongsTo property
+ *
+ * @var array
+ */
+ public $belongsTo = array('User');
+
/**
* _findUnPublished custom find
*
@@ -4954,4 +4968,13 @@ class CustomArticle extends AppModel {
return $results;
}
+/**
+ * Alters title data
+ *
+ * @return void
+ **/
+ public function beforeValidate($options = array()) {
+ $this->data[$this->alias]['title'] = 'foo';
+ }
+
}
diff --git a/lib/Cake/Test/Case/Network/CakeRequestTest.php b/lib/Cake/Test/Case/Network/CakeRequestTest.php
index 4ca06914c..aa1d22013 100644
--- a/lib/Cake/Test/Case/Network/CakeRequestTest.php
+++ b/lib/Cake/Test/Case/Network/CakeRequestTest.php
@@ -929,6 +929,22 @@ class CakeRequestTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
+/**
+ * Test parsing accept with a confusing accept value.
+ *
+ * @return void
+ */
+ public function testParseAcceptNoQValues() {
+ $_SERVER['HTTP_ACCEPT'] = 'application/json, text/plain, */*';
+
+ $request = new CakeRequest('/', false);
+ $result = $request->parseAccept();
+ $expected = array(
+ '1.0' => array('application/json', 'text/plain', '*/*'),
+ );
+ $this->assertEquals($expected, $result);
+ }
+
/**
* testBaseUrlAndWebrootWithModRewrite method
*
diff --git a/lib/Cake/Test/Case/Network/CakeResponseTest.php b/lib/Cake/Test/Case/Network/CakeResponseTest.php
index 91be19de8..9f601b1b4 100644
--- a/lib/Cake/Test/Case/Network/CakeResponseTest.php
+++ b/lib/Cake/Test/Case/Network/CakeResponseTest.php
@@ -118,8 +118,9 @@ class CakeResponseTest extends CakeTestCase {
$this->assertEquals('application/vnd.wap.xhtml+xml', $response->type('xhtml-mobile'));
$this->assertEquals('text/csv', $response->type('csv'));
- $response->type(array('keynote' => 'application/keynote'));
+ $response->type(array('keynote' => 'application/keynote', 'bat' => 'application/bat'));
$this->assertEquals('application/keynote', $response->type('keynote'));
+ $this->assertEquals('application/bat', $response->type('bat'));
$this->assertFalse($response->type('wackytype'));
}
@@ -925,7 +926,7 @@ class CakeResponseTest extends CakeTestCase {
/**
* Test cookie setting
- *
+ *
* @return void
*/
public function testCookieSettings() {
diff --git a/lib/Cake/Test/Case/Network/CakeSocketTest.php b/lib/Cake/Test/Case/Network/CakeSocketTest.php
index 613e08d71..abe6fcadf 100644
--- a/lib/Cake/Test/Case/Network/CakeSocketTest.php
+++ b/lib/Cake/Test/Case/Network/CakeSocketTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
index 6a21032ba..a087ab472 100644
--- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
+++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Email
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Network/Email/DebugTransportTest.php b/lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
index 72fe704c8..11512fd66 100644
--- a/lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
+++ b/lib/Cake/Test/Case/Network/Email/DebugTransportTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Email
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -51,7 +51,7 @@ class DebugTransportTest extends CakeTestCase {
$email->subject('Testing Message');
$date = date(DATE_RFC2822);
$email->setHeaders(array('X-Mailer' => DebugCakeEmail::EMAIL_CLIENT, 'Date' => $date));
- $email->expects($this->any())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '')));
+ $email->expects($this->any())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '.Third Line', '')));
$headers = "From: CakePHP Test \r\n";
$headers .= "To: CakePHP \r\n";
@@ -66,6 +66,7 @@ class DebugTransportTest extends CakeTestCase {
$data = "First Line\r\n";
$data .= "Second Line\r\n";
+ $data .= ".Third Line\r\n"; // Not use 'RFC5321 4.5.2.Transparency' in DebugTransport.
$result = $this->DebugTransport->send($email);
diff --git a/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php b/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
index 86591d5f8..0310e5320 100644
--- a/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
+++ b/lib/Cake/Test/Case/Network/Email/SmtpTransportTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Email
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -221,7 +221,7 @@ class SmtpTransportTest extends CakeTestCase {
$email->subject('Testing SMTP');
$date = date(DATE_RFC2822);
$email->setHeaders(array('X-Mailer' => SmtpCakeEmail::EMAIL_CLIENT, 'Date' => $date));
- $email->expects($this->any())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '')));
+ $email->expects($this->any())->method('message')->will($this->returnValue(array('First Line', 'Second Line', '.Third Line', '')));
$data = "From: CakePHP Test \r\n";
$data .= "Return-Path: CakePHP Return \r\n";
@@ -237,6 +237,7 @@ class SmtpTransportTest extends CakeTestCase {
$data .= "\r\n";
$data .= "First Line\r\n";
$data .= "Second Line\r\n";
+ $data .= "..Third Line\r\n"; // RFC5321 4.5.2.Transparency
$data .= "\r\n";
$data .= "\r\n\r\n.\r\n";
diff --git a/lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php b/lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php
index 25c1b5cac..6ea778919 100644
--- a/lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php
+++ b/lib/Cake/Test/Case/Network/Http/BasicAuthenticationTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Http
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php b/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
index 13fb7d352..a03a536d9 100644
--- a/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
+++ b/lib/Cake/Test/Case/Network/Http/DigestAuthenticationTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Http
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php b/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
index 9a6e35345..0f6213e4c 100644
--- a/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
+++ b/lib/Cake/Test/Case/Network/Http/HttpResponseTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Http
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
index 52f447858..b80e8621d 100644
--- a/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
+++ b/lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Network.Http
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Routing/DispatcherTest.php b/lib/Cake/Test/Case/Routing/DispatcherTest.php
index d63af11c4..023c436f9 100644
--- a/lib/Cake/Test/Case/Routing/DispatcherTest.php
+++ b/lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Routing
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php b/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php
index 998e561a4..28d44b49b 100644
--- a/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php
+++ b/lib/Cake/Test/Case/Routing/Filter/AssetDispatcherTest.php
@@ -93,7 +93,7 @@ class AssetDispatcherTest extends CakeTestCase {
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
));
$time = filemtime(App::themePath('TestTheme') . 'webroot' . DS . 'img' . DS . 'cake.power.gif');
- $time = new DateTime(date('Y-m-d H:i:s', $time), new DateTimeZone('UTC'));
+ $time = new DateTime('@' . $time);
$response = $this->getMock('CakeResponse', array('send', 'checkNotModified'));
$request = new CakeRequest('theme/test_theme/img/cake.power.gif');
diff --git a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
index 58e0644c4..a60f04530 100644
--- a/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
+++ b/lib/Cake/Test/Case/Routing/Route/CakeRouteTest.php
@@ -299,6 +299,16 @@ class CakeRouteTest extends CakeTestCase {
$result = $route->match($url);
$expected = '/admin/subscriptions/edit/1';
$this->assertEquals($expected, $result);
+
+ $url = array(
+ 'controller' => 'subscribe',
+ 'admin' => true,
+ 'action' => 'edit_admin_e',
+ 1
+ );
+ $result = $route->match($url);
+ $expected = '/admin/subscriptions/edit_admin_e/1';
+ $this->assertEquals($expected, $result);
}
/**
diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php
index d45cafa17..dd7e6879a 100644
--- a/lib/Cake/Test/Case/Routing/RouterTest.php
+++ b/lib/Cake/Test/Case/Routing/RouterTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Routing
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -1582,6 +1582,10 @@ class RouterTest extends CakeTestCase {
$expected = '/protected/images/add';
$this->assertEquals($expected, $result);
+ $result = Router::url(array('controller' => 'images', 'action' => 'add_protected_test', 'protected' => true));
+ $expected = '/protected/images/add_protected_test';
+ $this->assertEquals($expected, $result);
+
$result = Router::url(array('action' => 'edit', 1));
$expected = '/images/edit/1';
$this->assertEquals($expected, $result);
@@ -2586,4 +2590,49 @@ class RouterTest extends CakeTestCase {
Router::defaultRouteClass('NonExistentClass');
}
+/**
+ * Tests generating well-formed querystrings
+ *
+ * @return void
+ */
+ public function testQueryString() {
+ $result = Router::queryString(array('var' => 'foo bar'));
+ $expected = '?var=foo+bar';
+ $this->assertEquals($expected, $result);
+
+ $result = Router::queryString(false, array('some' => 'param', 'foo' => 'bar'));
+ $expected = '?some=param&foo=bar';
+ $this->assertEquals($expected, $result);
+
+ $existing = array('apple' => 'red', 'pear' => 'green');
+ $result = Router::queryString($existing, array('some' => 'param', 'foo' => 'bar'));
+ $expected = '?apple=red&pear=green&some=param&foo=bar';
+ $this->assertEquals($expected, $result);
+
+ $existing = 'apple=red&pear=green';
+ $result = Router::queryString($existing, array('some' => 'param', 'foo' => 'bar'));
+ $expected = '?apple=red&pear=green&some=param&foo=bar';
+ $this->assertEquals($expected, $result);
+
+ $existing = '?apple=red&pear=green';
+ $result = Router::queryString($existing, array('some' => 'param', 'foo' => 'bar'));
+ $expected = '?apple=red&pear=green&some=param&foo=bar';
+ $this->assertEquals($expected, $result);
+
+ $result = Router::queryString('apple=red&pear=green');
+ $expected = '?apple=red&pear=green';
+ $this->assertEquals($expected, $result);
+
+ $result = Router::queryString('foo=bar', array('php' => 'nut', 'jose' => 'zap'), true);
+ $expected = '?foo=bar&php=nut&jose=zap';
+ $this->assertEquals($expected, $result);
+
+ $result = Router::queryString('foo=bar&', array('php' => 'nut', 'jose' => 'zap'), true);
+ $expected = '?foo=bar&php=nut&jose=zap';
+ $this->assertEquals($expected, $result);
+
+ $result = Router::queryString('foo=bar&', array('php' => 'nut', 'jose' => 'zap'));
+ $expected = '?foo=bar&php=nut&jose=zap';
+ $this->assertEquals($expected, $result);
+ }
}
diff --git a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
index e7e9db503..556554872 100644
--- a/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
+++ b/lib/Cake/Test/Case/TestSuite/CakeTestFixtureTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.TestSuite
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
index af124be1d..cf6bbb85a 100644
--- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
+++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
@@ -542,4 +542,23 @@ class ControllerTestCaseTest extends CakeTestCase {
$this->assertSame($this->Case->controller->request, $this->Case->controller->RequestHandler->request);
}
+/**
+ * Test that testAction() doesn't destroy data in GET & POST
+ *
+ * @return void
+ */
+ public function testRestoreGetPost() {
+ $restored = array('new' => 'value');
+
+ $_GET = $restored;
+ $_POST = $restored;
+
+ $this->Case->generate('TestsApps');
+ $options = array('method' => 'get');
+ $this->Case->testAction('/tests_apps/index', $options);
+
+ $this->assertEquals($restored, $_GET);
+ $this->assertEquals($restored, $_POST);
+ }
+
}
diff --git a/lib/Cake/Test/Case/Utility/CakeNumberTest.php b/lib/Cake/Test/Case/Utility/CakeNumberTest.php
index 1895c4db2..7fb9d1590 100644
--- a/lib/Cake/Test/Case/Utility/CakeNumberTest.php
+++ b/lib/Cake/Test/Case/Utility/CakeNumberTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/CakeTimeTest.php b/lib/Cake/Test/Case/Utility/CakeTimeTest.php
index 7193988dd..81e737c3f 100644
--- a/lib/Cake/Test/Case/Utility/CakeTimeTest.php
+++ b/lib/Cake/Test/Case/Utility/CakeTimeTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -810,7 +810,7 @@ class CakeTimeTest extends CakeTestCase {
$this->assertEquals($expected, $result);
$result = $this->Time->i18nFormat($time, '%c');
- $expected = 'jue 14 ene 2010 13:59:28 ' . strftime('%Z', $time);
+ $expected = 'jue 14 ene 2010 13:59:28 ' . utf8_encode(strftime('%Z', $time));
$this->assertEquals($expected, $result);
$result = $this->Time->i18nFormat($time, 'Time is %r, and date is %x');
@@ -824,7 +824,7 @@ class CakeTimeTest extends CakeTestCase {
$this->assertEquals($expected, $result);
$result = $this->Time->i18nFormat($time, '%c');
- $expected = 'mié 13 ene 2010 13:59:28 ' . strftime('%Z', $time);
+ $expected = 'mié 13 ene 2010 13:59:28 ' . utf8_encode(strftime('%Z', $time));
$this->assertEquals($expected, $result);
$result = $this->Time->i18nFormat($time, 'Time is %r, and date is %x');
diff --git a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php
index bca56f206..eb20fcead 100644
--- a/lib/Cake/Test/Case/Utility/ClassRegistryTest.php
+++ b/lib/Cake/Test/Case/Utility/ClassRegistryTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php
index 22c1343ae..e63bcbd9f 100644
--- a/lib/Cake/Test/Case/Utility/FileTest.php
+++ b/lib/Cake/Test/Case/Utility/FileTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/FolderTest.php b/lib/Cake/Test/Case/Utility/FolderTest.php
index 1cc2230a1..76ee08af4 100644
--- a/lib/Cake/Test/Case/Utility/FolderTest.php
+++ b/lib/Cake/Test/Case/Utility/FolderTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/InflectorTest.php b/lib/Cake/Test/Case/Utility/InflectorTest.php
index d5683680a..cd1989248 100644
--- a/lib/Cake/Test/Case/Utility/InflectorTest.php
+++ b/lib/Cake/Test/Case/Utility/InflectorTest.php
@@ -13,7 +13,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing
+ * @link http://book.cakephp.org/2.0/en/development/testing.html
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.4206
* @license Open Group Test Suite License (http://www.opensource.org/licenses/opengroup.php)
diff --git a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
index 70a8e09d9..c8adc05ef 100644
--- a/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
+++ b/lib/Cake/Test/Case/Utility/ObjectCollectionTest.php
@@ -11,7 +11,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/SanitizeTest.php b/lib/Cake/Test/Case/Utility/SanitizeTest.php
index b731b5559..13ba63c53 100644
--- a/lib/Cake/Test/Case/Utility/SanitizeTest.php
+++ b/lib/Cake/Test/Case/Utility/SanitizeTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.5428
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/SecurityTest.php b/lib/Cake/Test/Case/Utility/SecurityTest.php
index 67f104a0d..ca7fb6916 100644
--- a/lib/Cake/Test/Case/Utility/SecurityTest.php
+++ b/lib/Cake/Test/Case/Utility/SecurityTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/SetTest.php b/lib/Cake/Test/Case/Utility/SetTest.php
index 41f781bdd..51778582f 100644
--- a/lib/Cake/Test/Case/Utility/SetTest.php
+++ b/lib/Cake/Test/Case/Utility/SetTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/StringTest.php b/lib/Cake/Test/Case/Utility/StringTest.php
index b70456654..efa024b5b 100644
--- a/lib/Cake/Test/Case/Utility/StringTest.php
+++ b/lib/Cake/Test/Case/Utility/StringTest.php
@@ -11,7 +11,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/Utility/ValidationTest.php b/lib/Cake/Test/Case/Utility/ValidationTest.php
index 89be30134..9bd7af111 100644
--- a/lib/Cake/Test/Case/Utility/ValidationTest.php
+++ b/lib/Cake/Test/Case/Utility/ValidationTest.php
@@ -4,14 +4,14 @@
*
* PHP Version 5.x
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -1822,6 +1822,8 @@ class ValidationTest extends CakeTestCase {
$this->assertFalse(Validation::inList('three', array('one', 'two')));
$this->assertFalse(Validation::inList('1one', array(0, 1, 2, 3)));
$this->assertFalse(Validation::inList('one', array(0, 1, 2, 3)));
+ $this->assertFalse(Validation::inList('2', array(1, 2, 3)));
+ $this->assertTrue(Validation::inList('2', array(1, 2, 3), false));
}
/**
@@ -1932,6 +1934,8 @@ class ValidationTest extends CakeTestCase {
$this->assertFalse(Validation::multiple(array('foo', 'bar', 'baz', 'squirrel'), array('min' => 10)));
$this->assertTrue(Validation::multiple(array(0, 5, 9), array('in' => range(0, 10), 'max' => 5)));
+ $this->assertFalse(Validation::multiple(array('0', '5', '9'), array('in' => range(0, 10), 'max' => 5)));
+ $this->assertTrue(Validation::multiple(array('0', '5', '9'), array('in' => range(0, 10), 'max' => 5), false));
$this->assertFalse(Validation::multiple(array(0, 5, 9, 8, 6, 2, 1), array('in' => range(0, 10), 'max' => 5)));
$this->assertFalse(Validation::multiple(array(0, 5, 9, 8, 11), array('in' => range(0, 10), 'max' => 5)));
diff --git a/lib/Cake/Test/Case/Utility/XmlTest.php b/lib/Cake/Test/Case/Utility/XmlTest.php
index 5118ce274..cd1fc87b4 100644
--- a/lib/Cake/Test/Case/Utility/XmlTest.php
+++ b/lib/Cake/Test/Case/Utility/XmlTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Utility
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
@@ -141,8 +141,14 @@ class XmlTest extends CakeTestCase {
$obj = Xml::build($xml, array('return' => 'domdocument'));
$this->assertEquals('tags', $obj->firstChild->nodeName);
- $this->assertEquals(Xml::build($xml, array('return' => 'domdocument')), Xml::build(file_get_contents($xml), array('return' => 'domdocument')));
- $this->assertEquals(Xml::build($xml, array('return' => 'simplexml')), Xml::build($xml, 'simplexml'));
+ $this->assertEquals(
+ Xml::build($xml, array('return' => 'domdocument')),
+ Xml::build(file_get_contents($xml), array('return' => 'domdocument'))
+ );
+ $this->assertEquals(
+ Xml::build($xml, array('return' => 'simplexml')),
+ Xml::build($xml, 'simplexml')
+ );
$xml = array('tag' => 'value');
$obj = Xml::build($xml);
@@ -234,15 +240,33 @@ class XmlTest extends CakeTestCase {
$this->assertTrue($obj instanceof SimpleXMLElement);
$this->assertEquals('tags', $obj->getName());
$this->assertEquals(2, count($obj));
- $xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?> ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
+ $xmlText = <<
+
+
+
+
+XML;
+ $this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
$obj = Xml::fromArray($xml);
$this->assertTrue($obj instanceof SimpleXMLElement);
$this->assertEquals('tags', $obj->getName());
$this->assertEquals(2, count($obj));
- $xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?>1 defect 2 enhancement ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
+ $xmlText = <<
+
+
+ 1
+ defect
+
+
+ 2
+ enhancement
+
+
+XML;
+ $this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
$xml = array(
'tags' => array(
@@ -286,8 +310,18 @@ class XmlTest extends CakeTestCase {
)
);
$obj = Xml::fromArray($xml, 'tags');
- $xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?>defect enhancement ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
+ $xmlText = <<
+
+
+ defect
+
+
+ enhancement
+
+
+XML;
+ $this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
$xml = array(
'tags' => array(
@@ -306,8 +340,11 @@ class XmlTest extends CakeTestCase {
)
);
$obj = Xml::fromArray($xml, 'tags');
- $xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?>All tagsTag 1defect enhancement ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
+ $xmlText = <<
+All tagsTag 1defect enhancement
+XML;
+ $this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
$xml = array(
'tags' => array(
@@ -319,7 +356,44 @@ class XmlTest extends CakeTestCase {
);
$obj = Xml::fromArray($xml, 'attributes');
$xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?>defect ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $obj->asXML()), $xmlText);
+ $this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
+ }
+
+/**
+ * Test non-sequential keys in list types.
+ *
+ * @return void
+ */
+ public function testFromArrayNonSequentialKeys() {
+ $xmlArray = array(
+ 'Event' => array(
+ array(
+ 'id' => '235',
+ 'Attribute' => array(
+ 0 => array(
+ 'id' => '9646',
+ ),
+ 2 => array(
+ 'id' => '9647',
+ )
+ )
+ )
+ )
+ );
+ $obj = Xml::fromArray($xmlArray);
+ $expected = <<
+
+ 235
+
+ 9646
+
+
+ 9647
+
+
+XML;
+ $this->assertXmlStringEqualsXmlString($expected, $obj->asXML());
}
/**
@@ -477,9 +551,11 @@ class XmlTest extends CakeTestCase {
$this->assertEquals($expected, Xml::toArray(Xml::fromArray($array, 'attributes')));
$this->assertEquals($expected, Xml::toArray(Xml::fromArray($array, array('format' => 'attributes', 'return' => 'domdocument'))));
- $xml = '';
- $xml .= 'defect ';
- $xml .= ' ';
+ $xml = <<
+defect
+
+XML;
$obj = Xml::build($xml);
$expected = array(
@@ -492,11 +568,13 @@ class XmlTest extends CakeTestCase {
);
$this->assertEquals($expected, Xml::toArray($obj));
- $xml = '';
- $xml .= '';
- $xml .= '';
- $xml .= 'The book is on the table.
';
- $xml .= ' ';
+ $xml = <<
+
+
+ The book is on the table.
+
+XML;
$obj = Xml::build($xml);
$expected = array(
@@ -510,10 +588,12 @@ class XmlTest extends CakeTestCase {
);
$this->assertEquals($expected, Xml::toArray($obj));
- $xml = '';
- $xml .= 'defect ';
- $xml .= '1 ';
- $xml .= ' ';
+ $xml = <<
+defect
+1
+
+XML;
$obj = Xml::build($xml);
$expected = array(
@@ -577,18 +657,27 @@ class XmlTest extends CakeTestCase {
)
);
$rssAsSimpleXML = Xml::fromArray($rss);
- $xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?>';
- $xmlText .= '';
- $xmlText .= '';
- $xmlText .= ' ';
- $xmlText .= 'The Bakery: ';
- $xmlText .= ' http://bakery.cakephp.org/';
- $xmlText .= 'Recent Articles at The Bakery. ';
- $xmlText .= 'Sun, 12 Sep 2010 04:18:26 -0500 ';
- $xmlText .= 'CakePHP 1.3.4 released http://bakery.cakephp.org/articles/view/cakephp-1-3-4-released ';
- $xmlText .= 'Wizard Component 1.2 Tutorial http://bakery.cakephp.org/articles/view/wizard-component-1-2-tutorial ';
- $xmlText .= ' ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $rssAsSimpleXML->asXML()), $xmlText);
+ $xmlText = <<
+
+
+
+ The Bakery:
+ http://bakery.cakephp.org/
+ Recent Articles at The Bakery.
+ Sun, 12 Sep 2010 04:18:26 -0500
+ -
+
CakePHP 1.3.4 released
+ http://bakery.cakephp.org/articles/view/cakephp-1-3-4-released
+
+ -
+
Wizard Component 1.2 Tutorial
+ http://bakery.cakephp.org/articles/view/wizard-component-1-2-tutorial
+
+
+
+XML;
+ $this->assertXmlStringEqualsXmlString($xmlText, $rssAsSimpleXML->asXML());
}
/**
@@ -630,7 +719,27 @@ class XmlTest extends CakeTestCase {
);
$this->assertSame(Xml::toArray($xml), $expected);
- $xmlText = '1 testing ';
+ $xmlText = <<
+
+
+
+
+
+
+
+ 1
+
+
+ testing
+
+
+
+
+
+
+
+XML;
$xml = Xml::build($xmlText);
$expected = array(
'methodResponse' => array(
@@ -653,7 +762,7 @@ class XmlTest extends CakeTestCase {
$this->assertSame(Xml::toArray($xml), $expected);
$xml = Xml::fromArray($expected, 'tags');
- $this->assertEquals(str_replace(array("\r", "\n"), '', $xml->asXML()), $xmlText);
+ $this->assertXmlStringEqualsXmlString($xmlText, $xml->asXML());
}
/**
@@ -701,12 +810,15 @@ class XmlTest extends CakeTestCase {
)
);
$xmlRequest = Xml::fromArray($xml, array('encoding' => null));
- $xmlText = '<' . '?xml version="1.0"?>';
- $xmlText .= '';
- $xmlText .= '';
- $xmlText .= 'IBM ';
- $xmlText .= ' ';
- $this->assertEquals(str_replace(array("\r", "\n"), '', $xmlRequest->asXML()), $xmlText);
+ $xmlText = <<
+
+
+ IBM
+
+
+XML;
+ $this->assertXmlStringEqualsXmlString($xmlText, $xmlRequest->asXML());
}
/**
@@ -715,7 +827,16 @@ class XmlTest extends CakeTestCase {
* @return void
*/
public function testNamespace() {
- $xmlResponse = Xml::build('good bad Tag without ns ');
+ $xml = <<
+
+ good
+ bad
+
+ Tag without ns
+
+XML;
+ $xmlResponse = Xml::build($xml);
$expected = array(
'root' => array(
'ns:tag' => array(
@@ -775,9 +896,17 @@ class XmlTest extends CakeTestCase {
)
)
);
- $expected = '<' . '?xml version="1.0" encoding="UTF-8"?>item 1 item 2 ';
+ $expected = <<
+
+
+ item 1
+ item 2
+
+
+XML;
$xmlResponse = Xml::fromArray($xml);
- $this->assertEquals(str_replace(array("\r", "\n"), '', $xmlResponse->asXML()), $expected);
+ $this->assertXmlStringEqualsXmlString($expected, $xmlResponse->asXML());
$xml = array(
'root' => array(
@@ -788,7 +917,7 @@ class XmlTest extends CakeTestCase {
);
$expected = '<' . '?xml version="1.0" encoding="UTF-8"?> ';
$xmlResponse = Xml::fromArray($xml);
- $this->assertEquals(str_replace(array("\r", "\n"), '', $xmlResponse->asXML()), $expected);
+ $this->assertXmlStringEqualsXmlString($expected, $xmlResponse->asXML());
$xml = array(
'root' => array(
@@ -797,7 +926,7 @@ class XmlTest extends CakeTestCase {
);
$expected = '<' . '?xml version="1.0" encoding="UTF-8"?> ';
$xmlResponse = Xml::fromArray($xml);
- $this->assertEquals(str_replace(array("\r", "\n"), '', $xmlResponse->asXML()), $expected);
+ $this->assertXmlStringEqualsXmlString($expected, $xmlResponse->asXML());
$xml = array(
'root' => array(
@@ -806,7 +935,7 @@ class XmlTest extends CakeTestCase {
);
$expected = '<' . '?xml version="1.0" encoding="UTF-8"?> ';
$xmlResponse = Xml::fromArray($xml);
- $this->assertEquals(str_replace(array("\r", "\n"), '', $xmlResponse->asXML()), $expected);
+ $this->assertXmlStringEqualsXmlString($expected, $xmlResponse->asXML());
}
/**
@@ -856,34 +985,38 @@ class XmlTest extends CakeTestCase {
$data = $user->read(null, 1);
$obj = Xml::build(compact('data'));
- $expected = '<' . '?xml version="1.0" encoding="UTF-8"?>';
- $expected .= '1 mariano 5f4dcc3b5aa765d61d8327deb882cf99 ';
- $expected .= '2007-03-17 01:16:23 2007-03-17 01:18:31 ';
- $expected .= '1 1 First Article First Article Body';
- $expected .= 'Y 2007-03-18 10:39:23 2007-03-18 10:41:31 ';
- $expected .= '3 1 Third Article Third Article Body';
- $expected .= 'Y 2007-03-18 10:43:23 2007-03-18 10:45:31 ';
- $expected .= ' ';
- $this->assertEquals($expected, str_replace(array("\r", "\n"), '', $obj->asXML()));
+ $expected = <<
+1 mariano 5f4dcc3b5aa765d61d8327deb882cf99
+2007-03-17 01:16:23 2007-03-17 01:18:31
+1 1 First Article First Article Body
+Y 2007-03-18 10:39:23 2007-03-18 10:41:31
+3 1 Third Article Third Article Body
+Y 2007-03-18 10:43:23 2007-03-18 10:45:31
+
+XML;
+ $this->assertXmlStringEqualsXmlString($expected, $obj->asXML());
//multiple model results - without a records key it would fatal error
$data = $user->find('all', array('limit' => 2));
$data = array('records' => $data);
$obj = Xml::build(compact('data'));
- $expected = '<' . '?xml version="1.0" encoding="UTF-8"?>';
- $expected .= '';
- $expected .= '1 mariano 5f4dcc3b5aa765d61d8327deb882cf99 ';
- $expected .= '2007-03-17 01:16:23 2007-03-17 01:18:31 ';
- $expected .= '1 1 First Article First Article Body';
- $expected .= 'Y 2007-03-18 10:39:23 2007-03-18 10:41:31 ';
- $expected .= '3 1 Third Article Third Article Body';
- $expected .= 'Y 2007-03-18 10:43:23 2007-03-18 10:45:31 ';
- $expected .= ' 2 nate 5f4dcc3b5aa765d61d8327deb882cf99 ';
- $expected .= '2007-03-17 01:18:23 2007-03-17 01:20:31 ';
- $expected .= ' ';
- $expected .= ' ';
+ $expected = <<
+
+1 mariano 5f4dcc3b5aa765d61d8327deb882cf99
+2007-03-17 01:16:23 2007-03-17 01:18:31
+1 1 First Article First Article Body
+Y 2007-03-18 10:39:23 2007-03-18 10:41:31
+3 1 Third Article Third Article Body
+Y 2007-03-18 10:43:23 2007-03-18 10:45:31
+ 2 nate 5f4dcc3b5aa765d61d8327deb882cf99
+2007-03-17 01:18:23 2007-03-17 01:20:31
+
+
+XML;
$result = $obj->asXML();
- $this->assertEquals($expected, str_replace(array("\r", "\n"), '', $obj->asXML()));
+ $this->assertXmlStringEqualsXmlString($expected, $obj->asXML());
}
/**
@@ -901,4 +1034,5 @@ class XmlTest extends CakeTestCase {
$result = $obj->asXml();
$this->assertContains('mark & mark', $result);
}
+
}
diff --git a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
index 768d7a5f5..cce3ca21b 100644
--- a/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/CacheHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
index 02097c1ac..3835100cb 100644
--- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
index 5ad9a926b..4b7262016 100644
--- a/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/JqueryEngineHelperTest.php b/lib/Cake/Test/Case/View/Helper/JqueryEngineHelperTest.php
index e1b644d84..4823f1ec5 100644
--- a/lib/Cake/Test/Case/View/Helper/JqueryEngineHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/JqueryEngineHelperTest.php
@@ -4,7 +4,7 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
diff --git a/lib/Cake/Test/Case/View/Helper/JsHelperTest.php b/lib/Cake/Test/Case/View/Helper/JsHelperTest.php
index c9da1ec37..8589850a8 100644
--- a/lib/Cake/Test/Case/View/Helper/JsHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/JsHelperTest.php
@@ -6,14 +6,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php b/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php
index cf1ce7d3f..f75ffd9d1 100644
--- a/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/NumberHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php b/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
index e23c67832..6d06541b0 100644
--- a/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/PaginatorHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/RssHelperTest.php b/lib/Cake/Test/Case/View/Helper/RssHelperTest.php
index d0831319f..bfffdf4fc 100644
--- a/lib/Cake/Test/Case/View/Helper/RssHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/RssHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php b/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php
index 448865361..62fc004a3 100644
--- a/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/SessionHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php
index 954d56a55..7538f2094 100644
--- a/lib/Cake/Test/Case/View/Helper/TextHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/TextHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php b/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php
index 899cac45c..ad03fe9eb 100644
--- a/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php
+++ b/lib/Cake/Test/Case/View/Helper/TimeHelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View.Helper
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/HelperCollectionTest.php b/lib/Cake/Test/Case/View/HelperCollectionTest.php
index a7f222d50..eae0ce372 100644
--- a/lib/Cake/Test/Case/View/HelperCollectionTest.php
+++ b/lib/Cake/Test/Case/View/HelperCollectionTest.php
@@ -11,7 +11,7 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/HelperTest.php b/lib/Cake/Test/Case/View/HelperTest.php
index 63f32b0b7..65d9d8eb5 100644
--- a/lib/Cake/Test/Case/View/HelperTest.php
+++ b/lib/Cake/Test/Case/View/HelperTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/JsonViewTest.php b/lib/Cake/Test/Case/View/JsonViewTest.php
index f384ee6ba..39a3e7a1d 100644
--- a/lib/Cake/Test/Case/View/JsonViewTest.php
+++ b/lib/Cake/Test/Case/View/JsonViewTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 2.1.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/MediaViewTest.php b/lib/Cake/Test/Case/View/MediaViewTest.php
index a9f6c3ade..3b723c0bf 100644
--- a/lib/Cake/Test/Case/View/MediaViewTest.php
+++ b/lib/Cake/Test/Case/View/MediaViewTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/ScaffoldViewTest.php b/lib/Cake/Test/Case/View/ScaffoldViewTest.php
index db5ce096a..bc1c1be9a 100644
--- a/lib/Cake/Test/Case/View/ScaffoldViewTest.php
+++ b/lib/Cake/Test/Case/View/ScaffoldViewTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.Controller
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/ThemeViewTest.php b/lib/Cake/Test/Case/View/ThemeViewTest.php
index db1265c96..07ddb2562 100644
--- a/lib/Cake/Test/Case/View/ThemeViewTest.php
+++ b/lib/Cake/Test/Case/View/ThemeViewTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php
index ccc448b32..ce4e1252e 100644
--- a/lib/Cake/Test/Case/View/ViewTest.php
+++ b/lib/Cake/Test/Case/View/ViewTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Case/View/XmlViewTest.php b/lib/Cake/Test/Case/View/XmlViewTest.php
index 51243ccb1..9cf3b9ae0 100644
--- a/lib/Cake/Test/Case/View/XmlViewTest.php
+++ b/lib/Cake/Test/Case/View/XmlViewTest.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Case.View
* @since CakePHP(tm) v 2.1.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AccountFixture.php b/lib/Cake/Test/Fixture/AccountFixture.php
index fd8614f56..f4619332d 100644
--- a/lib/Cake/Test/Fixture/AccountFixture.php
+++ b/lib/Cake/Test/Fixture/AccountFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AcoActionFixture.php b/lib/Cake/Test/Fixture/AcoActionFixture.php
index 56d802842..df1bd22a6 100644
--- a/lib/Cake/Test/Fixture/AcoActionFixture.php
+++ b/lib/Cake/Test/Fixture/AcoActionFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AcoFixture.php b/lib/Cake/Test/Fixture/AcoFixture.php
index 02021c952..d80d3dd08 100644
--- a/lib/Cake/Test/Fixture/AcoFixture.php
+++ b/lib/Cake/Test/Fixture/AcoFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AcoTwoFixture.php b/lib/Cake/Test/Fixture/AcoTwoFixture.php
index ef01fcde4..af399fa3a 100644
--- a/lib/Cake/Test/Fixture/AcoTwoFixture.php
+++ b/lib/Cake/Test/Fixture/AcoTwoFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AdvertisementFixture.php b/lib/Cake/Test/Fixture/AdvertisementFixture.php
index 2f4c58e68..3d4f7cb03 100644
--- a/lib/Cake/Test/Fixture/AdvertisementFixture.php
+++ b/lib/Cake/Test/Fixture/AdvertisementFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AnotherArticleFixture.php b/lib/Cake/Test/Fixture/AnotherArticleFixture.php
index 82ae3cbc1..f580b20a6 100644
--- a/lib/Cake/Test/Fixture/AnotherArticleFixture.php
+++ b/lib/Cake/Test/Fixture/AnotherArticleFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AppleFixture.php b/lib/Cake/Test/Fixture/AppleFixture.php
index 7f1f491db..a63da6bca 100644
--- a/lib/Cake/Test/Fixture/AppleFixture.php
+++ b/lib/Cake/Test/Fixture/AppleFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArmorFixture.php b/lib/Cake/Test/Fixture/ArmorFixture.php
index 30576a50a..135087d2d 100644
--- a/lib/Cake/Test/Fixture/ArmorFixture.php
+++ b/lib/Cake/Test/Fixture/ArmorFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 2.1
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArmorsPlayerFixture.php b/lib/Cake/Test/Fixture/ArmorsPlayerFixture.php
index 56ac88c09..bdd71c524 100644
--- a/lib/Cake/Test/Fixture/ArmorsPlayerFixture.php
+++ b/lib/Cake/Test/Fixture/ArmorsPlayerFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 2.1
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AroFixture.php b/lib/Cake/Test/Fixture/AroFixture.php
index 4e6b61a0a..6d63c4d65 100644
--- a/lib/Cake/Test/Fixture/AroFixture.php
+++ b/lib/Cake/Test/Fixture/AroFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AroTwoFixture.php b/lib/Cake/Test/Fixture/AroTwoFixture.php
index af82f1be0..306567a53 100644
--- a/lib/Cake/Test/Fixture/AroTwoFixture.php
+++ b/lib/Cake/Test/Fixture/AroTwoFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArosAcoFixture.php b/lib/Cake/Test/Fixture/ArosAcoFixture.php
index cf3a720cb..0f2ec84f8 100644
--- a/lib/Cake/Test/Fixture/ArosAcoFixture.php
+++ b/lib/Cake/Test/Fixture/ArosAcoFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArosAcoTwoFixture.php b/lib/Cake/Test/Fixture/ArosAcoTwoFixture.php
index 9bacb19da..e852287f1 100644
--- a/lib/Cake/Test/Fixture/ArosAcoTwoFixture.php
+++ b/lib/Cake/Test/Fixture/ArosAcoTwoFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArticleFeaturedFixture.php b/lib/Cake/Test/Fixture/ArticleFeaturedFixture.php
index 181535076..52831f491 100644
--- a/lib/Cake/Test/Fixture/ArticleFeaturedFixture.php
+++ b/lib/Cake/Test/Fixture/ArticleFeaturedFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArticleFeaturedsTagsFixture.php b/lib/Cake/Test/Fixture/ArticleFeaturedsTagsFixture.php
index 462413b22..3ae0acf1f 100644
--- a/lib/Cake/Test/Fixture/ArticleFeaturedsTagsFixture.php
+++ b/lib/Cake/Test/Fixture/ArticleFeaturedsTagsFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArticleFixture.php b/lib/Cake/Test/Fixture/ArticleFixture.php
index 1b82033d0..617a3ad41 100644
--- a/lib/Cake/Test/Fixture/ArticleFixture.php
+++ b/lib/Cake/Test/Fixture/ArticleFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/ArticlesTagFixture.php b/lib/Cake/Test/Fixture/ArticlesTagFixture.php
index bb63463bb..37908b50a 100644
--- a/lib/Cake/Test/Fixture/ArticlesTagFixture.php
+++ b/lib/Cake/Test/Fixture/ArticlesTagFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AttachmentFixture.php b/lib/Cake/Test/Fixture/AttachmentFixture.php
index 8e3143455..e322c1ac8 100644
--- a/lib/Cake/Test/Fixture/AttachmentFixture.php
+++ b/lib/Cake/Test/Fixture/AttachmentFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AuthUserCustomFieldFixture.php b/lib/Cake/Test/Fixture/AuthUserCustomFieldFixture.php
index 8b3e62fef..88ec58656 100644
--- a/lib/Cake/Test/Fixture/AuthUserCustomFieldFixture.php
+++ b/lib/Cake/Test/Fixture/AuthUserCustomFieldFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.1.8013
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AuthUserFixture.php b/lib/Cake/Test/Fixture/AuthUserFixture.php
index a205ff5eb..eab2a399f 100644
--- a/lib/Cake/Test/Fixture/AuthUserFixture.php
+++ b/lib/Cake/Test/Fixture/AuthUserFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/AuthorFixture.php b/lib/Cake/Test/Fixture/AuthorFixture.php
index a2ebe8ac9..02a191fb1 100644
--- a/lib/Cake/Test/Fixture/AuthorFixture.php
+++ b/lib/Cake/Test/Fixture/AuthorFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests
+ * CakePHP(tm) Tests
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
- * @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
+ * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests
* @package Cake.Test.Fixture
* @since CakePHP(tm) v 1.2.0.4667
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
diff --git a/lib/Cake/Test/Fixture/BakeArticleFixture.php b/lib/Cake/Test/Fixture/BakeArticleFixture.php
index c4eb9f78e..8b322fa90 100644
--- a/lib/Cake/Test/Fixture/BakeArticleFixture.php
+++ b/lib/Cake/Test/Fixture/BakeArticleFixture.php
@@ -4,14 +4,14 @@
*
* PHP 5
*
- * CakePHP(tm) Tests