mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.0' into 2.1
Conflicts: lib/Cake/Config/config.php lib/Cake/Console/Command/Task/ModelTask.php lib/Cake/Console/Command/TestsuiteShell.php lib/Cake/Model/CakeSchema.php lib/Cake/Model/Datasource/Database/Sqlite.php lib/Cake/Test/Case/Model/ModelTestBase.php lib/Cake/Test/Case/Routing/DispatcherTest.php lib/Cake/Test/Case/Utility/FileTest.php lib/Cake/VERSION.txt
This commit is contained in:
commit
6d269ce25d
168 changed files with 1504 additions and 765 deletions
|
@ -24,7 +24,7 @@ App::uses('Debugger', 'Utility');
|
||||||
<p>For updates and important announcements, visit http://cakefest.org</p>
|
<p>For updates and important announcements, visit http://cakefest.org</p>
|
||||||
</iframe>
|
</iframe>
|
||||||
<h2><?php echo __d('cake_dev', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2>
|
<h2><?php echo __d('cake_dev', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2>
|
||||||
<a href="http://cakephp.org/changelogs/2.0.3"><?php __d('cake_dev', 'Read the changelog'); ?> </a>
|
<a href="http://cakephp.org/changelogs/2.0.4"><?php __d('cake_dev', 'Read the changelog'); ?> </a>
|
||||||
<?php
|
<?php
|
||||||
if (Configure::read('debug') > 0):
|
if (Configure::read('debug') > 0):
|
||||||
Debugger::checkSecurityKeys();
|
Debugger::checkSecurityKeys();
|
||||||
|
|
|
@ -285,7 +285,7 @@ class Cache {
|
||||||
$settings = self::settings($config);
|
$settings = self::settings($config);
|
||||||
|
|
||||||
if (empty($settings)) {
|
if (empty($settings)) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
if (!self::isInitialized($config)) {
|
if (!self::isInitialized($config)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -335,7 +335,7 @@ class Cache {
|
||||||
$settings = self::settings($config);
|
$settings = self::settings($config);
|
||||||
|
|
||||||
if (empty($settings)) {
|
if (empty($settings)) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
if (!self::isInitialized($config)) {
|
if (!self::isInitialized($config)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -360,7 +360,7 @@ class Cache {
|
||||||
$settings = self::settings($config);
|
$settings = self::settings($config);
|
||||||
|
|
||||||
if (empty($settings)) {
|
if (empty($settings)) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
if (!self::isInitialized($config)) {
|
if (!self::isInitialized($config)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -387,7 +387,7 @@ class Cache {
|
||||||
$settings = self::settings($config);
|
$settings = self::settings($config);
|
||||||
|
|
||||||
if (empty($settings)) {
|
if (empty($settings)) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
if (!self::isInitialized($config)) {
|
if (!self::isInitialized($config)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -422,7 +422,7 @@ class Cache {
|
||||||
$settings = self::settings($config);
|
$settings = self::settings($config);
|
||||||
|
|
||||||
if (empty($settings)) {
|
if (empty($settings)) {
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
if (!self::isInitialized($config)) {
|
if (!self::isInitialized($config)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -505,7 +505,7 @@ abstract class CacheEngine {
|
||||||
*/
|
*/
|
||||||
public function init($settings = array()) {
|
public function init($settings = array()) {
|
||||||
$this->settings = array_merge(
|
$this->settings = array_merge(
|
||||||
array('prefix' => 'cake_', 'duration'=> 3600, 'probability'=> 100),
|
array('prefix' => 'cake_', 'duration' => 3600, 'probability' => 100),
|
||||||
$this->settings,
|
$this->settings,
|
||||||
$settings
|
$settings
|
||||||
);
|
);
|
||||||
|
|
|
@ -66,8 +66,8 @@ class FileEngine extends CacheEngine {
|
||||||
public function init($settings = array()) {
|
public function init($settings = array()) {
|
||||||
parent::init(array_merge(
|
parent::init(array_merge(
|
||||||
array(
|
array(
|
||||||
'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> true,
|
'engine' => 'File', 'path' => CACHE, 'prefix' => 'cake_', 'lock' => true,
|
||||||
'serialize'=> true, 'isWindows' => false, 'mask' => 0664
|
'serialize' => true, 'isWindows' => false, 'mask' => 0664
|
||||||
),
|
),
|
||||||
$settings
|
$settings
|
||||||
));
|
));
|
||||||
|
@ -84,7 +84,7 @@ class FileEngine extends CacheEngine {
|
||||||
/**
|
/**
|
||||||
* Garbage collection. Permanently remove all expired and deleted data
|
* Garbage collection. Permanently remove all expired and deleted data
|
||||||
*
|
*
|
||||||
* @return boolean True if garbage collection was succesful, false on failure
|
* @return boolean True if garbage collection was successful, false on failure
|
||||||
*/
|
*/
|
||||||
public function gc() {
|
public function gc() {
|
||||||
return $this->clear(true);
|
return $this->clear(true);
|
||||||
|
@ -273,7 +273,7 @@ class FileEngine extends CacheEngine {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current cache key this class is managing, and creates a writable SplFileObject
|
* Sets the current cache key this class is managing, and creates a writable SplFileObject
|
||||||
* for the cache file the key is refering to.
|
* for the cache file the key is referring to.
|
||||||
*
|
*
|
||||||
* @param string $key The key
|
* @param string $key The key
|
||||||
* @param boolean $createKey Whether the key should be created if it doesn't exists, or not
|
* @param boolean $createKey Whether the key should be created if it doesn't exists, or not
|
||||||
|
|
|
@ -59,10 +59,10 @@ class MemcacheEngine extends CacheEngine {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
parent::init(array_merge(array(
|
parent::init(array_merge(array(
|
||||||
'engine'=> 'Memcache',
|
'engine' => 'Memcache',
|
||||||
'prefix' => Inflector::slug(APP_DIR) . '_',
|
'prefix' => Inflector::slug(APP_DIR) . '_',
|
||||||
'servers' => array('127.0.0.1'),
|
'servers' => array('127.0.0.1'),
|
||||||
'compress'=> false,
|
'compress' => false,
|
||||||
'persistent' => true
|
'persistent' => true
|
||||||
), $settings)
|
), $settings)
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('ComponentCollection', 'Controller');
|
App::uses('ComponentCollection', 'Controller');
|
||||||
App::uses('AclComponent', 'Controller/Component');
|
App::uses('AclComponent', 'Controller/Component');
|
||||||
App::uses('DbAcl', 'Model');
|
App::uses('DbAcl', 'Model');
|
||||||
|
@ -25,7 +27,7 @@ App::uses('DbAcl', 'Model');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
class AclShell extends Shell {
|
class AclShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains instance of AclComponent
|
* Contains instance of AclComponent
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('File', 'Utility');
|
App::uses('File', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +26,7 @@ App::uses('File', 'Utility');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
class ApiShell extends Shell {
|
class ApiShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map between short name for paths and real paths.
|
* Map between short name for paths and real paths.
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a placeholder class.
|
* This is a placeholder class.
|
||||||
* Create the same file in app/Console/Command/AppShell.php
|
* Create the same file in app/Console/Command/AppShell.php
|
|
@ -20,6 +20,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +29,7 @@ App::uses('Model', 'Model');
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
|
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html
|
||||||
*/
|
*/
|
||||||
class BakeShell extends Shell {
|
class BakeShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains tasks to load and instantiate
|
* Contains tasks to load and instantiate
|
||||||
|
@ -184,7 +185,7 @@ class BakeShell extends Shell {
|
||||||
}
|
}
|
||||||
App::uses($controller . 'Controller', 'Controller');
|
App::uses($controller . 'Controller', 'Controller');
|
||||||
if (class_exists($controller . 'Controller')) {
|
if (class_exists($controller . 'Controller')) {
|
||||||
$this->View->args = array($controller);
|
$this->View->args = array($name);
|
||||||
$this->View->execute();
|
$this->View->execute();
|
||||||
}
|
}
|
||||||
$this->out('', 1, Shell::QUIET);
|
$this->out('', 1, Shell::QUIET);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('Inflector', 'Utility');
|
App::uses('Inflector', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +25,7 @@ App::uses('Inflector', 'Utility');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
class CommandListShell extends Shell {
|
class CommandListShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* startup
|
* startup
|
||||||
|
@ -80,13 +81,15 @@ class CommandListShell extends Shell {
|
||||||
*/
|
*/
|
||||||
protected function _getShellList() {
|
protected function _getShellList() {
|
||||||
$shellList = array();
|
$shellList = array();
|
||||||
|
$skipFiles = array('AppShell');
|
||||||
|
|
||||||
$corePath = App::core('Console/Command');
|
$corePath = App::core('Console/Command');
|
||||||
$shells = App::objects('file', $corePath[0]);
|
$shells = App::objects('file', $corePath[0]);
|
||||||
|
$shells = array_diff($shells, $skipFiles);
|
||||||
$shellList = $this->_appendShells('CORE', $shells, $shellList);
|
$shellList = $this->_appendShells('CORE', $shells, $shellList);
|
||||||
|
|
||||||
$appShells = App::objects('Console/Command', null, false);
|
$appShells = App::objects('Console/Command', null, false);
|
||||||
$appShells = array_diff($appShells, $shells);
|
$appShells = array_diff($appShells, $shells, $skipFiles);
|
||||||
$shellList = $this->_appendShells('app', $appShells, $shellList);
|
$shellList = $this->_appendShells('app', $appShells, $shellList);
|
||||||
|
|
||||||
$plugins = CakePlugin::loaded();
|
$plugins = CakePlugin::loaded();
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a very basic 'interactive' console for CakePHP apps.
|
* Provides a very basic 'interactive' console for CakePHP apps.
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
class ConsoleShell extends Shell {
|
class ConsoleShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available binding types
|
* Available binding types
|
||||||
|
@ -86,7 +88,7 @@ class ConsoleShell extends Shell {
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
$out .= 'To dynamically set associations, you can do the following:';
|
$out .= 'To dynamically set associations, you can do the following:';
|
||||||
$out .= "\tModelA bind <association> ModelB";
|
$out .= "\tModelA bind <association> ModelB";
|
||||||
$out .= "where the supported assocations are hasOne, hasMany, belongsTo, hasAndBelongsToMany";
|
$out .= "where the supported associations are hasOne, hasMany, belongsTo, hasAndBelongsToMany";
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
$out .= 'To dynamically remove associations, you can do the following:';
|
$out .= 'To dynamically remove associations, you can do the following:';
|
||||||
$out .= "\t ModelA unbind <association> ModelB";
|
$out .= "\t ModelA unbind <association> ModelB";
|
||||||
|
@ -115,7 +117,7 @@ class ConsoleShell extends Shell {
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
$out .= "will return something like the following:";
|
$out .= "will return something like the following:";
|
||||||
$out .= "\n";
|
$out .= "\n";
|
||||||
$out .= "\tarray (";
|
$out .= "\tarray(";
|
||||||
$out .= "\t [...]";
|
$out .= "\t [...]";
|
||||||
$out .= "\t 'controller' => 'posts',";
|
$out .= "\t 'controller' => 'posts',";
|
||||||
$out .= "\t 'action' => 'view',";
|
$out .= "\t 'action' => 'view',";
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shell for I18N management.
|
* Shell for I18N management.
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
class I18nShell extends Shell {
|
class I18nShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains database source to use
|
* Contains database source to use
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5550
|
* @since CakePHP(tm) v 1.2.0.5550
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('File', 'Utility');
|
App::uses('File', 'Utility');
|
||||||
App::uses('Folder', 'Utility');
|
App::uses('Folder', 'Utility');
|
||||||
App::uses('CakeSchema', 'Model');
|
App::uses('CakeSchema', 'Model');
|
||||||
|
@ -28,7 +30,7 @@ App::uses('CakeSchema', 'Model');
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
|
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
|
||||||
*/
|
*/
|
||||||
class SchemaShell extends Shell {
|
class SchemaShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schema class being used.
|
* Schema class being used.
|
||||||
|
@ -64,7 +66,7 @@ class SchemaShell extends Shell {
|
||||||
$name = $path = $connection = $plugin = null;
|
$name = $path = $connection = $plugin = null;
|
||||||
if (!empty($this->params['name'])) {
|
if (!empty($this->params['name'])) {
|
||||||
$name = $this->params['name'];
|
$name = $this->params['name'];
|
||||||
} elseif (!empty($this->args[0])) {
|
} elseif (!empty($this->args[0]) && $this->args[0] !== 'snapshot') {
|
||||||
$name = $this->params['name'] = $this->args[0];
|
$name = $this->params['name'] = $this->args[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +160,7 @@ class SchemaShell extends Shell {
|
||||||
Configure::write('Cache.disable', $cacheDisable);
|
Configure::write('Cache.disable', $cacheDisable);
|
||||||
|
|
||||||
if ($snapshot === true) {
|
if ($snapshot === true) {
|
||||||
|
$fileName = rtrim($this->params['file'], '.php');
|
||||||
$Folder = new Folder($this->Schema->path);
|
$Folder = new Folder($this->Schema->path);
|
||||||
$result = $Folder->read();
|
$result = $Folder->read();
|
||||||
|
|
||||||
|
@ -169,7 +172,7 @@ class SchemaShell extends Shell {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
if (!empty($result[1])) {
|
if (!empty($result[1])) {
|
||||||
foreach ($result[1] as $file) {
|
foreach ($result[1] as $file) {
|
||||||
if (preg_match('/schema(?:[_\d]*)?\.php$/', $file)) {
|
if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) {
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +184,6 @@ class SchemaShell extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileName = rtrim($this->params['file'], '.php');
|
|
||||||
$content['file'] = $fileName . '_' . $count . '.php';
|
$content['file'] = $fileName . '_' . $count . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('Shell', 'Console');
|
App::uses('AppShell', 'Console/Command');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Bake Tasks.
|
* Base class for Bake Tasks.
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command.Task
|
* @package Cake.Console.Command.Task
|
||||||
*/
|
*/
|
||||||
class BakeTask extends Shell {
|
class BakeTask extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of plugin
|
* Name of plugin
|
||||||
|
@ -78,7 +79,7 @@ class BakeTask extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
foreach($this->args as $i => $arg) {
|
foreach ($this->args as $i => $arg) {
|
||||||
if (strpos($arg, '.')) {
|
if (strpos($arg, '.')) {
|
||||||
list($this->params['plugin'], $this->args[$i]) = pluginSplit($arg);
|
list($this->params['plugin'], $this->args[$i]) = pluginSplit($arg);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,14 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task class for creating and updating the database configuration file.
|
* Task class for creating and updating the database configuration file.
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command.Task
|
* @package Cake.Console.Command.Task
|
||||||
*/
|
*/
|
||||||
class DbConfigTask extends Shell {
|
class DbConfigTask extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path to CONFIG directory
|
* path to CONFIG directory
|
||||||
|
@ -37,14 +39,14 @@ class DbConfigTask extends Shell {
|
||||||
*/
|
*/
|
||||||
protected $_defaultConfig = array(
|
protected $_defaultConfig = array(
|
||||||
'name' => 'default',
|
'name' => 'default',
|
||||||
'datasource'=> 'Database/Mysql',
|
'datasource' => 'Database/Mysql',
|
||||||
'persistent'=> 'false',
|
'persistent' => 'false',
|
||||||
'host'=> 'localhost',
|
'host' => 'localhost',
|
||||||
'login'=> 'root',
|
'login' => 'root',
|
||||||
'password'=> 'password',
|
'password' => 'password',
|
||||||
'database'=> 'project_name',
|
'database' => 'project_name',
|
||||||
'schema'=> null,
|
'schema' => null,
|
||||||
'prefix'=> null,
|
'prefix' => null,
|
||||||
'encoding' => null,
|
'encoding' => null,
|
||||||
'port' => null
|
'port' => null
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('File', 'Utility');
|
App::uses('File', 'Utility');
|
||||||
App::uses('Folder', 'Utility');
|
App::uses('Folder', 'Utility');
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ App::uses('Folder', 'Utility');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command.Task
|
* @package Cake.Console.Command.Task
|
||||||
*/
|
*/
|
||||||
class ExtractTask extends Shell {
|
class ExtractTask extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paths to use when looking for strings
|
* Paths to use when looking for strings
|
||||||
|
@ -162,7 +164,7 @@ class ExtractTask extends Shell {
|
||||||
} else {
|
} else {
|
||||||
$message = __d('cake_console', "What is the path you would like to output?\n[Q]uit", $this->_paths[0] . DS . 'Locale');
|
$message = __d('cake_console', "What is the path you would like to output?\n[Q]uit", $this->_paths[0] . DS . 'Locale');
|
||||||
while (true) {
|
while (true) {
|
||||||
$response = $this->in($message, null, $this->_paths[0] . DS . 'Locale');
|
$response = $this->in($message, null, rtrim($this->_paths[0], DS) . DS . 'Locale');
|
||||||
if (strtoupper($response) === 'Q') {
|
if (strtoupper($response) === 'Q') {
|
||||||
$this->out(__d('cake_console', 'Extract Aborted'));
|
$this->out(__d('cake_console', 'Extract Aborted'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
|
@ -187,6 +189,7 @@ class ExtractTask extends Shell {
|
||||||
if (empty($this->_files)) {
|
if (empty($this->_files)) {
|
||||||
$this->_searchFiles();
|
$this->_searchFiles();
|
||||||
}
|
}
|
||||||
|
$this->_output = rtrim($this->_output, DS) . DS;
|
||||||
$this->_extract();
|
$this->_extract();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ class FixtureTask extends BakeTask {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execution method always used for tasks
|
* Execution method always used for tasks
|
||||||
* Handles dispatching to interactive, named, or all processeses.
|
* Handles dispatching to interactive, named, or all processes.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -279,7 +280,7 @@ class FixtureTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
protected function _generateSchema($tableInfo) {
|
protected function _generateSchema($tableInfo) {
|
||||||
$schema = $this->_Schema->generateTable('f', $tableInfo);
|
$schema = $this->_Schema->generateTable('f', $tableInfo);
|
||||||
return substr($schema, 10, -2);
|
return substr($schema, 13, -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
App::uses('ConnectionManager', 'Model');
|
App::uses('ConnectionManager', 'Model');
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
|
@ -56,6 +57,13 @@ class ModelTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
protected $_tables = array();
|
protected $_tables = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the model names
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_modelNames = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds validation method map.
|
* Holds validation method map.
|
||||||
*
|
*
|
||||||
|
@ -117,9 +125,9 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
$modelClass = Inflector::classify($table);
|
$modelClass = Inflector::classify($table);
|
||||||
$this->out(__d('cake_console', 'Baking %s', $modelClass));
|
$this->out(__d('cake_console', 'Baking %s', $modelClass));
|
||||||
$object = $this->_getModelObject($modelClass);
|
$object = $this->_getModelObject($modelClass, $table);
|
||||||
if ($this->bake($object, false) && $unitTestExists) {
|
if ($this->bake($object, false) && $unitTestExists) {
|
||||||
$this->bakeFixture($modelClass);
|
$this->bakeFixture($modelClass, $table);
|
||||||
$this->bakeTest($modelClass);
|
$this->bakeTest($modelClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,11 +140,18 @@ class ModelTask extends BakeTask {
|
||||||
* @param string $table Table name
|
* @param string $table Table name
|
||||||
* @return Model Model instance
|
* @return Model Model instance
|
||||||
*/
|
*/
|
||||||
protected function &_getModelObject($className, $table = null) {
|
protected function _getModelObject($className, $table = null) {
|
||||||
if (!$table) {
|
if (!$table) {
|
||||||
$table = Inflector::tableize($className);
|
$table = Inflector::tableize($className);
|
||||||
}
|
}
|
||||||
$object = new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection));
|
$object = new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection));
|
||||||
|
$fields = $object->schema(true);
|
||||||
|
foreach ($fields as $name => $field) {
|
||||||
|
if (isset($field['key']) && $field['key'] == 'primary') {
|
||||||
|
$object->primaryKey = $name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +269,7 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y');
|
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');
|
||||||
|
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$vars = compact('associations', 'validate', 'primaryKey', 'useTable', 'displayField');
|
$vars = compact('associations', 'validate', 'primaryKey', 'useTable', 'displayField');
|
||||||
|
@ -294,6 +309,7 @@ class ModelTask extends BakeTask {
|
||||||
* @return string Name of field that is a primary key.
|
* @return string Name of field that is a primary key.
|
||||||
*/
|
*/
|
||||||
public function findPrimaryKey($fields) {
|
public function findPrimaryKey($fields) {
|
||||||
|
$name = 'id';
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
if (isset($field['key']) && $field['key'] == 'primary') {
|
if (isset($field['key']) && $field['key'] == 'primary') {
|
||||||
break;
|
break;
|
||||||
|
@ -462,7 +478,7 @@ class ModelTask extends BakeTask {
|
||||||
* Handles associations
|
* Handles associations
|
||||||
*
|
*
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @return array $assocaitons
|
* @return array $associations
|
||||||
*/
|
*/
|
||||||
public function doAssociations($model) {
|
public function doAssociations($model) {
|
||||||
if (!is_object($model)) {
|
if (!is_object($model)) {
|
||||||
|
@ -474,7 +490,7 @@ class ModelTask extends BakeTask {
|
||||||
|
|
||||||
$fields = $model->schema(true);
|
$fields = $model->schema(true);
|
||||||
if (empty($fields)) {
|
if (empty($fields)) {
|
||||||
return false;
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->_tables)) {
|
if (empty($this->_tables)) {
|
||||||
|
@ -482,7 +498,7 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
$associations = array(
|
$associations = array(
|
||||||
'belongsTo' => array(), 'hasMany' => array(), 'hasOne'=> array(), 'hasAndBelongsToMany' => array()
|
'belongsTo' => array(), 'hasMany' => array(), 'hasOne' => array(), 'hasAndBelongsToMany' => array()
|
||||||
);
|
);
|
||||||
|
|
||||||
$associations = $this->findBelongsTo($model, $associations);
|
$associations = $this->findBelongsTo($model, $associations);
|
||||||
|
@ -511,7 +527,7 @@ class ModelTask extends BakeTask {
|
||||||
* Find belongsTo relations and add them to the associations list.
|
* Find belongsTo relations and add them to the associations list.
|
||||||
*
|
*
|
||||||
* @param Model $model Model instance of model being generated.
|
* @param Model $model Model instance of model being generated.
|
||||||
* @param array $associations Array of inprogress associations
|
* @param array $associations Array of in progress associations
|
||||||
* @return array $associations with belongsTo added in.
|
* @return array $associations with belongsTo added in.
|
||||||
*/
|
*/
|
||||||
public function findBelongsTo($model, $associations) {
|
public function findBelongsTo($model, $associations) {
|
||||||
|
@ -540,7 +556,7 @@ class ModelTask extends BakeTask {
|
||||||
* Find the hasOne and HasMany relations and add them to associations list
|
* Find the hasOne and HasMany relations and add them to associations list
|
||||||
*
|
*
|
||||||
* @param Model $model Model instance being generated
|
* @param Model $model Model instance being generated
|
||||||
* @param array $associations Array of inprogress associations
|
* @param array $associations Array of in progress associations
|
||||||
* @return array $associations with hasOne and hasMany added in.
|
* @return array $associations with hasOne and hasMany added in.
|
||||||
*/
|
*/
|
||||||
public function findHasOneAndMany($model, $associations) {
|
public function findHasOneAndMany($model, $associations) {
|
||||||
|
@ -631,7 +647,7 @@ class ModelTask extends BakeTask {
|
||||||
if (!empty($associations[$type])) {
|
if (!empty($associations[$type])) {
|
||||||
foreach ($associations[$type] as $i => $assoc) {
|
foreach ($associations[$type] as $i => $assoc) {
|
||||||
$prompt = "{$model->name} {$type} {$assoc['alias']}?";
|
$prompt = "{$model->name} {$type} {$assoc['alias']}?";
|
||||||
$response = $this->in($prompt, array('y','n'), 'y');
|
$response = $this->in($prompt, array('y', 'n'), 'y');
|
||||||
|
|
||||||
if ('n' == strtolower($response)) {
|
if ('n' == strtolower($response)) {
|
||||||
unset($associations[$type][$i]);
|
unset($associations[$type][$i]);
|
||||||
|
@ -654,7 +670,7 @@ class ModelTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function doMoreAssociations($model, $associations) {
|
public function doMoreAssociations($model, $associations) {
|
||||||
$prompt = __d('cake_console', 'Would you like to define some additional model associations?');
|
$prompt = __d('cake_console', 'Would you like to define some additional model associations?');
|
||||||
$wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n');
|
$wannaDoMoreAssoc = $this->in($prompt, array('y', 'n'), 'n');
|
||||||
$possibleKeys = $this->_generatePossibleKeys();
|
$possibleKeys = $this->_generatePossibleKeys();
|
||||||
while (strtolower($wannaDoMoreAssoc) == 'y') {
|
while (strtolower($wannaDoMoreAssoc) == 'y') {
|
||||||
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||||
|
@ -715,7 +731,7 @@ class ModelTask extends BakeTask {
|
||||||
$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
|
$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
|
||||||
$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
|
$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
|
||||||
}
|
}
|
||||||
$wannaDoMoreAssoc = $this->in(__d('cake_console', 'Define another association?'), array('y','n'), 'y');
|
$wannaDoMoreAssoc = $this->in(__d('cake_console', 'Define another association?'), array('y', 'n'), 'y');
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
@ -749,8 +765,8 @@ class ModelTask extends BakeTask {
|
||||||
public function bake($name, $data = array()) {
|
public function bake($name, $data = array()) {
|
||||||
if (is_object($name)) {
|
if (is_object($name)) {
|
||||||
if ($data == false) {
|
if ($data == false) {
|
||||||
$data = $associations = array();
|
$data = array();
|
||||||
$data['associations'] = $this->doAssociations($name, $associations);
|
$data['associations'] = $this->doAssociations($name);
|
||||||
$data['validate'] = $this->doValidation($name);
|
$data['validate'] = $this->doValidation($name);
|
||||||
}
|
}
|
||||||
$data['primaryKey'] = $name->primaryKey;
|
$data['primaryKey'] = $name->primaryKey;
|
||||||
|
@ -832,13 +848,17 @@ class ModelTask extends BakeTask {
|
||||||
|
|
||||||
$db = ConnectionManager::getDataSource($useDbConfig);
|
$db = ConnectionManager::getDataSource($useDbConfig);
|
||||||
$useTable = Inflector::tableize($modelName);
|
$useTable = Inflector::tableize($modelName);
|
||||||
|
if (in_array($modelName, $this->_modelNames)) {
|
||||||
|
$modelNames = array_flip($this->_modelNames);
|
||||||
|
$useTable = $this->_tables[$modelNames[$modelName]];
|
||||||
|
}
|
||||||
$fullTableName = $db->fullTableName($useTable, false);
|
$fullTableName = $db->fullTableName($useTable, false);
|
||||||
$tableIsGood = false;
|
$tableIsGood = false;
|
||||||
|
|
||||||
if (array_search($useTable, $this->_tables) === false) {
|
if (array_search($useTable, $this->_tables) === false) {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
|
$this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
|
||||||
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y','n'), 'y');
|
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
|
||||||
}
|
}
|
||||||
if (strtolower($tableIsGood) == 'n') {
|
if (strtolower($tableIsGood) == 'n') {
|
||||||
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
|
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('File', 'Utility');
|
App::uses('File', 'Utility');
|
||||||
App::uses('Folder', 'Utility');
|
App::uses('Folder', 'Utility');
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ App::uses('Folder', 'Utility');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command.Task
|
* @package Cake.Console.Command.Task
|
||||||
*/
|
*/
|
||||||
class PluginTask extends Shell {
|
class PluginTask extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path to plugins directory
|
* path to plugins directory
|
||||||
|
@ -74,7 +75,7 @@ class PluginTask extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->bake($plugin)) {
|
if (!$this->bake($plugin)) {
|
||||||
$this->error(__d('cake_console', "An error occured trying to bake: %s in %s", $plugin, $this->path . $plugin));
|
$this->error(__d('cake_console', "An error occurred trying to bake: %s in %s", $plugin, $this->path . $plugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +159,8 @@ class PluginTask extends Shell {
|
||||||
*/
|
*/
|
||||||
public function findPath($pathOptions) {
|
public function findPath($pathOptions) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
foreach ($pathOptions as $i =>$path) {
|
foreach ($pathOptions as $i => $path) {
|
||||||
if(!is_dir($path)) {
|
if (!is_dir($path)) {
|
||||||
array_splice($pathOptions, $i, 1);
|
array_splice($pathOptions, $i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('File', 'Utility');
|
App::uses('File', 'Utility');
|
||||||
App::uses('Folder', 'Utility');
|
App::uses('Folder', 'Utility');
|
||||||
App::uses('String', 'Utility');
|
App::uses('String', 'Utility');
|
||||||
|
@ -27,7 +28,7 @@ App::uses('Security', 'Utility');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command.Task
|
* @package Cake.Console.Command.Task
|
||||||
*/
|
*/
|
||||||
class ProjectTask extends Shell {
|
class ProjectTask extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configs path (used in testing).
|
* configs path (used in testing).
|
||||||
|
@ -61,7 +62,7 @@ class ProjectTask extends Shell {
|
||||||
$response = false;
|
$response = false;
|
||||||
while ($response == false && is_dir($project) === true && file_exists($project . 'Config' . 'core.php')) {
|
while ($response == false && is_dir($project) === true && file_exists($project . 'Config' . 'core.php')) {
|
||||||
$prompt = __d('cake_console', '<warning>A project already exists in this location:</warning> %s Overwrite?', $project);
|
$prompt = __d('cake_console', '<warning>A project already exists in this location:</warning> %s Overwrite?', $project);
|
||||||
$response = $this->in($prompt, array('y','n'), 'n');
|
$response = $this->in($prompt, array('y', 'n'), 'n');
|
||||||
if (strtolower($response) === 'n') {
|
if (strtolower($response) === 'n') {
|
||||||
$response = $project = false;
|
$response = $project = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,16 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('Folder', 'Utility');
|
App::uses('Folder', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template Task can generate templated output Used in other Tasks.
|
* Template Task can generate templated output Used in other Tasks.
|
||||||
* Acts like a simplified View class.
|
* Acts like a simplified View class.
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command.Task
|
* @package Cake.Console.Command.Task
|
||||||
*/
|
*/
|
||||||
class TemplateTask extends Shell {
|
class TemplateTask extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variables to add to template scope
|
* variables to add to template scope
|
||||||
|
@ -57,7 +59,7 @@ class TemplateTask extends Shell {
|
||||||
* @return array Array of bake themes that are installed.
|
* @return array Array of bake themes that are installed.
|
||||||
*/
|
*/
|
||||||
protected function _findThemes() {
|
protected function _findThemes() {
|
||||||
$paths = App::path('Console');
|
$paths = array();
|
||||||
$core = current(App::core('Console'));
|
$core = current(App::core('Console'));
|
||||||
$separator = DS === '/' ? '/' : '\\\\';
|
$separator = DS === '/' ? '/' : '\\\\';
|
||||||
$core = preg_replace('#shells' . $separator . '$#', '', $core);
|
$core = preg_replace('#shells' . $separator . '$#', '', $core);
|
||||||
|
@ -68,10 +70,12 @@ class TemplateTask extends Shell {
|
||||||
$themeFolders = $contents[0];
|
$themeFolders = $contents[0];
|
||||||
|
|
||||||
$plugins = App::objects('plugin');
|
$plugins = App::objects('plugin');
|
||||||
|
$paths[] = $core;
|
||||||
foreach ($plugins as $plugin) {
|
foreach ($plugins as $plugin) {
|
||||||
$paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
|
$paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
|
||||||
}
|
}
|
||||||
$paths[] = $core;
|
|
||||||
|
$paths = array_merge($paths, App::path('Console'));
|
||||||
|
|
||||||
// TEMPORARY TODO remove when all paths are DS terminated
|
// TEMPORARY TODO remove when all paths are DS terminated
|
||||||
foreach ($paths as $i => $path) {
|
foreach ($paths as $i => $path) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
App::uses('ClassRegistry', 'Utility');
|
App::uses('ClassRegistry', 'Utility');
|
||||||
|
|
||||||
|
@ -405,7 +406,7 @@ class TestTask extends BakeTask {
|
||||||
* @return array Array of fixtures the user wants to add.
|
* @return array Array of fixtures the user wants to add.
|
||||||
*/
|
*/
|
||||||
public function getUserFixtures() {
|
public function getUserFixtures() {
|
||||||
$proceed = $this->in(__d('cake_console', 'Bake could not detect fixtures, would you like to add some?'), array('y','n'), 'n');
|
$proceed = $this->in(__d('cake_console', 'Bake could not detect fixtures, would you like to add some?'), array('y', 'n'), 'n');
|
||||||
$fixtures = array();
|
$fixtures = array();
|
||||||
if (strtolower($proceed) == 'y') {
|
if (strtolower($proceed) == 'y') {
|
||||||
$fixtureList = $this->in(__d('cake_console', "Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'"));
|
$fixtureList = $this->in(__d('cake_console', "Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'"));
|
||||||
|
@ -476,7 +477,7 @@ class TestTask extends BakeTask {
|
||||||
->addArgument('type', array(
|
->addArgument('type', array(
|
||||||
'help' => __d('cake_console', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
|
'help' => __d('cake_console', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
|
||||||
'choices' => array(
|
'choices' => array(
|
||||||
'Controller', 'controller',
|
'Controller', 'controller',
|
||||||
'Model', 'model',
|
'Model', 'model',
|
||||||
'Helper', 'helper',
|
'Helper', 'helper',
|
||||||
'Component', 'component',
|
'Component', 'component',
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('Controller', 'Controller');
|
App::uses('Controller', 'Controller');
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
|
|
||||||
|
@ -214,9 +215,9 @@ class ViewTask extends BakeTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
$prompt = __d('cake_console', "Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).");
|
$prompt = __d('cake_console', "Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).");
|
||||||
$wannaDoScaffold = $this->in($prompt, array('y','n'), 'y');
|
$wannaDoScaffold = $this->in($prompt, array('y', 'n'), 'y');
|
||||||
|
|
||||||
$wannaDoAdmin = $this->in(__d('cake_console', "Would you like to create the views for admin routing?"), array('y','n'), 'n');
|
$wannaDoAdmin = $this->in(__d('cake_console', "Would you like to create the views for admin routing?"), array('y', 'n'), 'n');
|
||||||
|
|
||||||
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') {
|
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') {
|
||||||
$vars = $this->_loadController();
|
$vars = $this->_loadController();
|
||||||
|
@ -291,7 +292,7 @@ class ViewTask extends BakeTask {
|
||||||
$pluralHumanName = $this->_pluralHumanName($this->controllerName);
|
$pluralHumanName = $this->_pluralHumanName($this->controllerName);
|
||||||
|
|
||||||
return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||||
'singularHumanName', 'pluralHumanName', 'fields','associations');
|
'singularHumanName', 'pluralHumanName', 'fields', 'associations');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -329,7 +330,7 @@ class ViewTask extends BakeTask {
|
||||||
$this->out(__d('cake_console', 'Action Name: %s', $action));
|
$this->out(__d('cake_console', 'Action Name: %s', $action));
|
||||||
$this->out(__d('cake_console', 'Path: %s', $this->getPath() . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
|
$this->out(__d('cake_console', 'Path: %s', $this->getPath() . $this->controllerName . DS . Inflector::underscore($action) . ".ctp"));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y','n'), 'y');
|
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$this->bake($action, ' ');
|
$this->bake($action, ' ');
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('TestShell', 'Console/Command');
|
App::uses('TestShell', 'Console/Command');
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
|
App::uses('CakeTestSuiteDispatcher', 'TestSuite');
|
||||||
|
App::uses('CakeTestSuiteCommand', 'TestSuite');
|
||||||
|
App::uses('CakeTestLoader', 'TestSuite');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a CakePHP wrapper around PHPUnit.
|
* Provides a CakePHP wrapper around PHPUnit.
|
||||||
|
@ -26,7 +30,18 @@ App::uses('TestShell', 'Console/Command');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
|
<<<<<<< HEAD
|
||||||
class TestsuiteShell extends TestShell {
|
class TestsuiteShell extends TestShell {
|
||||||
|
=======
|
||||||
|
class TestsuiteShell extends AppShell {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatcher object for the run.
|
||||||
|
*
|
||||||
|
* @var CakeTestDispatcher
|
||||||
|
*/
|
||||||
|
protected $_dispatcher = null;
|
||||||
|
>>>>>>> 2.0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the option parser for the test suite.
|
* get the option parser for the test suite.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses('Folder', 'Utility');
|
App::uses('Folder', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +25,7 @@ App::uses('Folder', 'Utility');
|
||||||
*
|
*
|
||||||
* @package Cake.Console.Command
|
* @package Cake.Console.Command
|
||||||
*/
|
*/
|
||||||
class UpgradeShell extends Shell {
|
class UpgradeShell extends AppShell {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Files
|
* Files
|
||||||
|
@ -82,7 +83,7 @@ class UpgradeShell extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function all() {
|
public function all() {
|
||||||
foreach($this->OptionParser->subcommands() as $command) {
|
foreach ($this->OptionParser->subcommands() as $command) {
|
||||||
$name = $command->name();
|
$name = $command->name();
|
||||||
if ($name === 'all') {
|
if ($name === 'all') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -134,7 +135,7 @@ class UpgradeShell extends Shell {
|
||||||
if (is_dir('plugins')) {
|
if (is_dir('plugins')) {
|
||||||
$Folder = new Folder('plugins');
|
$Folder = new Folder('plugins');
|
||||||
list($plugins) = $Folder->read();
|
list($plugins) = $Folder->read();
|
||||||
foreach($plugins as $plugin) {
|
foreach ($plugins as $plugin) {
|
||||||
chdir($cwd . DS . 'plugins' . DS . $plugin);
|
chdir($cwd . DS . 'plugins' . DS . $plugin);
|
||||||
$this->locations();
|
$this->locations();
|
||||||
}
|
}
|
||||||
|
@ -154,7 +155,7 @@ class UpgradeShell extends Shell {
|
||||||
'Test' . DS . 'fixtures' => 'Test' . DS . 'Fixture',
|
'Test' . DS . 'fixtures' => 'Test' . DS . 'Fixture',
|
||||||
'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates',
|
'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates',
|
||||||
);
|
);
|
||||||
foreach($moves as $old => $new) {
|
foreach ($moves as $old => $new) {
|
||||||
if (is_dir($old)) {
|
if (is_dir($old)) {
|
||||||
$this->out(__d('cake_console', 'Moving %s to %s', $old, $new));
|
$this->out(__d('cake_console', 'Moving %s to %s', $old, $new));
|
||||||
if (!$this->params['dry-run']) {
|
if (!$this->params['dry-run']) {
|
||||||
|
@ -189,7 +190,7 @@ class UpgradeShell extends Shell {
|
||||||
'checkFolder' => true,
|
'checkFolder' => true,
|
||||||
'regex' => '@class (\S*) .*{@i'
|
'regex' => '@class (\S*) .*{@i'
|
||||||
);
|
);
|
||||||
foreach($sourceDirs as $dir => $options) {
|
foreach ($sourceDirs as $dir => $options) {
|
||||||
if (is_numeric($dir)) {
|
if (is_numeric($dir)) {
|
||||||
$dir = $options;
|
$dir = $options;
|
||||||
$options = array();
|
$options = array();
|
||||||
|
@ -613,7 +614,7 @@ class UpgradeShell extends Shell {
|
||||||
$this->_findFiles('php');
|
$this->_findFiles('php');
|
||||||
} else {
|
} else {
|
||||||
$this->_files = scandir($path);
|
$this->_files = scandir($path);
|
||||||
foreach($this->_files as $i => $file) {
|
foreach ($this->_files as $i => $file) {
|
||||||
if (strlen($file) < 5 || substr($file, -4) !== '.php') {
|
if (strlen($file) < 5 || substr($file, -4) !== '.php') {
|
||||||
unset($this->_files[$i]);
|
unset($this->_files[$i]);
|
||||||
}
|
}
|
||||||
|
@ -763,7 +764,7 @@ class UpgradeShell extends Shell {
|
||||||
'help' => __d('cake_console', 'Use git command for moving files around.'),
|
'help' => __d('cake_console', 'Use git command for moving files around.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
),
|
),
|
||||||
'dry-run'=> array(
|
'dry-run' => array(
|
||||||
'short' => 'd',
|
'short' => 'd',
|
||||||
'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
|
'help' => __d('cake_console', 'Dry run the update, no files will actually be modified.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
|
|
|
@ -140,7 +140,7 @@ class HelpFormatter {
|
||||||
foreach ($this->_parser->options() as $option) {
|
foreach ($this->_parser->options() as $option) {
|
||||||
$options[] = $option->usage();
|
$options[] = $option->usage();
|
||||||
}
|
}
|
||||||
if (count($options) > $this->_maxOptions){
|
if (count($options) > $this->_maxOptions) {
|
||||||
$options = array('[options]');
|
$options = array('[options]');
|
||||||
}
|
}
|
||||||
$usage = array_merge($usage, $options);
|
$usage = array_merge($usage, $options);
|
||||||
|
|
|
@ -83,6 +83,7 @@ class Shell extends Object {
|
||||||
* Contains tasks to load and instantiate
|
* Contains tasks to load and instantiate
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::$tasks
|
||||||
*/
|
*/
|
||||||
public $tasks = array();
|
public $tasks = array();
|
||||||
|
|
||||||
|
@ -97,6 +98,7 @@ class Shell extends Object {
|
||||||
* Contains models to load and instantiate
|
* Contains models to load and instantiate
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::$uses
|
||||||
*/
|
*/
|
||||||
public $uses = array();
|
public $uses = array();
|
||||||
|
|
||||||
|
@ -141,6 +143,7 @@ class Shell extends Object {
|
||||||
* @param ConsoleOutput $stdout A ConsoleOutput object for stdout.
|
* @param ConsoleOutput $stdout A ConsoleOutput object for stdout.
|
||||||
* @param ConsoleOutput $stderr A ConsoleOutput object for stderr.
|
* @param ConsoleOutput $stderr A ConsoleOutput object for stderr.
|
||||||
* @param ConsoleInput $stdin A ConsoleInput object for stdin.
|
* @param ConsoleInput $stdin A ConsoleInput object for stdin.
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell
|
||||||
*/
|
*/
|
||||||
public function __construct($stdout = null, $stderr = null, $stdin = null) {
|
public function __construct($stdout = null, $stderr = null, $stdin = null) {
|
||||||
if ($this->name == null) {
|
if ($this->name == null) {
|
||||||
|
@ -176,6 +179,7 @@ class Shell extends Object {
|
||||||
* allows configuration of tasks prior to shell execution
|
* allows configuration of tasks prior to shell execution
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::initialize
|
||||||
*/
|
*/
|
||||||
public function initialize() {
|
public function initialize() {
|
||||||
$this->_loadModels();
|
$this->_loadModels();
|
||||||
|
@ -189,6 +193,7 @@ class Shell extends Object {
|
||||||
* or otherwise modify the pre-command flow.
|
* or otherwise modify the pre-command flow.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::startup
|
||||||
*/
|
*/
|
||||||
public function startup() {
|
public function startup() {
|
||||||
$this->_welcome();
|
$this->_welcome();
|
||||||
|
@ -261,6 +266,7 @@ class Shell extends Object {
|
||||||
*
|
*
|
||||||
* @param string $task The task name to check.
|
* @param string $task The task name to check.
|
||||||
* @return boolean Success
|
* @return boolean Success
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hasTask
|
||||||
*/
|
*/
|
||||||
public function hasTask($task) {
|
public function hasTask($task) {
|
||||||
return isset($this->_taskMap[Inflector::camelize($task)]);
|
return isset($this->_taskMap[Inflector::camelize($task)]);
|
||||||
|
@ -271,6 +277,7 @@ class Shell extends Object {
|
||||||
*
|
*
|
||||||
* @param string $name The method name to check.
|
* @param string $name The method name to check.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hasMethod
|
||||||
*/
|
*/
|
||||||
public function hasMethod($name) {
|
public function hasMethod($name) {
|
||||||
try {
|
try {
|
||||||
|
@ -306,6 +313,7 @@ class Shell extends Object {
|
||||||
* `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');`
|
* `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');`
|
||||||
*
|
*
|
||||||
* @return mixed The return of the other shell.
|
* @return mixed The return of the other shell.
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::dispatchShell
|
||||||
*/
|
*/
|
||||||
public function dispatchShell() {
|
public function dispatchShell() {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
@ -334,6 +342,7 @@ class Shell extends Object {
|
||||||
* and the shell has a `main()` method, that will be called instead.
|
* and the shell has a `main()` method, that will be called instead.
|
||||||
* @param array $argv Array of arguments to run the shell with. This array should be missing the shell name.
|
* @param array $argv Array of arguments to run the shell with. This array should be missing the shell name.
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::runCommand
|
||||||
*/
|
*/
|
||||||
public function runCommand($command, $argv) {
|
public function runCommand($command, $argv) {
|
||||||
$isTask = $this->hasTask($command);
|
$isTask = $this->hasTask($command);
|
||||||
|
@ -357,7 +366,7 @@ class Shell extends Object {
|
||||||
return $this->_displayHelp($command);
|
return $this->_displayHelp($command);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($isTask || $isMethod || $isMain) && $command !== 'execute' ) {
|
if (($isTask || $isMethod || $isMain) && $command !== 'execute') {
|
||||||
$this->startup();
|
$this->startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,6 +406,7 @@ class Shell extends Object {
|
||||||
* By overriding this method you can configure the ConsoleOptionParser before returning it.
|
* By overriding this method you can configure the ConsoleOptionParser before returning it.
|
||||||
*
|
*
|
||||||
* @return ConsoleOptionParser
|
* @return ConsoleOptionParser
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::getOptionParser
|
||||||
*/
|
*/
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = new ConsoleOptionParser($this->name);
|
$parser = new ConsoleOptionParser($this->name);
|
||||||
|
@ -428,6 +438,7 @@ class Shell extends Object {
|
||||||
* @param mixed $options Array or string of options.
|
* @param mixed $options Array or string of options.
|
||||||
* @param string $default Default input value.
|
* @param string $default Default input value.
|
||||||
* @return mixed Either the default value, or the user-provided input.
|
* @return mixed Either the default value, or the user-provided input.
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::in
|
||||||
*/
|
*/
|
||||||
public function in($prompt, $options = null, $default = null) {
|
public function in($prompt, $options = null, $default = null) {
|
||||||
if (!$this->interactive) {
|
if (!$this->interactive) {
|
||||||
|
@ -499,6 +510,7 @@ class Shell extends Object {
|
||||||
* @param mixed $options Array of options to use, or an integer to wrap the text to.
|
* @param mixed $options Array of options to use, or an integer to wrap the text to.
|
||||||
* @return string Wrapped / indented text
|
* @return string Wrapped / indented text
|
||||||
* @see String::wrap()
|
* @see String::wrap()
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::wrapText
|
||||||
*/
|
*/
|
||||||
public function wrapText($text, $options = array()) {
|
public function wrapText($text, $options = array()) {
|
||||||
return String::wrap($text, $options);
|
return String::wrap($text, $options);
|
||||||
|
@ -519,6 +531,7 @@ class Shell extends Object {
|
||||||
* @param integer $newlines Number of newlines to append
|
* @param integer $newlines Number of newlines to append
|
||||||
* @param integer $level The message's output level, see above.
|
* @param integer $level The message's output level, see above.
|
||||||
* @return integer|boolean Returns the number of bytes returned from writing to stdout.
|
* @return integer|boolean Returns the number of bytes returned from writing to stdout.
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::out
|
||||||
*/
|
*/
|
||||||
public function out($message = null, $newlines = 1, $level = Shell::NORMAL) {
|
public function out($message = null, $newlines = 1, $level = Shell::NORMAL) {
|
||||||
$currentLevel = Shell::NORMAL;
|
$currentLevel = Shell::NORMAL;
|
||||||
|
@ -541,6 +554,7 @@ class Shell extends Object {
|
||||||
* @param mixed $message A string or a an array of strings to output
|
* @param mixed $message A string or a an array of strings to output
|
||||||
* @param integer $newlines Number of newlines to append
|
* @param integer $newlines Number of newlines to append
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::err
|
||||||
*/
|
*/
|
||||||
public function err($message = null, $newlines = 1) {
|
public function err($message = null, $newlines = 1) {
|
||||||
$this->stderr->write($message, $newlines);
|
$this->stderr->write($message, $newlines);
|
||||||
|
@ -551,6 +565,7 @@ class Shell extends Object {
|
||||||
*
|
*
|
||||||
* @param integer $multiplier Number of times the linefeed sequence should be repeated
|
* @param integer $multiplier Number of times the linefeed sequence should be repeated
|
||||||
* @return string
|
* @return string
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::nl
|
||||||
*/
|
*/
|
||||||
public function nl($multiplier = 1) {
|
public function nl($multiplier = 1) {
|
||||||
return str_repeat(ConsoleOutput::LF, $multiplier);
|
return str_repeat(ConsoleOutput::LF, $multiplier);
|
||||||
|
@ -562,6 +577,7 @@ class Shell extends Object {
|
||||||
* @param integer $newlines Number of newlines to pre- and append
|
* @param integer $newlines Number of newlines to pre- and append
|
||||||
* @param integer $width Width of the line, defaults to 63
|
* @param integer $width Width of the line, defaults to 63
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::hr
|
||||||
*/
|
*/
|
||||||
public function hr($newlines = 0, $width = 63) {
|
public function hr($newlines = 0, $width = 63) {
|
||||||
$this->out(null, $newlines);
|
$this->out(null, $newlines);
|
||||||
|
@ -576,6 +592,7 @@ class Shell extends Object {
|
||||||
* @param string $title Title of the error
|
* @param string $title Title of the error
|
||||||
* @param string $message An optional error message
|
* @param string $message An optional error message
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::error
|
||||||
*/
|
*/
|
||||||
public function error($title, $message = null) {
|
public function error($title, $message = null) {
|
||||||
$this->err(__d('cake_console', '<error>Error:</error> %s', $title));
|
$this->err(__d('cake_console', '<error>Error:</error> %s', $title));
|
||||||
|
@ -590,6 +607,7 @@ class Shell extends Object {
|
||||||
* Clear the console
|
* Clear the console
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::clear
|
||||||
*/
|
*/
|
||||||
public function clear() {
|
public function clear() {
|
||||||
if (empty($this->params['noclear'])) {
|
if (empty($this->params['noclear'])) {
|
||||||
|
@ -607,6 +625,7 @@ class Shell extends Object {
|
||||||
* @param string $path Where to put the file.
|
* @param string $path Where to put the file.
|
||||||
* @param string $contents Content to put in the file.
|
* @param string $contents Content to put in the file.
|
||||||
* @return boolean Success
|
* @return boolean Success
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::createFile
|
||||||
*/
|
*/
|
||||||
public function createFile($path, $contents) {
|
public function createFile($path, $contents) {
|
||||||
$path = str_replace(DS . DS, DS, $path);
|
$path = str_replace(DS . DS, DS, $path);
|
||||||
|
@ -653,7 +672,7 @@ class Shell extends Object {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$prompt = __d('cake_console', 'PHPUnit is not installed. Do you want to bake unit test files anyway?');
|
$prompt = __d('cake_console', 'PHPUnit is not installed. Do you want to bake unit test files anyway?');
|
||||||
$unitTest = $this->in($prompt, array('y','n'), 'y');
|
$unitTest = $this->in($prompt, array('y', 'n'), 'y');
|
||||||
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
|
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -668,6 +687,7 @@ class Shell extends Object {
|
||||||
*
|
*
|
||||||
* @param string $file Absolute file path
|
* @param string $file Absolute file path
|
||||||
* @return string short path
|
* @return string short path
|
||||||
|
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::shortPath
|
||||||
*/
|
*/
|
||||||
public function shortPath($file) {
|
public function shortPath($file) {
|
||||||
$shortPath = str_replace(ROOT, null, $file);
|
$shortPath = str_replace(ROOT, null, $file);
|
||||||
|
|
|
@ -210,7 +210,7 @@ class ShellDispatcher {
|
||||||
$class = Inflector::camelize($shell) . 'Shell';
|
$class = Inflector::camelize($shell) . 'Shell';
|
||||||
|
|
||||||
App::uses('Shell', 'Console');
|
App::uses('Shell', 'Console');
|
||||||
App::uses('AppShell', 'Console');
|
App::uses('AppShell', 'Console/Command');
|
||||||
App::uses($class, $plugin . 'Console/Command');
|
App::uses($class, $plugin . 'Console/Command');
|
||||||
|
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
if ($this-><?php echo $currentModelName; ?>->delete()) {
|
if ($this-><?php echo $currentModelName; ?>->delete()) {
|
||||||
<?php if ($wannaUseSession): ?>
|
<?php if ($wannaUseSession): ?>
|
||||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'));
|
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'));
|
||||||
$this->redirect(array('action'=>'index'));
|
$this->redirect(array('action' => 'index'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'), array('action' => 'index'));
|
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -50,7 +50,7 @@ class <?php echo $controllerName; ?>Controller extends <?php echo $plugin; ?>App
|
||||||
<?php
|
<?php
|
||||||
if (count($helpers)):
|
if (count($helpers)):
|
||||||
echo "/**\n * Helpers\n *\n * @var array\n */\n";
|
echo "/**\n * Helpers\n *\n * @var array\n */\n";
|
||||||
echo "\tvar \$helpers = array(";
|
echo "\tpublic \$helpers = array(";
|
||||||
for ($i = 0, $len = count($helpers); $i < $len; $i++):
|
for ($i = 0, $len = count($helpers); $i < $len; $i++):
|
||||||
if ($i != $len - 1):
|
if ($i != $len - 1):
|
||||||
echo "'" . Inflector::camelize($helpers[$i]) . "', ";
|
echo "'" . Inflector::camelize($helpers[$i]) . "', ";
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
echo "<?php
|
echo "<?php
|
||||||
\$i = 0;
|
|
||||||
foreach (\${$pluralVar} as \${$singularVar}): ?>\n";
|
foreach (\${$pluralVar} as \${$singularVar}): ?>\n";
|
||||||
echo "\t<tr>\n";
|
echo "\t<tr>\n";
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
|
|
|
@ -39,35 +39,35 @@ class DbAclSchema extends CakeSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
public $acos = array(
|
public $acos = array(
|
||||||
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||||
'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||||
'model' => array('type'=>'string', 'null' => true),
|
'model' => array('type' => 'string', 'null' => true),
|
||||||
'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||||
'alias' => array('type'=>'string', 'null' => true),
|
'alias' => array('type' => 'string', 'null' => true),
|
||||||
'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||||
'rght' => 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))
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
public $aros = array(
|
public $aros = array(
|
||||||
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||||
'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||||
'model' => array('type'=>'string', 'null' => true),
|
'model' => array('type' => 'string', 'null' => true),
|
||||||
'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||||
'alias' => array('type'=>'string', 'null' => true),
|
'alias' => array('type' => 'string', 'null' => true),
|
||||||
'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
|
||||||
'rght' => 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))
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
public $aros_acos = array(
|
public $aros_acos = array(
|
||||||
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||||
'aro_id' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
||||||
'aco_id' => array('type'=>'integer', 'null' => false, 'length' => 10),
|
'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
|
||||||
'_create' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
|
'_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||||
'_read' => 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),
|
'_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
|
||||||
'_delete' => 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))
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,12 @@ class i18nSchema extends CakeSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
public $i18n = array(
|
public $i18n = array(
|
||||||
'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
|
||||||
'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
||||||
'model' => array('type'=>'string', 'null' => false, 'key' => 'index'),
|
'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||||
'foreign_key' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
|
||||||
'field' => array('type'=>'string', 'null' => false, 'key' => 'index'),
|
'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||||
'content' => array('type'=>'text', 'null' => true, 'default' => NULL),
|
'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))
|
'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))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,9 @@ class SessionsSchema extends CakeSchema {
|
||||||
}
|
}
|
||||||
|
|
||||||
public $cake_sessions = array(
|
public $cake_sessions = array(
|
||||||
'id' => array('type'=>'string', 'null' => false, 'key' => 'primary'),
|
'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
|
||||||
'data' => array('type'=>'text', 'null' => true, 'default' => NULL),
|
'data' => array('type' => 'text', 'null' => true, 'default' => NULL),
|
||||||
'expires' => array('type'=>'integer', 'null' => true, 'default' => NULL),
|
'expires' => array('type' => 'integer', 'null' => true, 'default' => NULL),
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -239,8 +239,8 @@
|
||||||
*
|
*
|
||||||
* Cache::config('default', array(
|
* Cache::config('default', array(
|
||||||
* 'engine' => 'File', //[required]
|
* 'engine' => 'File', //[required]
|
||||||
* 'duration'=> 3600, //[optional]
|
* 'duration' => 3600, //[optional]
|
||||||
* 'probability'=> 100, //[optional]
|
* 'probability' => 100, //[optional]
|
||||||
* 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
|
* 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
|
||||||
* 'prefix' => 'cake_', //[optional] prefix every cache file with this string
|
* 'prefix' => 'cake_', //[optional] prefix every cache file with this string
|
||||||
* 'lock' => false, //[optional] use file locking
|
* 'lock' => false, //[optional] use file locking
|
||||||
|
@ -251,8 +251,8 @@
|
||||||
*
|
*
|
||||||
* Cache::config('default', array(
|
* Cache::config('default', array(
|
||||||
* 'engine' => 'Apc', //[required]
|
* 'engine' => 'Apc', //[required]
|
||||||
* 'duration'=> 3600, //[optional]
|
* 'duration' => 3600, //[optional]
|
||||||
* 'probability'=> 100, //[optional]
|
* 'probability' => 100, //[optional]
|
||||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||||
* ));
|
* ));
|
||||||
*
|
*
|
||||||
|
@ -260,8 +260,8 @@
|
||||||
*
|
*
|
||||||
* Cache::config('default', array(
|
* Cache::config('default', array(
|
||||||
* 'engine' => 'Xcache', //[required]
|
* 'engine' => 'Xcache', //[required]
|
||||||
* 'duration'=> 3600, //[optional]
|
* 'duration' => 3600, //[optional]
|
||||||
* 'probability'=> 100, //[optional]
|
* 'probability' => 100, //[optional]
|
||||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||||
* 'user' => 'user', //user from xcache.admin.user settings
|
* 'user' => 'user', //user from xcache.admin.user settings
|
||||||
* 'password' => 'password', //plaintext password (xcache.admin.pass)
|
* 'password' => 'password', //plaintext password (xcache.admin.pass)
|
||||||
|
@ -271,8 +271,8 @@
|
||||||
*
|
*
|
||||||
* Cache::config('default', array(
|
* Cache::config('default', array(
|
||||||
* 'engine' => 'Memcache', //[required]
|
* 'engine' => 'Memcache', //[required]
|
||||||
* 'duration'=> 3600, //[optional]
|
* 'duration' => 3600, //[optional]
|
||||||
* 'probability'=> 100, //[optional]
|
* 'probability' => 100, //[optional]
|
||||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||||
* 'servers' => array(
|
* 'servers' => array(
|
||||||
* '127.0.0.1:11211' // localhost, default port 11211
|
* '127.0.0.1:11211' // localhost, default port 11211
|
||||||
|
@ -285,8 +285,8 @@
|
||||||
*
|
*
|
||||||
* Cache::config('default', array(
|
* Cache::config('default', array(
|
||||||
* 'engine' => 'Wincache', //[required]
|
* 'engine' => 'Wincache', //[required]
|
||||||
* 'duration'=> 3600, //[optional]
|
* 'duration' => 3600, //[optional]
|
||||||
* 'probability'=> 100, //[optional]
|
* 'probability' => 100, //[optional]
|
||||||
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
* 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
|
||||||
* ));
|
* ));
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<?php echo $this->Html->link(
|
<?php echo $this->Html->link(
|
||||||
$this->Html->image('cake.power.gif', array('alt'=> __('CakePHP: the rapid development php framework'), 'border' => '0')),
|
$this->Html->image('cake.power.gif', array('alt' => __('CakePHP: the rapid development php framework'), 'border' => '0')),
|
||||||
'http://www.cakephp.org/',
|
'http://www.cakephp.org/',
|
||||||
array('target' => '_blank', 'escape' => false)
|
array('target' => '_blank', 'escape' => false)
|
||||||
);
|
);
|
||||||
|
|
|
@ -16,16 +16,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
* {
|
* {
|
||||||
margin:0;
|
margin: 0;
|
||||||
padding:0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** General Style Info **/
|
/** General Style Info **/
|
||||||
body {
|
body {
|
||||||
background: #003d4c;
|
background: #003d4c;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-family:'lucida grande',verdana,helvetica,arial,sans-serif;
|
font-family: 'lucida grande', verdana, helvetica, arial, sans-serif;
|
||||||
font-size:90%;
|
font-size: 90%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
|
@ -35,29 +35,29 @@ a {
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: #367889;
|
color: #367889;
|
||||||
text-decoration:none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a img {
|
a img {
|
||||||
border:none;
|
border: none;
|
||||||
}
|
}
|
||||||
h1, h2, h3, h4 {
|
h1, h2, h3, h4 {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin-bottom:0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
background:#fff;
|
background: #fff;
|
||||||
color: #003d4c;
|
color: #003d4c;
|
||||||
font-size: 100%;
|
font-size: 100%;
|
||||||
}
|
}
|
||||||
h2 {
|
h2 {
|
||||||
background:#fff;
|
background: #fff;
|
||||||
color: #e32;
|
color: #e32;
|
||||||
font-family:'Gill Sans','lucida grande', helvetica, arial, sans-serif;
|
font-family: 'Gill Sans', 'lucida grande', helvetica, arial, sans-serif;
|
||||||
font-size: 190%;
|
font-size: 190%;
|
||||||
}
|
}
|
||||||
h3 {
|
h3 {
|
||||||
color: #2c6877;
|
color: #2c6877;
|
||||||
font-family:'Gill Sans','lucida grande', helvetica, arial, sans-serif;
|
font-family: 'Gill Sans', 'lucida grande', helvetica, arial, sans-serif;
|
||||||
font-size: 165%;
|
font-size: 165%;
|
||||||
}
|
}
|
||||||
h4 {
|
h4 {
|
||||||
|
@ -80,7 +80,7 @@ p {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
}
|
}
|
||||||
#header h1 {
|
#header h1 {
|
||||||
line-height:20px;
|
line-height: 20px;
|
||||||
background: #003d4c url('../img/cake.icon.png') no-repeat left;
|
background: #003d4c url('../img/cake.icon.png') no-repeat left;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding: 0px 30px;
|
padding: 0px 30px;
|
||||||
|
@ -113,35 +113,35 @@ p {
|
||||||
div.form,
|
div.form,
|
||||||
div.index,
|
div.index,
|
||||||
div.view {
|
div.view {
|
||||||
float:right;
|
float: right;
|
||||||
width:76%;
|
width: 76%;
|
||||||
border-left:1px solid #666;
|
border-left: 1px solid #666;
|
||||||
padding:10px 2%;
|
padding: 10px 2%;
|
||||||
}
|
}
|
||||||
div.actions {
|
div.actions {
|
||||||
float:left;
|
float: left;
|
||||||
width:16%;
|
width: 16%;
|
||||||
padding:10px 1.5%;
|
padding: 10px 1.5%;
|
||||||
}
|
}
|
||||||
div.actions h3 {
|
div.actions h3 {
|
||||||
padding-top:0;
|
padding-top: 0;
|
||||||
color:#777;
|
color: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Tables **/
|
/** Tables **/
|
||||||
table {
|
table {
|
||||||
border-right:0;
|
border-right: 0;
|
||||||
clear: both;
|
clear: both;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
th {
|
th {
|
||||||
border:0;
|
border: 0;
|
||||||
border-bottom:2px solid #555;
|
border-bottom: 2px solid #555;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding:4px;
|
padding: 4px;
|
||||||
}
|
}
|
||||||
th a {
|
th a {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -158,7 +158,7 @@ table tr td {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
border-bottom:1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
table tr:nth-child(even) {
|
table tr:nth-child(even) {
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
|
@ -169,7 +169,7 @@ td.actions {
|
||||||
}
|
}
|
||||||
table td.actions a {
|
table td.actions a {
|
||||||
margin: 0px 6px;
|
margin: 0px 6px;
|
||||||
padding:2px 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SQL log */
|
/* SQL log */
|
||||||
|
@ -182,15 +182,15 @@ table td.actions a {
|
||||||
font-family: Monaco, Consolas, "Courier New", monospaced;
|
font-family: Monaco, Consolas, "Courier New", monospaced;
|
||||||
}
|
}
|
||||||
.cake-sql-log caption {
|
.cake-sql-log caption {
|
||||||
color:#fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Paging **/
|
/** Paging **/
|
||||||
.paging {
|
.paging {
|
||||||
background:#fff;
|
background: #fff;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
clear:both;
|
clear: both;
|
||||||
}
|
}
|
||||||
.paging .current,
|
.paging .current,
|
||||||
.paging .disabled,
|
.paging .disabled,
|
||||||
|
@ -296,7 +296,7 @@ form .required {
|
||||||
form .required label:after {
|
form .required label:after {
|
||||||
color: #e32;
|
color: #e32;
|
||||||
content: '*';
|
content: '*';
|
||||||
display:inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
form div.submit {
|
form div.submit {
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -306,14 +306,14 @@ form div.submit {
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 110%;
|
font-size: 110%;
|
||||||
margin-bottom:3px;
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
input, textarea {
|
input, textarea {
|
||||||
clear: both;
|
clear: both;
|
||||||
font-size: 140%;
|
font-size: 140%;
|
||||||
font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
|
font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
|
||||||
padding: 1%;
|
padding: 1%;
|
||||||
width:98%;
|
width: 98%;
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
clear: both;
|
clear: both;
|
||||||
|
@ -337,8 +337,8 @@ div.checkbox label {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
input[type=radio] {
|
input[type=radio] {
|
||||||
float:left;
|
float: left;
|
||||||
width:auto;
|
width: auto;
|
||||||
margin: 6px 0;
|
margin: 6px 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
|
@ -353,7 +353,7 @@ input[type=submit] {
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
form .submit input[type=submit] {
|
form .submit input[type=submit] {
|
||||||
background:#62af56;
|
background: #62af56;
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
|
background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
|
||||||
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
|
background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
|
||||||
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
|
background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
|
||||||
|
@ -491,7 +491,7 @@ p.error em {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.actions li {
|
.actions li {
|
||||||
margin:0 0 0.5em 0;
|
margin: 0 0 0.5em 0;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -506,7 +506,7 @@ p.error em {
|
||||||
input[type=submit],
|
input[type=submit],
|
||||||
.actions ul li a,
|
.actions ul li a,
|
||||||
.actions a {
|
.actions a {
|
||||||
font-weight:normal;
|
font-weight: normal;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
background: #dcdcdc;
|
background: #dcdcdc;
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
|
background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
|
||||||
|
@ -515,8 +515,8 @@ input[type=submit],
|
||||||
background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
|
background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
|
||||||
background-image: -o-linear-gradient(top, #fefefe, #dcdcdc);
|
background-image: -o-linear-gradient(top, #fefefe, #dcdcdc);
|
||||||
background-image: linear-gradient(top, #fefefe, #dcdcdc);
|
background-image: linear-gradient(top, #fefefe, #dcdcdc);
|
||||||
color:#333;
|
color: #333;
|
||||||
border:1px solid #bbb;
|
border: 1px solid #bbb;
|
||||||
-webkit-border-radius: 4px;
|
-webkit-border-radius: 4px;
|
||||||
-moz-border-radius: 4px;
|
-moz-border-radius: 4px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
@ -661,50 +661,50 @@ pre {
|
||||||
background-color: rgba(255, 255, 0, 0.5);
|
background-color: rgba(255, 255, 0, 0.5);
|
||||||
}
|
}
|
||||||
.code-coverage-results div.code-line {
|
.code-coverage-results div.code-line {
|
||||||
padding-left:5px;
|
padding-left: 5px;
|
||||||
display:block;
|
display: block;
|
||||||
margin-left:10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
.code-coverage-results div.uncovered span.content {
|
.code-coverage-results div.uncovered span.content {
|
||||||
background:#ecc;
|
background: #ecc;
|
||||||
}
|
}
|
||||||
.code-coverage-results div.covered span.content {
|
.code-coverage-results div.covered span.content {
|
||||||
background:#cec;
|
background: #cec;
|
||||||
}
|
}
|
||||||
.code-coverage-results div.ignored span.content {
|
.code-coverage-results div.ignored span.content {
|
||||||
color:#aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
.code-coverage-results span.line-num {
|
.code-coverage-results span.line-num {
|
||||||
color:#666;
|
color: #666;
|
||||||
display:block;
|
display: block;
|
||||||
float:left;
|
float: left;
|
||||||
width:20px;
|
width: 20px;
|
||||||
text-align:right;
|
text-align: right;
|
||||||
margin-right:5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
.code-coverage-results span.line-num strong {
|
.code-coverage-results span.line-num strong {
|
||||||
color:#666;
|
color: #666;
|
||||||
}
|
}
|
||||||
.code-coverage-results div.start {
|
.code-coverage-results div.start {
|
||||||
border:1px solid #aaa;
|
border: 1px solid #aaa;
|
||||||
border-width:1px 1px 0px 1px;
|
border-width: 1px 1px 0px 1px;
|
||||||
margin-top:30px;
|
margin-top: 30px;
|
||||||
padding-top:5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
.code-coverage-results div.end {
|
.code-coverage-results div.end {
|
||||||
border:1px solid #aaa;
|
border: 1px solid #aaa;
|
||||||
border-width:0px 1px 1px 1px;
|
border-width: 0px 1px 1px 1px;
|
||||||
margin-bottom:30px;
|
margin-bottom: 30px;
|
||||||
padding-bottom:5px;
|
padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
.code-coverage-results div.realstart {
|
.code-coverage-results div.realstart {
|
||||||
margin-top:0px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
.code-coverage-results p.note {
|
.code-coverage-results p.note {
|
||||||
color:#bbb;
|
color: #bbb;
|
||||||
padding:5px;
|
padding: 5px;
|
||||||
margin:5px 0 10px;
|
margin: 5px 0 10px;
|
||||||
font-size:10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
.code-coverage-results span.result-bad {
|
.code-coverage-results span.result-bad {
|
||||||
color: #a00;
|
color: #a00;
|
||||||
|
@ -718,5 +718,5 @@ pre {
|
||||||
|
|
||||||
/** Elements **/
|
/** Elements **/
|
||||||
#url-rewriting-warning {
|
#url-rewriting-warning {
|
||||||
display:none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class CakeErrorController extends AppController {
|
||||||
public function beforeRender() {
|
public function beforeRender() {
|
||||||
parent::beforeRender();
|
parent::beforeRender();
|
||||||
foreach ($this->viewVars as $key => $value) {
|
foreach ($this->viewVars as $key => $value) {
|
||||||
if (!is_object($value)){
|
if (!is_object($value)) {
|
||||||
$this->viewVars[$key] = h($value);
|
$this->viewVars[$key] = h($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ abstract class BaseAuthenticate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash the plain text password so that it matches the hashed/encrytped password
|
* Hash the plain text password so that it matches the hashed/encrypted password
|
||||||
* in the datasource.
|
* in the datasource.
|
||||||
*
|
*
|
||||||
* @param string $password The plain text password.
|
* @param string $password The plain text password.
|
||||||
|
@ -111,7 +111,7 @@ abstract class BaseAuthenticate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to hook into AuthComponent::logout(),
|
* Allows you to hook into AuthComponent::logout(),
|
||||||
* and implement specialized logout behaviour.
|
* and implement specialized logout behavior.
|
||||||
*
|
*
|
||||||
* All attached authentication objects will have this method
|
* All attached authentication objects will have this method
|
||||||
* called when a user logs out.
|
* called when a user logs out.
|
||||||
|
|
|
@ -204,7 +204,7 @@ class AuthComponent extends Component {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error to display when user attempts to access an object or action to which they do not have
|
* Error to display when user attempts to access an object or action to which they do not have
|
||||||
* acccess.
|
* access.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent::$authError
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#AuthComponent::$authError
|
||||||
|
@ -268,8 +268,8 @@ class AuthComponent extends Component {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$methods = array_flip($controller->methods);
|
$methods = array_flip(array_map('strtolower', $controller->methods));
|
||||||
$action = $controller->request->params['action'];
|
$action = strtolower($controller->request->params['action']);
|
||||||
|
|
||||||
$isMissingAction = (
|
$isMissingAction = (
|
||||||
$controller->scaffold === false &&
|
$controller->scaffold === false &&
|
||||||
|
@ -296,7 +296,7 @@ class AuthComponent extends Component {
|
||||||
$allowedActions = $this->allowedActions;
|
$allowedActions = $this->allowedActions;
|
||||||
$isAllowed = (
|
$isAllowed = (
|
||||||
$this->allowedActions == array('*') ||
|
$this->allowedActions == array('*') ||
|
||||||
in_array($action, $allowedActions)
|
in_array($action, array_map('strtolower', $allowedActions))
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($loginAction != $url && $isAllowed) {
|
if ($loginAction != $url && $isAllowed) {
|
||||||
|
|
|
@ -198,6 +198,7 @@ class CookieComponent extends Component {
|
||||||
* @param boolean $encrypt Set to true to encrypt value, false otherwise
|
* @param boolean $encrypt Set to true to encrypt value, false otherwise
|
||||||
* @param string $expires Can be either Unix timestamp, or date string
|
* @param string $expires Can be either Unix timestamp, or date string
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::write
|
||||||
*/
|
*/
|
||||||
public function write($key, $value = null, $encrypt = true, $expires = null) {
|
public function write($key, $value = null, $encrypt = true, $expires = null) {
|
||||||
if (is_null($encrypt)) {
|
if (is_null($encrypt)) {
|
||||||
|
@ -234,6 +235,7 @@ class CookieComponent extends Component {
|
||||||
*
|
*
|
||||||
* @param mixed $key Key of the value to be obtained. If none specified, obtain map key => values
|
* @param mixed $key Key of the value to be obtained. If none specified, obtain map key => values
|
||||||
* @return string or null, value for specified key
|
* @return string or null, value for specified key
|
||||||
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::read
|
||||||
*/
|
*/
|
||||||
public function read($key = null) {
|
public function read($key = null) {
|
||||||
if (empty($this->_values) && isset($_COOKIE[$this->name])) {
|
if (empty($this->_values) && isset($_COOKIE[$this->name])) {
|
||||||
|
@ -269,6 +271,7 @@ class CookieComponent extends Component {
|
||||||
*
|
*
|
||||||
* @param string $key Key of the value to be deleted
|
* @param string $key Key of the value to be deleted
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::delete
|
||||||
*/
|
*/
|
||||||
public function delete($key) {
|
public function delete($key) {
|
||||||
if (empty($this->_values)) {
|
if (empty($this->_values)) {
|
||||||
|
@ -298,6 +301,7 @@ class CookieComponent extends Component {
|
||||||
* Failure to do so will result in header already sent errors.
|
* Failure to do so will result in header already sent errors.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::destroy
|
||||||
*/
|
*/
|
||||||
public function destroy() {
|
public function destroy() {
|
||||||
if (isset($_COOKIE[$this->name])) {
|
if (isset($_COOKIE[$this->name])) {
|
||||||
|
@ -407,6 +411,7 @@ class CookieComponent extends Component {
|
||||||
protected function _setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly = false) {
|
protected function _setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly = false) {
|
||||||
setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
|
setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypts $value using public $type method in Security class
|
* Encrypts $value using public $type method in Security class
|
||||||
*
|
*
|
||||||
|
|
|
@ -93,8 +93,8 @@ class EmailComponent extends Component {
|
||||||
public $bcc = array();
|
public $bcc = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date to put in the Date: header. This should be a date
|
* The date to put in the Date: header. This should be a date
|
||||||
* conformant with the RFC2822 standard. Leave null, to have
|
* conforming with the RFC2822 standard. Leave null, to have
|
||||||
* today's date generated.
|
* today's date generated.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -198,7 +198,7 @@ class EmailComponent extends Component {
|
||||||
public $xMailer = 'CakePHP Email Component';
|
public $xMailer = 'CakePHP Email Component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of paths to search if an attachment isnt absolute
|
* The list of paths to search if an attachment isn't absolute
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -465,7 +465,7 @@ class EmailComponent extends Component {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove certain elements (such as bcc:, to:, %0a) from given value.
|
* Remove certain elements (such as bcc:, to:, %0a) from given value.
|
||||||
* Helps prevent header injection / mainipulation on user content.
|
* Helps prevent header injection / manipulation on user content.
|
||||||
*
|
*
|
||||||
* @param string $value Value to strip
|
* @param string $value Value to strip
|
||||||
* @param boolean $message Set to true to indicate main message content
|
* @param boolean $message Set to true to indicate main message content
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component is used to handle automatic model data pagination. The primary way to use this
|
* This component is used to handle automatic model data pagination. The primary way to use this
|
||||||
* component is to call the paginate() method. There is a convience wrapper on Controller as well.
|
* component is to call the paginate() method. There is a convenience wrapper on Controller as well.
|
||||||
*
|
*
|
||||||
* ### Configuring pagination
|
* ### Configuring pagination
|
||||||
*
|
*
|
||||||
|
|
|
@ -485,7 +485,7 @@ class RequestHandlerComponent extends Component {
|
||||||
* 'html', 'xml', 'js', etc.
|
* 'html', 'xml', 'js', etc.
|
||||||
* @return mixed If $type is null or not provided, the first content-type in the
|
* @return mixed If $type is null or not provided, the first content-type in the
|
||||||
* list, based on preference, is returned. If a single type is provided
|
* list, based on preference, is returned. If a single type is provided
|
||||||
* a boolean will be returnend if that type is preferred.
|
* a boolean will be returned if that type is preferred.
|
||||||
* If an array of types are provided then the first preferred type is returned.
|
* If an array of types are provided then the first preferred type is returned.
|
||||||
* If no type is provided the first preferred type is returned.
|
* If no type is provided the first preferred type is returned.
|
||||||
* @see RequestHandlerComponent::setContent()
|
* @see RequestHandlerComponent::setContent()
|
||||||
|
|
|
@ -106,7 +106,7 @@ class App {
|
||||||
'view' => array('suffix' => 'View', 'extends' => null, 'core' => true),
|
'view' => array('suffix' => 'View', 'extends' => null, 'core' => true),
|
||||||
'helper' => array('suffix' => 'Helper', 'extends' => 'AppHelper', 'core' => true),
|
'helper' => array('suffix' => 'Helper', 'extends' => 'AppHelper', 'core' => true),
|
||||||
'vendor' => array('extends' => null, 'core' => true),
|
'vendor' => array('extends' => null, 'core' => true),
|
||||||
'shell' => array('suffix' => 'Shell', 'extends' => 'Shell', 'core' => true),
|
'shell' => array('suffix' => 'Shell', 'extends' => 'AppShell', 'core' => true),
|
||||||
'plugin' => array('extends' => null, 'core' => true)
|
'plugin' => array('extends' => null, 'core' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ class App {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets then returns the templates for each customizable package path
|
* Sets then returns the templates for each customizable package path
|
||||||
*
|
*
|
||||||
* @return array templates for each customizable package path
|
* @return array templates for each customizable package path
|
||||||
*/
|
*/
|
||||||
protected static function _packageFormat() {
|
protected static function _packageFormat() {
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Object {
|
||||||
* or tie plugins into a main application. requestAction can be used to return rendered views
|
* or tie plugins into a main application. requestAction can be used to return rendered views
|
||||||
* or fetch the return value from controller actions.
|
* or fetch the return value from controller actions.
|
||||||
*
|
*
|
||||||
* Under the hood this method uses Router::reverse() to convert the $url parmeter into a string
|
* Under the hood this method uses Router::reverse() to convert the $url parameter into a string
|
||||||
* URL. You should use URL formats that are compatible with Router::reverse()
|
* URL. You should use URL formats that are compatible with Router::reverse()
|
||||||
*
|
*
|
||||||
* #### Passing POST and GET data
|
* #### Passing POST and GET data
|
||||||
|
@ -64,7 +64,7 @@ class Object {
|
||||||
* GET data. The `$extra['data']` parameter allows POST data simulation.
|
* GET data. The `$extra['data']` parameter allows POST data simulation.
|
||||||
*
|
*
|
||||||
* @param mixed $url String or array-based url. Unlike other url arrays in CakePHP, this
|
* @param mixed $url String or array-based url. Unlike other url arrays in CakePHP, this
|
||||||
* url will not automatically handle passed and named arguments in the $url paramenter.
|
* url will not automatically handle passed and named arguments in the $url parameter.
|
||||||
* @param array $extra if array includes the key "return" it sets the AutoRender to true. Can
|
* @param array $extra if array includes the key "return" it sets the AutoRender to true. Can
|
||||||
* also be used to submit GET/POST data, and named/passed arguments.
|
* also be used to submit GET/POST data, and named/passed arguments.
|
||||||
* @return mixed Boolean true or false on success/failure, or contents
|
* @return mixed Boolean true or false on success/failure, or contents
|
||||||
|
@ -144,7 +144,7 @@ class Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convience method to write a message to CakeLog. See CakeLog::write()
|
* Convenience method to write a message to CakeLog. See CakeLog::write()
|
||||||
* for more information on writing to logs.
|
* for more information on writing to logs.
|
||||||
*
|
*
|
||||||
* @param string $msg Log message
|
* @param string $msg Log message
|
||||||
|
|
|
@ -511,7 +511,7 @@ class I18n {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mustEscape = array($escape . ',' , $escape . ';', $escape . '<', $escape . '>', $escape . $escape);
|
$mustEscape = array($escape . ',', $escape . ';', $escape . '<', $escape . '>', $escape . $escape);
|
||||||
$replacements = array_map('crc32', $mustEscape);
|
$replacements = array_map('crc32', $mustEscape);
|
||||||
$value = str_replace($mustEscape, $replacements, $value);
|
$value = str_replace($mustEscape, $replacements, $value);
|
||||||
$value = explode(';', $value);
|
$value = explode(';', $value);
|
||||||
|
|
|
@ -259,7 +259,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
* @param Model $Model Model on which binding restriction is being applied
|
* @param Model $Model Model on which binding restriction is being applied
|
||||||
* @param array $contain Parameters to use for restricting this model
|
* @param array $contain Parameters to use for restricting this model
|
||||||
* @param array $containments Current set of containments
|
* @param array $containments Current set of containments
|
||||||
* @param boolean $throwErrors Wether unexisting bindings show throw errors
|
* @param boolean $throwErrors Whether non-existent bindings show throw errors
|
||||||
* @return array Containments
|
* @return array Containments
|
||||||
*/
|
*/
|
||||||
public function containments($Model, $contain, $containments = array(), $throwErrors = null) {
|
public function containments($Model, $contain, $containments = array(), $throwErrors = null) {
|
||||||
|
@ -349,7 +349,7 @@ class ContainableBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($containments['models'][$Model->alias])) {
|
if (!isset($containments['models'][$Model->alias])) {
|
||||||
$containments['models'][$Model->alias] = array('keep' => array(),'instance' => &$Model);
|
$containments['models'][$Model->alias] = array('keep' => array(), 'instance' => &$Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
$containments['models'][$Model->alias]['keep'] = array_merge($containments['models'][$Model->alias]['keep'], $keep);
|
$containments['models'][$Model->alias]['keep'] = array_merge($containments['models'][$Model->alias]['keep'], $keep);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class TranslateBehavior extends ModelBehavior {
|
||||||
* Callback
|
* Callback
|
||||||
*
|
*
|
||||||
* $config for TranslateBehavior should be
|
* $config for TranslateBehavior should be
|
||||||
* array( 'fields' => array('field_one',
|
* array('fields' => array('field_one',
|
||||||
* 'field_two' => 'FieldAssoc', 'field_three'))
|
* 'field_two' => 'FieldAssoc', 'field_three'))
|
||||||
*
|
*
|
||||||
* With above example only one permanent hasMany will be joined (for field_two
|
* With above example only one permanent hasMany will be joined (for field_two
|
||||||
|
|
|
@ -73,7 +73,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* After save method. Called after all saves
|
* After save method. Called after all saves
|
||||||
*
|
*
|
||||||
* Overriden to transparently manage setting the lft and rght fields if and only if the parent field is included in the
|
* Overridden to transparently manage setting the lft and rght fields if and only if the parent field is included in the
|
||||||
* parameters to be saved.
|
* parameters to be saved.
|
||||||
*
|
*
|
||||||
* @param Model $Model Model instance.
|
* @param Model $Model Model instance.
|
||||||
|
@ -125,7 +125,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
/**
|
/**
|
||||||
* Before save method. Called before all saves
|
* Before save method. Called before all saves
|
||||||
*
|
*
|
||||||
* Overriden to transparently manage setting the lft and rght fields if and only if the parent field is included in the
|
* Overridden to transparently manage setting the lft and rght fields if and only if the parent field is included in the
|
||||||
* parameters to be saved. For newly created nodes with NO parent the left and right field values are set directly by
|
* parameters to be saved. For newly created nodes with NO parent the left and right field values are set directly by
|
||||||
* this method bypassing the setParent logic.
|
* this method bypassing the setParent logic.
|
||||||
*
|
*
|
||||||
|
@ -562,7 +562,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
$Model->recursive = $recursive;
|
$Model->recursive = $recursive;
|
||||||
if ($mode == 'parent') {
|
if ($mode == 'parent') {
|
||||||
$Model->bindModel(array('belongsTo' => array('VerifyParent' => array(
|
$Model->bindModel(array('belongsTo' => array('VerifyParent' => array(
|
||||||
'className' => $Model->alias,
|
'className' => $Model->name,
|
||||||
'foreignKey' => $parent,
|
'foreignKey' => $parent,
|
||||||
'fields' => array($Model->primaryKey, $left, $right, $parent),
|
'fields' => array($Model->primaryKey, $left, $right, $parent),
|
||||||
))));
|
))));
|
||||||
|
@ -624,7 +624,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* Options:
|
* Options:
|
||||||
*
|
*
|
||||||
* - 'id' id of record to use as top node for reordering
|
* - 'id' id of record to use as top node for reordering
|
||||||
* - 'field' Which field to use in reordeing defaults to displayField
|
* - 'field' Which field to use in reordering defaults to displayField
|
||||||
* - 'order' Direction to order either DESC or ASC (defaults to ASC)
|
* - 'order' Direction to order either DESC or ASC (defaults to ASC)
|
||||||
* - 'verify' Whether or not to verify the tree before reorder. defaults to true.
|
* - 'verify' Whether or not to verify the tree before reorder. defaults to true.
|
||||||
*
|
*
|
||||||
|
@ -770,7 +770,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
}
|
}
|
||||||
|
|
||||||
$Model->bindModel(array('belongsTo' => array('VerifyParent' => array(
|
$Model->bindModel(array('belongsTo' => array('VerifyParent' => array(
|
||||||
'className' => $Model->alias,
|
'className' => $Model->name,
|
||||||
'foreignKey' => $parent,
|
'foreignKey' => $parent,
|
||||||
'fields' => array($Model->primaryKey, $left, $right, $parent)
|
'fields' => array($Model->primaryKey, $left, $right, $parent)
|
||||||
))));
|
))));
|
||||||
|
|
|
@ -207,7 +207,7 @@ class BehaviorCollection extends ObjectCollection {
|
||||||
/**
|
/**
|
||||||
* Dispatches a behavior method. Will call either normal methods or mapped methods.
|
* Dispatches a behavior method. Will call either normal methods or mapped methods.
|
||||||
*
|
*
|
||||||
* If a method is not handeled by the BehaviorCollection, and $strict is false, a
|
* If a method is not handled by the BehaviorCollection, and $strict is false, a
|
||||||
* special return of `array('unhandled')` will be returned to signal the method was not found.
|
* special return of `array('unhandled')` will be returned to signal the method was not found.
|
||||||
*
|
*
|
||||||
* @param Model $model The model the method was originally called on.
|
* @param Model $model The model the method was originally called on.
|
||||||
|
@ -252,8 +252,8 @@ class BehaviorCollection extends ObjectCollection {
|
||||||
*
|
*
|
||||||
* @param string $method The method to find.
|
* @param string $method The method to find.
|
||||||
* @param boolean $callback Return the callback for the method.
|
* @param boolean $callback Return the callback for the method.
|
||||||
* @return mixed If $callback is false, a boolean will be returnned, if its true, an array
|
* @return mixed If $callback is false, a boolean will be returned, if its true, an array
|
||||||
* containing callback information will be returnned. For mapped methods the array will have 3 elements.
|
* containing callback information will be returned. For mapped methods the array will have 3 elements.
|
||||||
*/
|
*/
|
||||||
public function hasMethod($method, $callback = false) {
|
public function hasMethod($method, $callback = false) {
|
||||||
if (isset($this->_methods[$method])) {
|
if (isset($this->_methods[$method])) {
|
||||||
|
|
|
@ -351,21 +351,21 @@ class CakeSchema extends Object {
|
||||||
get_object_vars($this), $options
|
get_object_vars($this), $options
|
||||||
));
|
));
|
||||||
|
|
||||||
$out = "class {$name}Schema extends CakeSchema {\n";
|
$out = "class {$name}Schema extends CakeSchema {\n\n";
|
||||||
|
|
||||||
if ($path !== $this->path) {
|
if ($path !== $this->path) {
|
||||||
$out .= "\tvar \$path = '{$path}';\n\n";
|
$out .= "\tpublic \$path = '{$path}';\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($file !== $this->file) {
|
if ($file !== $this->file) {
|
||||||
$out .= "\tvar \$file = '{$file}';\n\n";
|
$out .= "\tpublic \$file = '{$file}';\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($connection !== 'default') {
|
if ($connection !== 'default') {
|
||||||
$out .= "\tvar \$connection = '{$connection}';\n\n";
|
$out .= "\tpublic \$connection = '{$connection}';\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$out .= "\tfunction before(\$event = array()) {\n\t\treturn true;\n\t}\n\n\tfunction after(\$event = array()) {\n\t}\n\n";
|
$out .= "\tpublic function before(\$event = array()) {\n\t\treturn true;\n\t}\n\n\tpublic function after(\$event = array()) {\n\t}\n\n";
|
||||||
|
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
$this->read();
|
$this->read();
|
||||||
|
@ -395,14 +395,14 @@ class CakeSchema extends Object {
|
||||||
* @return string Variable declaration for a schema class
|
* @return string Variable declaration for a schema class
|
||||||
*/
|
*/
|
||||||
public function generateTable($table, $fields) {
|
public function generateTable($table, $fields) {
|
||||||
$out = "\tvar \${$table} = array(\n";
|
$out = "\tpublic \${$table} = array(\n";
|
||||||
if (is_array($fields)) {
|
if (is_array($fields)) {
|
||||||
$cols = array();
|
$cols = array();
|
||||||
foreach ($fields as $field => $value) {
|
foreach ($fields as $field => $value) {
|
||||||
if ($field != 'indexes' && $field != 'tableParameters') {
|
if ($field != 'indexes' && $field != 'tableParameters') {
|
||||||
if (is_string($value)) {
|
if (is_string($value)) {
|
||||||
$type = $value;
|
$type = $value;
|
||||||
$value = array('type'=> $type);
|
$value = array('type' => $type);
|
||||||
}
|
}
|
||||||
$col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', ";
|
$col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', ";
|
||||||
unset($value['type']);
|
unset($value['type']);
|
||||||
|
|
|
@ -181,7 +181,7 @@ class Mysql extends DboSource {
|
||||||
* Returns an array of sources (tables) in the database.
|
* Returns an array of sources (tables) in the database.
|
||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @return array Array of tablenames in the database
|
* @return array Array of table names in the database
|
||||||
*/
|
*/
|
||||||
public function listSources($data = null) {
|
public function listSources($data = null) {
|
||||||
$cache = parent::listSources();
|
$cache = parent::listSources();
|
||||||
|
@ -238,7 +238,7 @@ class Mysql extends DboSource {
|
||||||
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
|
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
|
||||||
*/
|
*/
|
||||||
public function fetchResult() {
|
public function fetchResult() {
|
||||||
if ($row = $this->_result->fetch()) {
|
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
|
||||||
$resultRow = array();
|
$resultRow = array();
|
||||||
foreach ($this->map as $col => $meta) {
|
foreach ($this->map as $col => $meta) {
|
||||||
list($table, $column, $type) = $meta;
|
list($table, $column, $type) = $meta;
|
||||||
|
@ -543,11 +543,11 @@ class Mysql extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate MySQL table parameter alteration statementes for a table.
|
* Generate MySQL table parameter alteration statements for a table.
|
||||||
*
|
*
|
||||||
* @param string $table Table to alter parameters for.
|
* @param string $table Table to alter parameters for.
|
||||||
* @param array $parameters Parameters to add & drop.
|
* @param array $parameters Parameters to add & drop.
|
||||||
* @return array Array of table property alteration statementes.
|
* @return array Array of table property alteration statements.
|
||||||
* @todo Implement this method.
|
* @todo Implement this method.
|
||||||
*/
|
*/
|
||||||
protected function _alterTableParameters($table, $parameters) {
|
protected function _alterTableParameters($table, $parameters) {
|
||||||
|
@ -567,7 +567,7 @@ class Mysql extends DboSource {
|
||||||
protected function _alterIndexes($table, $indexes) {
|
protected function _alterIndexes($table, $indexes) {
|
||||||
$alter = array();
|
$alter = array();
|
||||||
if (isset($indexes['drop'])) {
|
if (isset($indexes['drop'])) {
|
||||||
foreach($indexes['drop'] as $name => $value) {
|
foreach ($indexes['drop'] as $name => $value) {
|
||||||
$out = 'DROP ';
|
$out = 'DROP ';
|
||||||
if ($name == 'PRIMARY') {
|
if ($name == 'PRIMARY') {
|
||||||
$out .= 'PRIMARY KEY';
|
$out .= 'PRIMARY KEY';
|
||||||
|
@ -603,7 +603,7 @@ class Mysql extends DboSource {
|
||||||
* Returns an detailed array of sources (tables) in the database.
|
* Returns an detailed array of sources (tables) in the database.
|
||||||
*
|
*
|
||||||
* @param string $name Table name to get parameters
|
* @param string $name Table name to get parameters
|
||||||
* @return array Array of tablenames in the database
|
* @return array Array of table names in the database
|
||||||
*/
|
*/
|
||||||
public function listDetailedSources($name = null) {
|
public function listDetailedSources($name = null) {
|
||||||
$condition = '';
|
$condition = '';
|
||||||
|
|
|
@ -153,7 +153,7 @@ class Postgres extends DboSource {
|
||||||
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @return array Array of tablenames in the database
|
* @return array Array of table names in the database
|
||||||
*/
|
*/
|
||||||
public function listSources($data = null) {
|
public function listSources($data = null) {
|
||||||
$cache = parent::listSources();
|
$cache = parent::listSources();
|
||||||
|
@ -296,7 +296,7 @@ class Postgres extends DboSource {
|
||||||
* Deletes all the records in a table and drops all associated auto-increment sequences
|
* Deletes all the records in a table and drops all associated auto-increment sequences
|
||||||
*
|
*
|
||||||
* @param mixed $table A string or model class representing the table to be truncated
|
* @param mixed $table A string or model class representing the table to be truncated
|
||||||
* @param boolean $reset true for resseting the sequence, false to leave it as is.
|
* @param boolean $reset true for resetting the sequence, false to leave it as is.
|
||||||
* and if 1, sequences are not modified
|
* and if 1, sequences are not modified
|
||||||
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
|
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
|
||||||
*/
|
*/
|
||||||
|
@ -338,7 +338,7 @@ class Postgres extends DboSource {
|
||||||
* Generates the fields list of an SQL query.
|
* Generates the fields list of an SQL query.
|
||||||
*
|
*
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @param string $alias Alias tablename
|
* @param string $alias Alias table name
|
||||||
* @param mixed $fields
|
* @param mixed $fields
|
||||||
* @param boolean $quote
|
* @param boolean $quote
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -398,7 +398,7 @@ class Postgres extends DboSource {
|
||||||
* Quotes the fields in a function call.
|
* Quotes the fields in a function call.
|
||||||
*
|
*
|
||||||
* @param string $match matched string
|
* @param string $match matched string
|
||||||
* @return string quoted strig
|
* @return string quoted string
|
||||||
*/
|
*/
|
||||||
protected function _quoteFunctionField($match) {
|
protected function _quoteFunctionField($match) {
|
||||||
$prepend = '';
|
$prepend = '';
|
||||||
|
@ -410,7 +410,7 @@ class Postgres extends DboSource {
|
||||||
|
|
||||||
if (!$constant && strpos($match[1], '.') === false) {
|
if (!$constant && strpos($match[1], '.') === false) {
|
||||||
$match[1] = $this->name($match[1]);
|
$match[1] = $this->name($match[1]);
|
||||||
} elseif (!$constant){
|
} elseif (!$constant) {
|
||||||
$parts = explode('.', $match[1]);
|
$parts = explode('.', $match[1]);
|
||||||
if (!Set::numeric($parts)) {
|
if (!Set::numeric($parts)) {
|
||||||
$match[1] = $this->name($match[1]);
|
$match[1] = $this->name($match[1]);
|
||||||
|
@ -551,7 +551,7 @@ class Postgres extends DboSource {
|
||||||
protected function _alterIndexes($table, $indexes) {
|
protected function _alterIndexes($table, $indexes) {
|
||||||
$alter = array();
|
$alter = array();
|
||||||
if (isset($indexes['drop'])) {
|
if (isset($indexes['drop'])) {
|
||||||
foreach($indexes['drop'] as $name => $value) {
|
foreach ($indexes['drop'] as $name => $value) {
|
||||||
$out = 'DROP ';
|
$out = 'DROP ';
|
||||||
if ($name == 'PRIMARY') {
|
if ($name == 'PRIMARY') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -708,7 +708,7 @@ class Postgres extends DboSource {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function fetchResult() {
|
public function fetchResult() {
|
||||||
if ($row = $this->_result->fetch()) {
|
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
|
||||||
$resultRow = array();
|
$resultRow = array();
|
||||||
|
|
||||||
foreach ($this->map as $index => $meta) {
|
foreach ($this->map as $index => $meta) {
|
||||||
|
@ -738,7 +738,7 @@ class Postgres extends DboSource {
|
||||||
* Translates between PHP boolean values and PostgreSQL boolean values
|
* Translates between PHP boolean values and PostgreSQL boolean values
|
||||||
*
|
*
|
||||||
* @param mixed $data Value to be translated
|
* @param mixed $data Value to be translated
|
||||||
* @param boolean $quote true to quote a boolean to be used in a query, flase to return the boolean value
|
* @param boolean $quote true to quote a boolean to be used in a query, false to return the boolean value
|
||||||
* @return boolean Converted boolean value
|
* @return boolean Converted boolean value
|
||||||
*/
|
*/
|
||||||
public function boolean($data, $quote = false) {
|
public function boolean($data, $quote = false) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ class Sqlite extends DboSource {
|
||||||
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @return array Array of tablenames in the database
|
* @return array Array of table names in the database
|
||||||
*/
|
*/
|
||||||
public function listSources($data = null) {
|
public function listSources($data = null) {
|
||||||
$cache = parent::listSources();
|
$cache = parent::listSources();
|
||||||
|
@ -286,9 +286,9 @@ class Sqlite extends DboSource {
|
||||||
}
|
}
|
||||||
} elseif (strpos($querystring, 'PRAGMA table_info') === 0) {
|
} elseif (strpos($querystring, 'PRAGMA table_info') === 0) {
|
||||||
$selects = array('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk');
|
$selects = array('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk');
|
||||||
} elseif(strpos($querystring, 'PRAGMA index_list') === 0) {
|
} elseif (strpos($querystring, 'PRAGMA index_list') === 0) {
|
||||||
$selects = array('seq', 'name', 'unique');
|
$selects = array('seq', 'name', 'unique');
|
||||||
} elseif(strpos($querystring, 'PRAGMA index_info') === 0) {
|
} elseif (strpos($querystring, 'PRAGMA index_info') === 0) {
|
||||||
$selects = array('seqno', 'cid', 'name');
|
$selects = array('seqno', 'cid', 'name');
|
||||||
}
|
}
|
||||||
while ($j < $num_fields) {
|
while ($j < $num_fields) {
|
||||||
|
@ -297,7 +297,7 @@ class Sqlite extends DboSource {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (preg_match('/\bAS\s+(.*)/i', $selects[$j], $matches)) {
|
if (preg_match('/\bAS\s+(.*)/i', $selects[$j], $matches)) {
|
||||||
$columnName = trim($matches[1],'"');
|
$columnName = trim($matches[1], '"');
|
||||||
} else {
|
} else {
|
||||||
$columnName = trim(str_replace('"', '', $selects[$j]));
|
$columnName = trim(str_replace('"', '', $selects[$j]));
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ class Sqlite extends DboSource {
|
||||||
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
|
* @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch
|
||||||
*/
|
*/
|
||||||
public function fetchResult() {
|
public function fetchResult() {
|
||||||
if ($row = $this->_result->fetch()) {
|
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
|
||||||
$resultRow = array();
|
$resultRow = array();
|
||||||
foreach ($this->map as $col => $meta) {
|
foreach ($this->map as $col => $meta) {
|
||||||
list($table, $column, $type) = $meta;
|
list($table, $column, $type) = $meta;
|
||||||
|
@ -460,7 +460,7 @@ class Sqlite extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overrides DboSource::index to handle SQLite indexe introspection
|
* Overrides DboSource::index to handle SQLite index introspection
|
||||||
* Returns an array of the indexes in given table name.
|
* Returns an array of the indexes in given table name.
|
||||||
*
|
*
|
||||||
* @param string $model Name of model to inspect
|
* @param string $model Name of model to inspect
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Sqlserver extends DboSource {
|
||||||
* Returns an array of sources (tables) in the database.
|
* Returns an array of sources (tables) in the database.
|
||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @return array Array of tablenames in the database
|
* @return array Array of table names in the database
|
||||||
*/
|
*/
|
||||||
public function listSources($data = null) {
|
public function listSources($data = null) {
|
||||||
$cache = parent::listSources();
|
$cache = parent::listSources();
|
||||||
|
@ -260,7 +260,7 @@ class Sqlserver extends DboSource {
|
||||||
* Generates the fields list of an SQL query.
|
* Generates the fields list of an SQL query.
|
||||||
*
|
*
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @param string $alias Alias tablename
|
* @param string $alias Alias table name
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @param boolean $quote
|
* @param boolean $quote
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -607,7 +607,7 @@ class Sqlserver extends DboSource {
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function fetchResult() {
|
public function fetchResult() {
|
||||||
if ($row = $this->_result->fetch()) {
|
if ($row = $this->_result->fetch(PDO::FETCH_NUM)) {
|
||||||
$resultRow = array();
|
$resultRow = array();
|
||||||
foreach ($this->map as $col => $meta) {
|
foreach ($this->map as $col => $meta) {
|
||||||
list($table, $column, $type) = $meta;
|
list($table, $column, $type) = $meta;
|
||||||
|
@ -748,8 +748,8 @@ class Sqlserver extends DboSource {
|
||||||
* @param string $sql SQL statement
|
* @param string $sql SQL statement
|
||||||
* @param array $params list of params to be bound to query (supported only in select)
|
* @param array $params list of params to be bound to query (supported only in select)
|
||||||
* @param array $prepareOptions Options to be used in the prepare statement
|
* @param array $prepareOptions Options to be used in the prepare statement
|
||||||
* @return mixed PDOStatement if query executes with no problem, true as the result of a succesfull, false on error
|
* @return mixed PDOStatement if query executes with no problem, true as the result of a successful, false on error
|
||||||
* query returning no rows, suchs as a CREATE statement, false otherwise
|
* query returning no rows, such as a CREATE statement, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
||||||
$this->_lastAffected = false;
|
$this->_lastAffected = false;
|
||||||
|
|
|
@ -135,7 +135,7 @@ class DboSource extends DataSource {
|
||||||
protected $_queriesLogMax = 200;
|
protected $_queriesLogMax = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches serialzed results of executed queries
|
* Caches serialized results of executed queries
|
||||||
*
|
*
|
||||||
* @var array Maximum number of queries in the queries log.
|
* @var array Maximum number of queries in the queries log.
|
||||||
*/
|
*/
|
||||||
|
@ -344,7 +344,7 @@ class DboSource extends DataSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object to represent a database identifier in a query. Expression objects
|
* Returns an object to represent a database identifier in a query. Expression objects
|
||||||
* are not sanitized or esacped.
|
* are not sanitized or escaped.
|
||||||
*
|
*
|
||||||
* @param string $identifier A SQL expression to be used as an identifier
|
* @param string $identifier A SQL expression to be used as an identifier
|
||||||
* @return stdClass An object representing a database identifier to be used in a query
|
* @return stdClass An object representing a database identifier to be used in a query
|
||||||
|
@ -358,7 +358,7 @@ class DboSource extends DataSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object to represent a database expression in a query. Expression objects
|
* Returns an object to represent a database expression in a query. Expression objects
|
||||||
* are not sanitized or esacped.
|
* are not sanitized or escaped.
|
||||||
*
|
*
|
||||||
* @param string $expression An arbitrary SQL expression to be inserted into a query.
|
* @param string $expression An arbitrary SQL expression to be inserted into a query.
|
||||||
* @return stdClass An object representing a database expression to be used in a query
|
* @return stdClass An object representing a database expression to be used in a query
|
||||||
|
@ -418,7 +418,7 @@ class DboSource extends DataSource {
|
||||||
* @param array $params list of params to be bound to query
|
* @param array $params list of params to be bound to query
|
||||||
* @param array $prepareOptions Options to be used in the prepare statement
|
* @param array $prepareOptions Options to be used in the prepare statement
|
||||||
* @return mixed PDOStatement if query executes with no problem, true as the result of a successful, false on error
|
* @return mixed PDOStatement if query executes with no problem, true as the result of a successful, false on error
|
||||||
* query returning no rows, suchs as a CREATE statement, false otherwise
|
* query returning no rows, such as a CREATE statement, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
protected function _execute($sql, $params = array(), $prepareOptions = array()) {
|
||||||
$sql = trim($sql);
|
$sql = trim($sql);
|
||||||
|
@ -744,7 +744,7 @@ class DboSource extends DataSource {
|
||||||
* A read will either return the value or null.
|
* A read will either return the value or null.
|
||||||
*
|
*
|
||||||
* @param string $method Name of the method being cached.
|
* @param string $method Name of the method being cached.
|
||||||
* @param string $key The keyname for the cache operation.
|
* @param string $key The key name for the cache operation.
|
||||||
* @param mixed $value The value to cache into memory.
|
* @param mixed $value The value to cache into memory.
|
||||||
* @return mixed Either null on failure, or the value if its set.
|
* @return mixed Either null on failure, or the value if its set.
|
||||||
*/
|
*/
|
||||||
|
@ -1807,7 +1807,7 @@ class DboSource extends DataSource {
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @param boolean $quoteValues If values should be quoted, or treated as SQL snippets
|
* @param boolean $quoteValues If values should be quoted, or treated as SQL snippets
|
||||||
* @param boolean $alias Include the model alias in the field name
|
* @param boolean $alias Include the model alias in the field name
|
||||||
* @return array Fields and values, quoted and preparted
|
* @return array Fields and values, quoted and prepared
|
||||||
*/
|
*/
|
||||||
protected function _prepareUpdateFields($model, $fields, $quoteValues = true, $alias = false) {
|
protected function _prepareUpdateFields($model, $fields, $quoteValues = true, $alias = false) {
|
||||||
$quotedAlias = $this->startQuote . $model->alias . $this->endQuote;
|
$quotedAlias = $this->startQuote . $model->alias . $this->endQuote;
|
||||||
|
@ -1963,7 +1963,7 @@ class DboSource extends DataSource {
|
||||||
if (!isset($params[1])) {
|
if (!isset($params[1])) {
|
||||||
$params[1] = 'count';
|
$params[1] = 'count';
|
||||||
}
|
}
|
||||||
if (is_object($model) && $model->isVirtualField($params[0])){
|
if (is_object($model) && $model->isVirtualField($params[0])) {
|
||||||
$arg = $this->_quoteFields($model->getVirtualField($params[0]));
|
$arg = $this->_quoteFields($model->getVirtualField($params[0]));
|
||||||
} else {
|
} else {
|
||||||
$arg = $this->name($params[0]);
|
$arg = $this->name($params[0]);
|
||||||
|
@ -2064,7 +2064,7 @@ class DboSource extends DataSource {
|
||||||
*
|
*
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @param mixed $conditions Array of conditions, conditions string, null or false. If an array of conditions,
|
* @param mixed $conditions Array of conditions, conditions string, null or false. If an array of conditions,
|
||||||
* or string conditions those conditions will be returned. With other values the model's existance will be checked.
|
* or string conditions those conditions will be returned. With other values the model's existence will be checked.
|
||||||
* If the model doesn't exist a null or false will be returned depending on the input value.
|
* If the model doesn't exist a null or false will be returned depending on the input value.
|
||||||
* @param boolean $useAlias Use model aliases rather than table names when generating conditions
|
* @param boolean $useAlias Use model aliases rather than table names when generating conditions
|
||||||
* @return mixed Either null, false, $conditions or an array of default conditions to use.
|
* @return mixed Either null, false, $conditions or an array of default conditions to use.
|
||||||
|
@ -2126,7 +2126,7 @@ class DboSource extends DataSource {
|
||||||
* Converts model virtual fields into sql expressions to be fetched later
|
* Converts model virtual fields into sql expressions to be fetched later
|
||||||
*
|
*
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @param string $alias Alias tablename
|
* @param string $alias Alias table name
|
||||||
* @param mixed $fields virtual fields to be used on query
|
* @param mixed $fields virtual fields to be used on query
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -2144,7 +2144,7 @@ class DboSource extends DataSource {
|
||||||
* Generates the fields list of an SQL query.
|
* Generates the fields list of an SQL query.
|
||||||
*
|
*
|
||||||
* @param Model $model
|
* @param Model $model
|
||||||
* @param string $alias Alias tablename
|
* @param string $alias Alias table name
|
||||||
* @param mixed $fields
|
* @param mixed $fields
|
||||||
* @param boolean $quote If false, returns fields array unquoted
|
* @param boolean $quote If false, returns fields array unquoted
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -2207,7 +2207,7 @@ class DboSource extends DataSource {
|
||||||
}
|
}
|
||||||
if (is_object($fields[$i]) && isset($fields[$i]->type) && $fields[$i]->type === 'expression') {
|
if (is_object($fields[$i]) && isset($fields[$i]->type) && $fields[$i]->type === 'expression') {
|
||||||
$fields[$i] = $fields[$i]->value;
|
$fields[$i] = $fields[$i]->value;
|
||||||
} elseif (preg_match('/^\(.*\)\s' . $this->alias . '.*/i', $fields[$i])){
|
} elseif (preg_match('/^\(.*\)\s' . $this->alias . '.*/i', $fields[$i])) {
|
||||||
continue;
|
continue;
|
||||||
} elseif (!preg_match('/^.+\\(.*\\)/', $fields[$i])) {
|
} elseif (!preg_match('/^.+\\(.*\\)/', $fields[$i])) {
|
||||||
$prepend = '';
|
$prepend = '';
|
||||||
|
@ -2521,7 +2521,7 @@ class DboSource extends DataSource {
|
||||||
* Auxiliary function to quote matches `Model.fields` from a preg_replace_callback call
|
* Auxiliary function to quote matches `Model.fields` from a preg_replace_callback call
|
||||||
*
|
*
|
||||||
* @param string $match matched string
|
* @param string $match matched string
|
||||||
* @return string quoted strig
|
* @return string quoted string
|
||||||
*/
|
*/
|
||||||
protected function _quoteMatchedField($match) {
|
protected function _quoteMatchedField($match) {
|
||||||
if (is_numeric($match[0])) {
|
if (is_numeric($match[0])) {
|
||||||
|
@ -2638,7 +2638,7 @@ class DboSource extends DataSource {
|
||||||
if (!is_array($group)) {
|
if (!is_array($group)) {
|
||||||
$group = array($group);
|
$group = array($group);
|
||||||
}
|
}
|
||||||
foreach($group as $index => $key) {
|
foreach ($group as $index => $key) {
|
||||||
if (is_object($model) && $model->isVirtualField($key)) {
|
if (is_object($model) && $model->isVirtualField($key)) {
|
||||||
$group[$index] = '(' . $model->getVirtualField($key) . ')';
|
$group[$index] = '(' . $model->getVirtualField($key) . ')';
|
||||||
}
|
}
|
||||||
|
@ -2893,7 +2893,7 @@ class DboSource extends DataSource {
|
||||||
/**
|
/**
|
||||||
* Generate a database-native column schema string
|
* Generate a database-native column schema string
|
||||||
*
|
*
|
||||||
* @param array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]),
|
* @param array $column An array structured like the following: array('name' => 'value', 'type' => 'value'[, options]),
|
||||||
* where options can be 'default', 'length', or 'key'.
|
* where options can be 'default', 'length', or 'key'.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -2927,7 +2927,7 @@ class DboSource extends DataSource {
|
||||||
$out .= '(' . $length . ')';
|
$out .= '(' . $length . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($column['type'] === 'integer' || $column['type'] === 'float' ) && isset($column['default']) && $column['default'] === '') {
|
if (($column['type'] === 'integer' || $column['type'] === 'float') && isset($column['default']) && $column['default'] === '') {
|
||||||
$column['default'] = null;
|
$column['default'] = null;
|
||||||
}
|
}
|
||||||
$out = $this->_buildFieldParameters($out, $column, 'beforeDefault');
|
$out = $this->_buildFieldParameters($out, $column, 'beforeDefault');
|
||||||
|
|
|
@ -47,13 +47,13 @@ class DatabaseSession implements CakeSessionHandlerInterface {
|
||||||
|
|
||||||
if (empty($modelName)) {
|
if (empty($modelName)) {
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'class' =>'Session',
|
'class' => 'Session',
|
||||||
'alias' => 'Session',
|
'alias' => 'Session',
|
||||||
'table' => 'cake_sessions',
|
'table' => 'cake_sessions',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'class' =>$modelName,
|
'class' => $modelName,
|
||||||
'alias' => 'Session',
|
'alias' => 'Session',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
App::uses('ClassRegistry', 'Utility');
|
App::uses('ClassRegistry', 'Utility');
|
||||||
App::uses('Validation', 'Utility');
|
App::uses('Validation', 'Utility');
|
||||||
App::uses('String', 'Utility');
|
App::uses('String', 'Utility');
|
||||||
|
App::uses('Set', 'Utility');
|
||||||
App::uses('BehaviorCollection', 'Model');
|
App::uses('BehaviorCollection', 'Model');
|
||||||
App::uses('ModelBehavior', 'Model');
|
App::uses('ModelBehavior', 'Model');
|
||||||
App::uses('ConnectionManager', 'Model');
|
App::uses('ConnectionManager', 'Model');
|
||||||
|
@ -544,7 +545,7 @@ class Model extends Object {
|
||||||
*/
|
*/
|
||||||
protected $_associationKeys = array(
|
protected $_associationKeys = array(
|
||||||
'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'),
|
'belongsTo' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'counterCache'),
|
||||||
'hasOne' => array('className', 'foreignKey','conditions', 'fields','order', 'dependent'),
|
'hasOne' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'dependent'),
|
||||||
'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
|
'hasMany' => array('className', 'foreignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'dependent', 'exclusive', 'finderQuery', 'counterQuery'),
|
||||||
'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery')
|
'hasAndBelongsToMany' => array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery')
|
||||||
);
|
);
|
||||||
|
@ -732,7 +733,7 @@ class Model extends Object {
|
||||||
/**
|
/**
|
||||||
* Handles the lazy loading of model associations by looking in the association arrays for the requested variable
|
* Handles the lazy loading of model associations by looking in the association arrays for the requested variable
|
||||||
*
|
*
|
||||||
* @param string $name variable tested for existance in class
|
* @param string $name variable tested for existence in class
|
||||||
* @return boolean true if the variable exists (if is a not loaded model association it will be created), false otherwise
|
* @return boolean true if the variable exists (if is a not loaded model association it will be created), false otherwise
|
||||||
*/
|
*/
|
||||||
public function __isset($name) {
|
public function __isset($name) {
|
||||||
|
@ -1403,7 +1404,7 @@ class Model extends Object {
|
||||||
* Returns a list of fields from the database, and sets the current model
|
* Returns a list of fields from the database, and sets the current model
|
||||||
* data (Model::$data) with the record found.
|
* data (Model::$data) with the record found.
|
||||||
*
|
*
|
||||||
* @param mixed $fields String of single fieldname, or an array of fieldnames.
|
* @param mixed $fields String of single field name, or an array of field names.
|
||||||
* @param mixed $id The ID of the record to read
|
* @param mixed $id The ID of the record to read
|
||||||
* @return array Array of database fields, or false if not found
|
* @return array Array of database fields, or false if not found
|
||||||
* @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read
|
* @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read
|
||||||
|
@ -1866,7 +1867,7 @@ class Model extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backwards compatible passtrough method for:
|
* Backwards compatible passthrough method for:
|
||||||
* saveMany(), validateMany(), saveAssociated() and validateAssociated()
|
* saveMany(), validateMany(), saveAssociated() and validateAssociated()
|
||||||
*
|
*
|
||||||
* Saves multiple individual records for a single model; Also works with a single record, as well as
|
* Saves multiple individual records for a single model; Also works with a single record, as well as
|
||||||
|
@ -2153,7 +2154,7 @@ class Model extends Object {
|
||||||
if (in_array($associations[$association], array('belongsTo', 'hasOne'))) {
|
if (in_array($associations[$association], array('belongsTo', 'hasOne'))) {
|
||||||
$validates = $this->{$association}->create($values) && $this->{$association}->validates($options);
|
$validates = $this->{$association}->create($values) && $this->{$association}->validates($options);
|
||||||
$return[$association][] = $validates;
|
$return[$association][] = $validates;
|
||||||
} elseif($associations[$association] === 'hasMany') {
|
} elseif ($associations[$association] === 'hasMany') {
|
||||||
$validates = $this->{$association}->validateMany($values, $options);
|
$validates = $this->{$association}->validateMany($values, $options);
|
||||||
$return[$association] = $validates;
|
$return[$association] = $validates;
|
||||||
}
|
}
|
||||||
|
@ -2266,11 +2267,17 @@ class Model extends Object {
|
||||||
if ($data['dependent'] === true) {
|
if ($data['dependent'] === true) {
|
||||||
|
|
||||||
$model = $this->{$assoc};
|
$model = $this->{$assoc};
|
||||||
$conditions = array($model->escapeField($data['foreignKey']) => $id);
|
|
||||||
if ($data['conditions']) {
|
if ($data['foreignKey'] === false && $data['conditions'] && in_array($this->name, $model->getAssociated('belongsTo'))) {
|
||||||
$conditions = array_merge((array)$data['conditions'], $conditions);
|
$model->recursive = 0;
|
||||||
|
$conditions = array($this->escapeField(null, $this->name) => $id);
|
||||||
|
} else {
|
||||||
|
$model->recursive = -1;
|
||||||
|
$conditions = array($model->escapeField($data['foreignKey']) => $id);
|
||||||
|
if ($data['conditions']) {
|
||||||
|
$conditions = array_merge((array)$data['conditions'], $conditions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$model->recursive = -1;
|
|
||||||
|
|
||||||
if (isset($data['exclusive']) && $data['exclusive']) {
|
if (isset($data['exclusive']) && $data['exclusive']) {
|
||||||
$model->deleteAll($conditions);
|
$model->deleteAll($conditions);
|
||||||
|
|
|
@ -185,7 +185,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
$query = $_GET;
|
$query = $_GET;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($query['/' . $this->url]);
|
unset($query['/' . str_replace('.', '_', $this->url)]);
|
||||||
if (strpos($this->url, '?') !== false) {
|
if (strpos($this->url, '?') !== false) {
|
||||||
list(, $querystr) = explode('?', $this->url);
|
list(, $querystr) = explode('?', $this->url);
|
||||||
parse_str($querystr, $queryArgs);
|
parse_str($querystr, $queryArgs);
|
||||||
|
@ -279,10 +279,10 @@ class CakeRequest implements ArrayAccess {
|
||||||
$docRootContainsWebroot = strpos($docRoot, $dir . '/' . $webroot);
|
$docRootContainsWebroot = strpos($docRoot, $dir . '/' . $webroot);
|
||||||
|
|
||||||
if (!empty($base) || !$docRootContainsWebroot) {
|
if (!empty($base) || !$docRootContainsWebroot) {
|
||||||
if (strpos($this->webroot, $dir) === false) {
|
if (strpos($this->webroot, '/' . $dir . '/') === false) {
|
||||||
$this->webroot .= $dir . '/' ;
|
$this->webroot .= $dir . '/' ;
|
||||||
}
|
}
|
||||||
if (strpos($this->webroot, $webroot) === false) {
|
if (strpos($this->webroot, '/' . $webroot . '/') === false) {
|
||||||
$this->webroot .= $webroot . '/';
|
$this->webroot .= $webroot . '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,7 +489,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
* ### Callback detectors
|
* ### Callback detectors
|
||||||
*
|
*
|
||||||
* Callback detectors allow you to provide a 'callback' type to handle the check. The callback will
|
* Callback detectors allow you to provide a 'callback' type to handle the check. The callback will
|
||||||
* recieve the request object as its only parameter.
|
* receive the request object as its only parameter.
|
||||||
*
|
*
|
||||||
* e.g `addDetector('custom', array('callback' => array('SomeClass', 'somemethod')));`
|
* e.g `addDetector('custom', array('callback' => array('SomeClass', 'somemethod')));`
|
||||||
*
|
*
|
||||||
|
|
|
@ -423,7 +423,7 @@ class CakeResponse {
|
||||||
* will have the same effect as only doing `header('WWW-Authenticate: Not-Negotiate');`
|
* will have the same effect as only doing `header('WWW-Authenticate: Not-Negotiate');`
|
||||||
*
|
*
|
||||||
* @param mixed $header. An array of header strings or a single header string
|
* @param mixed $header. An array of header strings or a single header string
|
||||||
* - an assotiative array of "header name" => "header value" is also accepted
|
* - an associative array of "header name" => "header value" is also accepted
|
||||||
* - an array of string headers is also accepted
|
* - an array of string headers is also accepted
|
||||||
* @param mixed $value. The header value.
|
* @param mixed $value. The header value.
|
||||||
* @return array list of headers to be sent
|
* @return array list of headers to be sent
|
||||||
|
@ -674,7 +674,7 @@ class CakeResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the correct headers to instruct the browser to dowload the response as a file.
|
* Sets the correct headers to instruct the browser to download the response as a file.
|
||||||
*
|
*
|
||||||
* @param string $filename the name of the file as the browser will download the response
|
* @param string $filename the name of the file as the browser will download the response
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DigestAuthentication {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrive information about the authetication
|
* Retrieve information about the authentication
|
||||||
*
|
*
|
||||||
* @param HttpSocket $http
|
* @param HttpSocket $http
|
||||||
* @param array $authInfo
|
* @param array $authInfo
|
||||||
|
|
|
@ -74,7 +74,7 @@ class HttpResponse implements ArrayAccess {
|
||||||
public $raw = '';
|
public $raw = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
|
@ -177,7 +177,7 @@ class HttpResponse implements ArrayAccess {
|
||||||
* Generic function to decode a $body with a given $encoding. Returns either an array with the keys
|
* Generic function to decode a $body with a given $encoding. Returns either an array with the keys
|
||||||
* 'body' and 'header' or false on failure.
|
* 'body' and 'header' or false on failure.
|
||||||
*
|
*
|
||||||
* @param string $body A string continaing the body to decode.
|
* @param string $body A string containing the body to decode.
|
||||||
* @param mixed $encoding Can be false in case no encoding is being used, or a string representing the encoding.
|
* @param mixed $encoding Can be false in case no encoding is being used, or a string representing the encoding.
|
||||||
* @return mixed Array of response headers and body or false.
|
* @return mixed Array of response headers and body or false.
|
||||||
*/
|
*/
|
||||||
|
@ -200,7 +200,7 @@ class HttpResponse implements ArrayAccess {
|
||||||
* Decodes a chunked message $body and returns either an array with the keys 'body' and 'header' or false as
|
* Decodes a chunked message $body and returns either an array with the keys 'body' and 'header' or false as
|
||||||
* a result.
|
* a result.
|
||||||
*
|
*
|
||||||
* @param string $body A string continaing the chunked body to decode.
|
* @param string $body A string containing the chunked body to decode.
|
||||||
* @return mixed Array of response headers and body or false.
|
* @return mixed Array of response headers and body or false.
|
||||||
* @throws SocketException
|
* @throws SocketException
|
||||||
*/
|
*/
|
||||||
|
@ -292,7 +292,7 @@ class HttpResponse implements ArrayAccess {
|
||||||
* Parses cookies in response headers.
|
* Parses cookies in response headers.
|
||||||
*
|
*
|
||||||
* @param array $header Header array containing one ore more 'Set-Cookie' headers.
|
* @param array $header Header array containing one ore more 'Set-Cookie' headers.
|
||||||
* @return mixed Either false on no cookies, or an array of cookies recieved.
|
* @return mixed Either false on no cookies, or an array of cookies received.
|
||||||
* @todo Make this 100% RFC 2965 confirm
|
* @todo Make this 100% RFC 2965 confirm
|
||||||
*/
|
*/
|
||||||
public function parseCookies($header) {
|
public function parseCookies($header) {
|
||||||
|
@ -420,7 +420,7 @@ class HttpResponse implements ArrayAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArrayAccess - 0ffset Set
|
* ArrayAccess - Offset Set
|
||||||
*
|
*
|
||||||
* @param mixed $offset
|
* @param mixed $offset
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
|
|
@ -618,7 +618,7 @@ class HttpSocket extends CakeSocket {
|
||||||
*
|
*
|
||||||
* @param mixed $uri Either A $uri array, or a request string. Will use $this->config if left empty.
|
* @param mixed $uri Either A $uri array, or a request string. Will use $this->config if left empty.
|
||||||
* @param string $uriTemplate The Uri template/format to use.
|
* @param string $uriTemplate The Uri template/format to use.
|
||||||
* @return mixed A fully qualified URL formated according to $uriTemplate, or false on failure
|
* @return mixed A fully qualified URL formatted according to $uriTemplate, or false on failure
|
||||||
*/
|
*/
|
||||||
protected function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pass@%host:%port/%path?%query#%fragment') {
|
protected function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pass@%host:%port/%path?%query#%fragment') {
|
||||||
if (is_string($uri)) {
|
if (is_string($uri)) {
|
||||||
|
@ -720,7 +720,7 @@ class HttpSocket extends CakeSocket {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function can be thought of as a reverse to PHP5's http_build_query(). It takes a given query string and turns it into an array and
|
* This function can be thought of as a reverse to PHP5's http_build_query(). It takes a given query string and turns it into an array and
|
||||||
* supports nesting by using the php bracket syntax. So this menas you can parse queries like:
|
* supports nesting by using the php bracket syntax. So this means you can parse queries like:
|
||||||
*
|
*
|
||||||
* - ?key[subKey]=value
|
* - ?key[subKey]=value
|
||||||
* - ?key[]=value1&key[]=value2
|
* - ?key[]=value1&key[]=value2
|
||||||
|
|
|
@ -56,7 +56,7 @@ class Dispatcher {
|
||||||
* to autoRender, via Controller::$autoRender, then Dispatcher will render the view.
|
* to autoRender, via Controller::$autoRender, then Dispatcher will render the view.
|
||||||
*
|
*
|
||||||
* Actions in CakePHP can be any public method on a controller, that is not declared in Controller. If you
|
* Actions in CakePHP can be any public method on a controller, that is not declared in Controller. If you
|
||||||
* want controller methods to be public and in-accesible by URL, then prefix them with a `_`.
|
* want controller methods to be public and in-accessible by URL, then prefix them with a `_`.
|
||||||
* For example `public function _loadPosts() { }` would not be accessible via URL. Private and protected methods
|
* For example `public function _loadPosts() { }` would not be accessible via URL. Private and protected methods
|
||||||
* are also not accessible via URL.
|
* are also not accessible via URL.
|
||||||
*
|
*
|
||||||
|
@ -272,7 +272,7 @@ class Dispatcher {
|
||||||
if ($parts[0] === 'theme') {
|
if ($parts[0] === 'theme') {
|
||||||
$themeName = $parts[1];
|
$themeName = $parts[1];
|
||||||
unset($parts[0], $parts[1]);
|
unset($parts[0], $parts[1]);
|
||||||
$fileFragment = implode(DS, $parts);
|
$fileFragment = urldecode(implode(DS, $parts));
|
||||||
$path = App::themePath($themeName) . 'webroot' . DS;
|
$path = App::themePath($themeName) . 'webroot' . DS;
|
||||||
if (file_exists($path . $fileFragment)) {
|
if (file_exists($path . $fileFragment)) {
|
||||||
$assetFile = $path . $fileFragment;
|
$assetFile = $path . $fileFragment;
|
||||||
|
@ -281,7 +281,7 @@ class Dispatcher {
|
||||||
$plugin = Inflector::camelize($parts[0]);
|
$plugin = Inflector::camelize($parts[0]);
|
||||||
if (CakePlugin::loaded($plugin)) {
|
if (CakePlugin::loaded($plugin)) {
|
||||||
unset($parts[0]);
|
unset($parts[0]);
|
||||||
$fileFragment = implode(DS, $parts);
|
$fileFragment = urldecode(implode(DS, $parts));
|
||||||
$pluginWebroot = CakePlugin::path($plugin) . 'webroot' . DS;
|
$pluginWebroot = CakePlugin::path($plugin) . 'webroot' . DS;
|
||||||
if (file_exists($pluginWebroot . $fileFragment)) {
|
if (file_exists($pluginWebroot . $fileFragment)) {
|
||||||
$assetFile = $pluginWebroot . $fileFragment;
|
$assetFile = $pluginWebroot . $fileFragment;
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* A single Route used by the Router to connect requests to
|
|
||||||
* parameter maps.
|
|
||||||
*
|
|
||||||
* Not normally created as a standalone. Use Router::connect() to create
|
|
||||||
* Routes for your application.
|
|
||||||
*
|
|
||||||
* PHP5
|
|
||||||
*
|
|
||||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
*
|
*
|
||||||
|
@ -16,10 +8,20 @@
|
||||||
*
|
*
|
||||||
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
* @link http://cakephp.org CakePHP(tm) Project
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
* @package Cake.Routing.Route
|
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
App::uses('Set', 'Utility');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A single Route used by the Router to connect requests to
|
||||||
|
* parameter maps.
|
||||||
|
*
|
||||||
|
* Not normally created as a standalone. Use Router::connect() to create
|
||||||
|
* Routes for your application.
|
||||||
|
*
|
||||||
|
* @package Cake.Routing.Route
|
||||||
|
*/
|
||||||
class CakeRoute {
|
class CakeRoute {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +62,7 @@ class CakeRoute {
|
||||||
protected $_greedy = false;
|
protected $_greedy = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The compiled route regular expresssion
|
* The compiled route regular expression
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -237,7 +239,7 @@ class CakeRoute {
|
||||||
// restructure 'pass' key route params
|
// restructure 'pass' key route params
|
||||||
if (isset($this->options['pass'])) {
|
if (isset($this->options['pass'])) {
|
||||||
$j = count($this->options['pass']);
|
$j = count($this->options['pass']);
|
||||||
while($j--) {
|
while ($j--) {
|
||||||
if (isset($route[$this->options['pass'][$j]])) {
|
if (isset($route[$this->options['pass'][$j]])) {
|
||||||
array_unshift($route['pass'], $route[$this->options['pass'][$j]]);
|
array_unshift($route['pass'], $route[$this->options['pass'][$j]]);
|
||||||
}
|
}
|
||||||
|
@ -349,7 +351,7 @@ class CakeRoute {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply persistent parameters to a url array. Persistant parameters are a special
|
* Apply persistent parameters to a url array. Persistent parameters are a special
|
||||||
* key used during route creation to force route parameters to persist when omitted from
|
* key used during route creation to force route parameters to persist when omitted from
|
||||||
* a url array.
|
* a url array.
|
||||||
*
|
*
|
||||||
|
@ -483,7 +485,8 @@ class CakeRoute {
|
||||||
$named = array();
|
$named = array();
|
||||||
foreach ($params['named'] as $key => $value) {
|
foreach ($params['named'] as $key => $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
foreach ($value as $namedKey => $namedValue) {
|
$flat = Set::flatten($value, '][');
|
||||||
|
foreach ($flat as $namedKey => $namedValue) {
|
||||||
$named[] = $key . "[$namedKey]" . $separator . rawurlencode($namedValue);
|
$named[] = $key . "[$namedKey]" . $separator . rawurlencode($namedValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -256,7 +256,7 @@ class BasicsTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = am(array('one' => array(2, 3), 'two' => array('foo')), array('one' => array(4, 5)));
|
$result = am(array('one' => array(2, 3), 'two' => array('foo')), array('one' => array(4, 5)));
|
||||||
$expected = array('one' => array(4, 5),'two' => array('foo'));
|
$expected = array('one' => array(4, 5), 'two' => array('foo'));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,19 @@ class CacheTest extends CakeTestCase {
|
||||||
$read = Cache::read('Test', 'invalid');
|
$read = Cache::read('Test', 'invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test reading from a config that is undefined.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadNonExistingConfig() {
|
||||||
|
$this->assertFalse(Cache::read('key', 'totally fake'));
|
||||||
|
$this->assertFalse(Cache::write('key', 'value', 'totally fake'));
|
||||||
|
$this->assertFalse(Cache::increment('key', 1, 'totally fake'));
|
||||||
|
$this->assertFalse(Cache::decrement('key', 1, 'totally fake'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that trying to configure classes that don't extend CacheEngine fail.
|
* test that trying to configure classes that don't extend CacheEngine fail.
|
||||||
*
|
*
|
||||||
|
@ -148,10 +161,10 @@ class CacheTest extends CakeTestCase {
|
||||||
$_cacheConfigSessions = Cache::config('sessions');
|
$_cacheConfigSessions = Cache::config('sessions');
|
||||||
$_cacheConfigTests = Cache::config('tests');
|
$_cacheConfigTests = Cache::config('tests');
|
||||||
|
|
||||||
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions'));
|
$result = Cache::config('sessions', array('engine' => 'File', 'path' => TMP . 'sessions'));
|
||||||
$this->assertEquals($result['settings'], Cache::settings('sessions'));
|
$this->assertEquals($result['settings'], Cache::settings('sessions'));
|
||||||
|
|
||||||
$result = Cache::config('tests', array('engine'=> 'File', 'path' => TMP . 'tests'));
|
$result = Cache::config('tests', array('engine' => 'File', 'path' => TMP . 'tests'));
|
||||||
$this->assertEquals($result['settings'], Cache::settings('tests'));
|
$this->assertEquals($result['settings'], Cache::settings('tests'));
|
||||||
|
|
||||||
Cache::config('sessions', $_cacheConfigSessions['settings']);
|
Cache::config('sessions', $_cacheConfigSessions['settings']);
|
||||||
|
@ -322,7 +335,7 @@ class CacheTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testCacheDisable() {
|
public function testCacheDisable() {
|
||||||
Configure::write('Cache.disable', false);
|
Configure::write('Cache.disable', false);
|
||||||
Cache::config('test_cache_disable_1', array('engine'=> 'File', 'path' => TMP . 'tests'));
|
Cache::config('test_cache_disable_1', array('engine' => 'File', 'path' => TMP . 'tests'));
|
||||||
|
|
||||||
$this->assertTrue(Cache::write('key_1', 'hello', 'test_cache_disable_1'));
|
$this->assertTrue(Cache::write('key_1', 'hello', 'test_cache_disable_1'));
|
||||||
$this->assertSame(Cache::read('key_1', 'test_cache_disable_1'), 'hello');
|
$this->assertSame(Cache::read('key_1', 'test_cache_disable_1'), 'hello');
|
||||||
|
@ -338,7 +351,7 @@ class CacheTest extends CakeTestCase {
|
||||||
$this->assertSame(Cache::read('key_3', 'test_cache_disable_1'), 'hello');
|
$this->assertSame(Cache::read('key_3', 'test_cache_disable_1'), 'hello');
|
||||||
|
|
||||||
Configure::write('Cache.disable', true);
|
Configure::write('Cache.disable', true);
|
||||||
Cache::config('test_cache_disable_2', array('engine'=> 'File', 'path' => TMP . 'tests'));
|
Cache::config('test_cache_disable_2', array('engine' => 'File', 'path' => TMP . 'tests'));
|
||||||
|
|
||||||
$this->assertFalse(Cache::write('key_4', 'hello', 'test_cache_disable_2'));
|
$this->assertFalse(Cache::write('key_4', 'hello', 'test_cache_disable_2'));
|
||||||
$this->assertFalse(Cache::read('key_4', 'test_cache_disable_2'));
|
$this->assertFalse(Cache::read('key_4', 'test_cache_disable_2'));
|
||||||
|
|
|
@ -61,10 +61,10 @@ class FileEngineTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCacheDirChange() {
|
public function testCacheDirChange() {
|
||||||
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'sessions'));
|
$result = Cache::config('sessions', array('engine' => 'File', 'path' => TMP . 'sessions'));
|
||||||
$this->assertEquals($result['settings'], Cache::settings('sessions'));
|
$this->assertEquals($result['settings'], Cache::settings('sessions'));
|
||||||
|
|
||||||
$result = Cache::config('sessions', array('engine'=> 'File', 'path' => TMP . 'tests'));
|
$result = Cache::config('sessions', array('engine' => 'File', 'path' => TMP . 'tests'));
|
||||||
$this->assertEquals($result['settings'], Cache::settings('sessions'));
|
$this->assertEquals($result['settings'], Cache::settings('sessions'));
|
||||||
$this->assertNotEquals($result['settings'], Cache::settings('default'));
|
$this->assertNotEquals($result['settings'], Cache::settings('default'));
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ class FileEngineTest extends CakeTestCase {
|
||||||
public function testRemoveWindowsSlashesFromCache() {
|
public function testRemoveWindowsSlashesFromCache() {
|
||||||
Cache::config('windows_test', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP));
|
Cache::config('windows_test', array('engine' => 'File', 'isWindows' => true, 'prefix' => null, 'path' => TMP));
|
||||||
|
|
||||||
$expected = array (
|
$expected = array(
|
||||||
'C:\dev\prj2\sites\cake\libs' => array(
|
'C:\dev\prj2\sites\cake\libs' => array(
|
||||||
0 => 'C:\dev\prj2\sites\cake\libs', 1 => 'C:\dev\prj2\sites\cake\libs\view',
|
0 => 'C:\dev\prj2\sites\cake\libs', 1 => 'C:\dev\prj2\sites\cake\libs\view',
|
||||||
2 => 'C:\dev\prj2\sites\cake\libs\view\scaffolds', 3 => 'C:\dev\prj2\sites\cake\libs\view\pages',
|
2 => 'C:\dev\prj2\sites\cake\libs\view\scaffolds', 3 => 'C:\dev\prj2\sites\cake\libs\view\pages',
|
||||||
|
|
|
@ -81,7 +81,7 @@ class MemcacheEngineTest extends CakeTestCase {
|
||||||
unset($settings['serialize'], $settings['path']);
|
unset($settings['serialize'], $settings['path']);
|
||||||
$expecting = array(
|
$expecting = array(
|
||||||
'prefix' => 'cake_',
|
'prefix' => 'cake_',
|
||||||
'duration'=> 3600,
|
'duration' => 3600,
|
||||||
'probability' => 100,
|
'probability' => 100,
|
||||||
'servers' => array('127.0.0.1'),
|
'servers' => array('127.0.0.1'),
|
||||||
'persistent' => true,
|
'persistent' => true,
|
||||||
|
@ -102,7 +102,7 @@ class MemcacheEngineTest extends CakeTestCase {
|
||||||
$available = true;
|
$available = true;
|
||||||
$Memcache = new Memcache();
|
$Memcache = new Memcache();
|
||||||
|
|
||||||
foreach($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
list($host, $port) = explode(':', $server);
|
list($host, $port) = explode(':', $server);
|
||||||
if (!@$Memcache->connect($host, $port)) {
|
if (!@$Memcache->connect($host, $port)) {
|
||||||
$available = false;
|
$available = false;
|
||||||
|
@ -312,12 +312,12 @@ class MemcacheEngineTest extends CakeTestCase {
|
||||||
public function testConfigurationConflict() {
|
public function testConfigurationConflict() {
|
||||||
Cache::config('long_memcache', array(
|
Cache::config('long_memcache', array(
|
||||||
'engine' => 'Memcache',
|
'engine' => 'Memcache',
|
||||||
'duration'=> '+2 seconds',
|
'duration' => '+2 seconds',
|
||||||
'servers' => array('127.0.0.1:11211'),
|
'servers' => array('127.0.0.1:11211'),
|
||||||
));
|
));
|
||||||
Cache::config('short_memcache', array(
|
Cache::config('short_memcache', array(
|
||||||
'engine' => 'Memcache',
|
'engine' => 'Memcache',
|
||||||
'duration'=> '+1 seconds',
|
'duration' => '+1 seconds',
|
||||||
'servers' => array('127.0.0.1:11211'),
|
'servers' => array('127.0.0.1:11211'),
|
||||||
));
|
));
|
||||||
Cache::config('some_file', array('engine' => 'File'));
|
Cache::config('some_file', array('engine' => 'File'));
|
||||||
|
|
|
@ -59,7 +59,7 @@ class XcacheEngineTest extends CakeTestCase {
|
||||||
$settings = Cache::settings();
|
$settings = Cache::settings();
|
||||||
$expecting = array(
|
$expecting = array(
|
||||||
'prefix' => 'cake_',
|
'prefix' => 'cake_',
|
||||||
'duration'=> 3600,
|
'duration' => 3600,
|
||||||
'probability' => 100,
|
'probability' => 100,
|
||||||
'engine' => 'Xcache',
|
'engine' => 'Xcache',
|
||||||
);
|
);
|
||||||
|
|
|
@ -83,21 +83,38 @@ class BakeShellTest extends CakeTestCase {
|
||||||
$this->Shell->View = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
|
$this->Shell->View = $this->getMock('ModelTask', array(), array(&$this->Dispatcher));
|
||||||
$this->Shell->DbConfig = $this->getMock('DbConfigTask', array(), array(&$this->Dispatcher));
|
$this->Shell->DbConfig = $this->getMock('DbConfigTask', array(), array(&$this->Dispatcher));
|
||||||
|
|
||||||
$this->Shell->DbConfig->expects($this->once())->method('getConfig')->will($this->returnValue('test'));
|
$this->Shell->DbConfig->expects($this->once())
|
||||||
|
->method('getConfig')
|
||||||
|
->will($this->returnValue('test'));
|
||||||
|
|
||||||
$this->Shell->Model->expects($this->never())->method('getName');
|
$this->Shell->Model->expects($this->never())
|
||||||
$this->Shell->Model->expects($this->once())->method('bake')->will($this->returnValue(true));
|
->method('getName');
|
||||||
|
|
||||||
|
$this->Shell->Model->expects($this->once())
|
||||||
|
->method('bake')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
$this->Shell->Controller->expects($this->once())->method('bake')->will($this->returnValue(true));
|
$this->Shell->Controller->expects($this->once())
|
||||||
$this->Shell->View->expects($this->once())->method('execute');
|
->method('bake')
|
||||||
|
->will($this->returnValue(true));
|
||||||
|
|
||||||
|
$this->Shell->View->expects($this->once())
|
||||||
|
->method('execute');
|
||||||
|
|
||||||
$this->Shell->expects($this->once())->method('_stop');
|
$this->Shell->expects($this->once())->method('_stop');
|
||||||
$this->Shell->expects($this->at(0))->method('out')->with('Bake All');
|
$this->Shell->expects($this->at(0))
|
||||||
$this->Shell->expects($this->at(5))->method('out')->with('<success>Bake All complete</success>');
|
->method('out')
|
||||||
|
->with('Bake All');
|
||||||
|
|
||||||
|
$this->Shell->expects($this->at(5))
|
||||||
|
->method('out')
|
||||||
|
->with('<success>Bake All complete</success>');
|
||||||
|
|
||||||
$this->Shell->connection = '';
|
$this->Shell->connection = '';
|
||||||
$this->Shell->params = array();
|
$this->Shell->params = array();
|
||||||
$this->Shell->args = array('User');
|
$this->Shell->args = array('User');
|
||||||
$this->Shell->all();
|
$this->Shell->all();
|
||||||
|
|
||||||
|
$this->assertEquals('User', $this->Shell->View->args[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,12 +353,12 @@ class SchemaShellTest extends CakeTestCase {
|
||||||
$contents = $this->file->read();
|
$contents = $this->file->read();
|
||||||
|
|
||||||
$this->assertRegExp('/class TestPluginSchema/', $contents);
|
$this->assertRegExp('/class TestPluginSchema/', $contents);
|
||||||
$this->assertRegExp('/var \$posts/', $contents);
|
$this->assertRegExp('/public \$posts/', $contents);
|
||||||
$this->assertRegExp('/var \$auth_users/', $contents);
|
$this->assertRegExp('/public \$auth_users/', $contents);
|
||||||
$this->assertRegExp('/var \$authors/', $contents);
|
$this->assertRegExp('/public \$authors/', $contents);
|
||||||
$this->assertRegExp('/var \$test_plugin_comments/', $contents);
|
$this->assertRegExp('/public \$test_plugin_comments/', $contents);
|
||||||
$this->assertNotRegExp('/var \$users/', $contents);
|
$this->assertNotRegExp('/public \$users/', $contents);
|
||||||
$this->assertNotRegExp('/var \$articles/', $contents);
|
$this->assertNotRegExp('/public \$articles/', $contents);
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,8 +274,8 @@ class ControllerTaskTest extends CakeTestCase {
|
||||||
$this->assertContains(' * @property AclComponent $Acl', $result);
|
$this->assertContains(' * @property AclComponent $Acl', $result);
|
||||||
$this->assertContains(' * @property AuthComponent $Auth', $result);
|
$this->assertContains(' * @property AuthComponent $Auth', $result);
|
||||||
$this->assertContains('class ArticlesController extends AppController', $result);
|
$this->assertContains('class ArticlesController extends AppController', $result);
|
||||||
$this->assertContains("\$components = array('Acl', 'Auth')", $result);
|
$this->assertContains("public \$components = array('Acl', 'Auth')", $result);
|
||||||
$this->assertContains("\$helpers = array('Ajax', 'Time')", $result);
|
$this->assertContains("public \$helpers = array('Ajax', 'Time')", $result);
|
||||||
$this->assertContains("--actions--", $result);
|
$this->assertContains("--actions--", $result);
|
||||||
|
|
||||||
$result = $this->Task->bake('Articles', 'scaffold', $helpers, $components);
|
$result = $this->Task->bake('Articles', 'scaffold', $helpers, $components);
|
||||||
|
|
|
@ -21,6 +21,7 @@ App::uses('ShellDispatcher', 'Console');
|
||||||
App::uses('Shell', 'Console');
|
App::uses('Shell', 'Console');
|
||||||
App::uses('ConsoleOutput', 'Console');
|
App::uses('ConsoleOutput', 'Console');
|
||||||
App::uses('ConsoleInput', 'Console');
|
App::uses('ConsoleInput', 'Console');
|
||||||
|
App::uses('ModelTask', 'Console/Command/Task');
|
||||||
App::uses('FixtureTask', 'Console/Command/Task');
|
App::uses('FixtureTask', 'Console/Command/Task');
|
||||||
App::uses('TemplateTask', 'Console/Command/Task');
|
App::uses('TemplateTask', 'Console/Command/Task');
|
||||||
App::uses('DbConfigTask', 'Console/Command/Task');
|
App::uses('DbConfigTask', 'Console/Command/Task');
|
||||||
|
|
|
@ -109,33 +109,32 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testListAll() {
|
public function testListAllArgument() {
|
||||||
$count = count($this->Task->listAll('test'));
|
|
||||||
if ($count != count($this->fixtures)) {
|
|
||||||
$this->markTestSkipped('Additional tables detected.');
|
|
||||||
}
|
|
||||||
$this->_useMockedOut();
|
$this->_useMockedOut();
|
||||||
|
|
||||||
$this->Task->expects($this->at(1))->method('out')->with('1. BakeArticle');
|
|
||||||
$this->Task->expects($this->at(2))->method('out')->with('2. BakeArticlesBakeTag');
|
|
||||||
$this->Task->expects($this->at(3))->method('out')->with('3. BakeComment');
|
|
||||||
$this->Task->expects($this->at(4))->method('out')->with('4. BakeTag');
|
|
||||||
$this->Task->expects($this->at(5))->method('out')->with('5. CategoryThread');
|
|
||||||
|
|
||||||
$this->Task->expects($this->at(7))->method('out')->with('1. BakeArticle');
|
|
||||||
$this->Task->expects($this->at(8))->method('out')->with('2. BakeArticlesBakeTag');
|
|
||||||
$this->Task->expects($this->at(9))->method('out')->with('3. BakeComment');
|
|
||||||
$this->Task->expects($this->at(10))->method('out')->with('4. BakeTag');
|
|
||||||
$this->Task->expects($this->at(11))->method('out')->with('5. CategoryThread');
|
|
||||||
|
|
||||||
$result = $this->Task->listAll('test');
|
$result = $this->Task->listAll('test');
|
||||||
$expected = array('bake_articles', 'bake_articles_bake_tags', 'bake_comments', 'bake_tags', 'category_threads');
|
$this->assertContains('bake_articles', $result);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertContains('bake_articles_bake_tags', $result);
|
||||||
|
$this->assertContains('bake_tags', $result);
|
||||||
|
$this->assertContains('bake_comments', $result);
|
||||||
|
$this->assertContains('category_threads', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that listAll uses the connection property
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testListAllConnection() {
|
||||||
|
$this->_useMockedOut();
|
||||||
|
|
||||||
$this->Task->connection = 'test';
|
$this->Task->connection = 'test';
|
||||||
$result = $this->Task->listAll();
|
$result = $this->Task->listAll();
|
||||||
$expected = array('bake_articles', 'bake_articles_bake_tags', 'bake_comments', 'bake_tags', 'category_threads');
|
$this->assertContains('bake_articles', $result);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertContains('bake_articles_bake_tags', $result);
|
||||||
|
$this->assertContains('bake_tags', $result);
|
||||||
|
$this->assertContains('bake_comments', $result);
|
||||||
|
$this->assertContains('category_threads', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,6 +200,39 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test getTable with non-conventional tablenames
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetTableOddTable() {
|
||||||
|
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
|
||||||
|
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
|
||||||
|
$this->Task = $this->getMock('ModelTask',
|
||||||
|
array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables'),
|
||||||
|
array($out, $out, $in)
|
||||||
|
);
|
||||||
|
$this->_setupOtherMocks();
|
||||||
|
|
||||||
|
$this->Task->connection = 'test';
|
||||||
|
$this->Task->path = '/my/path/';
|
||||||
|
$this->Task->interactive = true;
|
||||||
|
|
||||||
|
$this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
|
||||||
|
$this->Task->expects($this->any())->method('in')
|
||||||
|
->will($this->onConsecutiveCalls(
|
||||||
|
2 // bake_odd
|
||||||
|
));
|
||||||
|
|
||||||
|
$result = $this->Task->getName();
|
||||||
|
$expected = 'BakeOdd';
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$result = $this->Task->getTable($result);
|
||||||
|
$expected = 'bake_odd';
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that initializing the validations works.
|
* test that initializing the validations works.
|
||||||
*
|
*
|
||||||
|
@ -549,7 +581,7 @@ class ModelTaskTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that the fixutre object is correctly called.
|
* Ensure that the fixture object is correctly called.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -861,9 +893,17 @@ STRINGEND;
|
||||||
$this->Task->expects($this->at(3))->method('createFile')
|
$this->Task->expects($this->at(3))->method('createFile')
|
||||||
->with($filename, $this->stringContains('class BakeComment'));
|
->with($filename, $this->stringContains('class BakeComment'));
|
||||||
|
|
||||||
|
$filename = '/my/path/BakeComment.php';
|
||||||
|
$this->Task->expects($this->at(3))->method('createFile')
|
||||||
|
->with($filename, $this->stringContains('public $primaryKey = \'otherid\';'));
|
||||||
|
|
||||||
$filename = '/my/path/BakeTag.php';
|
$filename = '/my/path/BakeTag.php';
|
||||||
$this->Task->expects($this->at(4))
|
$this->Task->expects($this->at(4))->method('createFile')
|
||||||
->method('createFile')->with($filename, $this->stringContains('class BakeTag'));
|
->with($filename, $this->stringContains('class BakeTag'));
|
||||||
|
|
||||||
|
$filename = '/my/path/BakeTag.php';
|
||||||
|
$this->Task->expects($this->at(4))->method('createFile')
|
||||||
|
->with($filename, $this->logicalNot($this->stringContains('public $primaryKey')));
|
||||||
|
|
||||||
$filename = '/my/path/CategoryThread.php';
|
$filename = '/my/path/CategoryThread.php';
|
||||||
$this->Task->expects($this->at(5))->method('createFile')
|
$this->Task->expects($this->at(5))->method('createFile')
|
||||||
|
@ -875,6 +915,61 @@ STRINGEND;
|
||||||
$this->assertEquals(count(ClassRegistry::mapKeys()), 0);
|
$this->assertEquals(count(ClassRegistry::mapKeys()), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that odd tablenames arent inflected back from modelname
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testExecuteIntoAllOddTables() {
|
||||||
|
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
|
||||||
|
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
|
||||||
|
$this->Task = $this->getMock('ModelTask',
|
||||||
|
array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables', '_getModelObject', 'bake', 'bakeFixture'),
|
||||||
|
array($out, $out, $in)
|
||||||
|
);
|
||||||
|
$this->_setupOtherMocks();
|
||||||
|
|
||||||
|
$this->Task->connection = 'test';
|
||||||
|
$this->Task->path = '/my/path/';
|
||||||
|
$this->Task->args = array('all');
|
||||||
|
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
|
||||||
|
$this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('bake_odd')));
|
||||||
|
$object = new Model(array('name' => 'BakeOdd', 'table' => 'bake_odd', 'ds' => 'test'));
|
||||||
|
$this->Task->expects($this->once())->method('_getModelObject')->with('BakeOdd', 'bake_odd')->will($this->returnValue($object));
|
||||||
|
$this->Task->expects($this->at(3))->method('bake')->with($object, false)->will($this->returnValue(true));
|
||||||
|
$this->Task->expects($this->once())->method('bakeFixture')->with('BakeOdd', 'bake_odd');
|
||||||
|
|
||||||
|
$this->Task->execute();
|
||||||
|
|
||||||
|
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
|
||||||
|
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
|
||||||
|
$this->Task = $this->getMock('ModelTask',
|
||||||
|
array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables', '_getModelObject', 'doAssociations', 'doValidation', 'createFile'),
|
||||||
|
array($out, $out, $in)
|
||||||
|
);
|
||||||
|
$this->_setupOtherMocks();
|
||||||
|
|
||||||
|
$this->Task->connection = 'test';
|
||||||
|
$this->Task->path = '/my/path/';
|
||||||
|
$this->Task->args = array('all');
|
||||||
|
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
|
||||||
|
$this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('bake_odd')));
|
||||||
|
$object = new Model(array('name' => 'BakeOdd', 'table' => 'bake_odd', 'ds' => 'test'));
|
||||||
|
$this->Task->expects($this->once())->method('_getModelObject')->will($this->returnValue($object));
|
||||||
|
$this->Task->expects($this->once())->method('doAssociations')->will($this->returnValue(array()));
|
||||||
|
$this->Task->expects($this->once())->method('doValidation')->will($this->returnValue(array()));
|
||||||
|
|
||||||
|
$filename = '/my/path/BakeOdd.php';
|
||||||
|
$this->Task->expects($this->once())->method('createFile')
|
||||||
|
->with($filename, $this->stringContains('class BakeOdd'));
|
||||||
|
|
||||||
|
$filename = '/my/path/BakeOdd.php';
|
||||||
|
$this->Task->expects($this->once())->method('createFile')
|
||||||
|
->with($filename, $this->stringContains('public $useTable = \'bake_odd\''));
|
||||||
|
|
||||||
|
$this->Task->execute();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that skipTables changes how all() works.
|
* test that skipTables changes how all() works.
|
||||||
*
|
*
|
||||||
|
@ -920,10 +1015,8 @@ STRINGEND;
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testExecuteIntoInteractive() {
|
public function testExecuteIntoInteractive() {
|
||||||
$count = count($this->Task->listAll('test'));
|
$tables = $this->Task->listAll('test');
|
||||||
if ($count != count($this->fixtures)) {
|
$article = array_search('bake_articles', $tables) + 1;
|
||||||
$this->markTestSkipped('Additional tables detected.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->Task->connection = 'test';
|
$this->Task->connection = 'test';
|
||||||
$this->Task->path = '/my/path/';
|
$this->Task->path = '/my/path/';
|
||||||
|
@ -931,7 +1024,7 @@ STRINGEND;
|
||||||
|
|
||||||
$this->Task->expects($this->any())->method('in')
|
$this->Task->expects($this->any())->method('in')
|
||||||
->will($this->onConsecutiveCalls(
|
->will($this->onConsecutiveCalls(
|
||||||
'1', // article
|
$article, // article
|
||||||
'n', // no validation
|
'n', // no validation
|
||||||
'y', // associations
|
'y', // associations
|
||||||
'y', // comment relation
|
'y', // comment relation
|
||||||
|
|
|
@ -163,6 +163,7 @@ class FormAuthenticateTest extends CakeTestCase {
|
||||||
), true);
|
), true);
|
||||||
CakePlugin::load('TestPlugin');
|
CakePlugin::load('TestPlugin');
|
||||||
|
|
||||||
|
$ts = date('Y-m-d H:i:s');
|
||||||
$PluginModel = ClassRegistry::init('TestPlugin.TestPluginAuthUser');
|
$PluginModel = ClassRegistry::init('TestPlugin.TestPluginAuthUser');
|
||||||
$user['id'] = 1;
|
$user['id'] = 1;
|
||||||
$user['username'] = 'gwoo';
|
$user['username'] = 'gwoo';
|
||||||
|
@ -184,7 +185,7 @@ class FormAuthenticateTest extends CakeTestCase {
|
||||||
'username' => 'gwoo',
|
'username' => 'gwoo',
|
||||||
'created' => '2007-03-17 01:16:23'
|
'created' => '2007-03-17 01:16:23'
|
||||||
);
|
);
|
||||||
$this->assertTrue($result['updated'] >= date('Y-m-d H:i:s'));
|
$this->assertTrue($result['updated'] >= $ts);
|
||||||
unset($result['updated']);
|
unset($result['updated']);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
|
|
|
@ -671,6 +671,11 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
$this->Controller->request->query['url'] = Router::normalize($url);
|
$this->Controller->request->query['url'] = Router::normalize($url);
|
||||||
|
|
||||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||||
|
|
||||||
|
$url = '/auth_test/CamelCase';
|
||||||
|
$this->Controller->request->addParams(Router::parse($url));
|
||||||
|
$this->Controller->request->query['url'] = Router::normalize($url);
|
||||||
|
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -777,7 +782,7 @@ class AuthComponentTest extends CakeTestCase {
|
||||||
$this->Auth->Session->delete('Auth');
|
$this->Auth->Session->delete('Auth');
|
||||||
$_SERVER['HTTP_REFERER'] = $_ENV['HTTP_REFERER'] = Router::url('/admin', true);
|
$_SERVER['HTTP_REFERER'] = $_ENV['HTTP_REFERER'] = Router::url('/admin', true);
|
||||||
$this->Auth->Session->write('Auth', array(
|
$this->Auth->Session->write('Auth', array(
|
||||||
'AuthUser' => array('id'=>'1', 'username' => 'nate')
|
'AuthUser' => array('id' => '1', 'username' => 'nate')
|
||||||
));
|
));
|
||||||
$this->Auth->request->params['action'] = 'login';
|
$this->Auth->request->params['action'] = 'login';
|
||||||
$this->Auth->request->url = 'auth_test/login';
|
$this->Auth->request->url = 'auth_test/login';
|
||||||
|
|
|
@ -102,12 +102,12 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _setCookieData() {
|
protected function _setCookieData() {
|
||||||
$this->Cookie->write(array('Encrytped_array' => array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!')));
|
$this->Cookie->write(array('Encrytped_array' => array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')));
|
||||||
$this->Cookie->write(array('Encrytped_multi_cookies.name' => 'CakePHP'));
|
$this->Cookie->write(array('Encrytped_multi_cookies.name' => 'CakePHP'));
|
||||||
$this->Cookie->write(array('Encrytped_multi_cookies.version' => '1.2.0.x'));
|
$this->Cookie->write(array('Encrytped_multi_cookies.version' => '1.2.0.x'));
|
||||||
$this->Cookie->write(array('Encrytped_multi_cookies.tag' => 'CakePHP Rocks!'));
|
$this->Cookie->write(array('Encrytped_multi_cookies.tag' => 'CakePHP Rocks!'));
|
||||||
|
|
||||||
$this->Cookie->write(array('Plain_array' => array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!')), null, false);
|
$this->Cookie->write(array('Plain_array' => array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')), null, false);
|
||||||
$this->Cookie->write(array('Plain_multi_cookies.name' => 'CakePHP'), null, false);
|
$this->Cookie->write(array('Plain_multi_cookies.name' => 'CakePHP'), null, false);
|
||||||
$this->Cookie->write(array('Plain_multi_cookies.version' => '1.2.0.x'), null, false);
|
$this->Cookie->write(array('Plain_multi_cookies.version' => '1.2.0.x'), null, false);
|
||||||
$this->Cookie->write(array('Plain_multi_cookies.tag' => 'CakePHP Rocks!'), null, false);
|
$this->Cookie->write(array('Plain_multi_cookies.tag' => 'CakePHP Rocks!'), null, false);
|
||||||
|
@ -145,11 +145,11 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
public function testReadEncryptedCookieData() {
|
public function testReadEncryptedCookieData() {
|
||||||
$this->_setCookieData();
|
$this->_setCookieData();
|
||||||
$data = $this->Cookie->read('Encrytped_array');
|
$data = $this->Cookie->read('Encrytped_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,11 +162,11 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
$this->_setCookieData();
|
$this->_setCookieData();
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_array');
|
$data = $this->Cookie->read('Plain_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_multi_cookies');
|
$data = $this->Cookie->read('Plain_multi_cookies');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
$this->_setCookieData();
|
$this->_setCookieData();
|
||||||
$this->Cookie->delete('Encrytped_multi_cookies.name');
|
$this->Cookie->delete('Encrytped_multi_cookies.name');
|
||||||
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
||||||
$expected = array('version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
|
|
||||||
$this->Cookie->delete('Encrytped_array');
|
$this->Cookie->delete('Encrytped_array');
|
||||||
|
@ -288,7 +288,7 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Cookie->delete('Plain_multi_cookies.name');
|
$this->Cookie->delete('Plain_multi_cookies.name');
|
||||||
$data = $this->Cookie->read('Plain_multi_cookies');
|
$data = $this->Cookie->read('Plain_multi_cookies');
|
||||||
$expected = array('version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
|
|
||||||
$this->Cookie->delete('Plain_array');
|
$this->Cookie->delete('Plain_array');
|
||||||
|
@ -372,7 +372,7 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
$this->assertNull($data);
|
$this->assertNull($data);
|
||||||
|
|
||||||
$_COOKIE['CakeTestCookie'] = array(
|
$_COOKIE['CakeTestCookie'] = array(
|
||||||
'Encrytped_array' => $this->__encrypt(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!')),
|
'Encrytped_array' => $this->__encrypt(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')),
|
||||||
'Encrytped_multi_cookies' => array(
|
'Encrytped_multi_cookies' => array(
|
||||||
'name' => $this->__encrypt('CakePHP'),
|
'name' => $this->__encrypt('CakePHP'),
|
||||||
'version' => $this->__encrypt('1.2.0.x'),
|
'version' => $this->__encrypt('1.2.0.x'),
|
||||||
|
@ -386,19 +386,19 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
$this->Cookie->startup(null);
|
$this->Cookie->startup(null);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Encrytped_array');
|
$data = $this->Cookie->read('Encrytped_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_array');
|
$data = $this->Cookie->read('Plain_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_multi_cookies');
|
$data = $this->Cookie->read('Plain_multi_cookies');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
$this->Cookie->destroy();
|
$this->Cookie->destroy();
|
||||||
unset($_COOKIE['CakeTestCookie']);
|
unset($_COOKIE['CakeTestCookie']);
|
||||||
|
@ -427,7 +427,7 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$_COOKIE['CakeTestCookie'] = array(
|
$_COOKIE['CakeTestCookie'] = array(
|
||||||
'Encrytped_array' => $this->__encrypt(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!')),
|
'Encrytped_array' => $this->__encrypt(array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!')),
|
||||||
'Encrytped_multi_cookies' => array(
|
'Encrytped_multi_cookies' => array(
|
||||||
'name' => $this->__encrypt('CakePHP'),
|
'name' => $this->__encrypt('CakePHP'),
|
||||||
'version' => $this->__encrypt('1.2.0.x'),
|
'version' => $this->__encrypt('1.2.0.x'),
|
||||||
|
@ -439,19 +439,19 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
'tag' => 'CakePHP Rocks!'));
|
'tag' => 'CakePHP Rocks!'));
|
||||||
|
|
||||||
$data = $this->Cookie->read('Encrytped_array');
|
$data = $this->Cookie->read('Encrytped_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
$data = $this->Cookie->read('Encrytped_multi_cookies');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_array');
|
$data = $this->Cookie->read('Plain_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_multi_cookies');
|
$data = $this->Cookie->read('Plain_multi_cookies');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' =>'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($expected, $data);
|
$this->assertEquals($expected, $data);
|
||||||
$this->Cookie->destroy();
|
$this->Cookie->destroy();
|
||||||
unset($_COOKIE['CakeTestCookie']);
|
unset($_COOKIE['CakeTestCookie']);
|
||||||
|
|
|
@ -61,6 +61,7 @@ class DebugCompTransport extends AbstractTransport {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function send(CakeEmail $email) {
|
public function send(CakeEmail $email) {
|
||||||
|
$email->addHeaders(array('Date' => EmailComponentTest::$sentDate));
|
||||||
$headers = $email->getHeaders(array_fill_keys(array('from', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'), true));
|
$headers = $email->getHeaders(array_fill_keys(array('from', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject'), true));
|
||||||
$to = $headers['To'];
|
$to = $headers['To'];
|
||||||
$subject = $headers['Subject'];
|
$subject = $headers['Subject'];
|
||||||
|
@ -134,6 +135,13 @@ class EmailComponentTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public $name = 'Email';
|
public $name = 'Email';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sentDate
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $sentDate = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
|
@ -149,6 +157,8 @@ class EmailComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Controller->EmailTest->initialize($this->Controller, array());
|
$this->Controller->EmailTest->initialize($this->Controller, array());
|
||||||
|
|
||||||
|
self::$sentDate = date(DATE_RFC2822);
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
||||||
));
|
));
|
||||||
|
@ -189,7 +199,7 @@ class EmailComponentTest extends CakeTestCase {
|
||||||
$this->Controller->EmailTest->delivery = 'DebugComp';
|
$this->Controller->EmailTest->delivery = 'DebugComp';
|
||||||
$this->Controller->EmailTest->messageId = false;
|
$this->Controller->EmailTest->messageId = false;
|
||||||
|
|
||||||
$date = date(DATE_RFC2822);
|
$date = self::$sentDate;
|
||||||
$message = <<<MSGBLOC
|
$message = <<<MSGBLOC
|
||||||
<pre>To: postmaster@example.com
|
<pre>To: postmaster@example.com
|
||||||
From: noreply@example.com
|
From: noreply@example.com
|
||||||
|
@ -242,7 +252,7 @@ MSGBLOC;
|
||||||
$this->Controller->EmailTest->delivery = 'DebugComp';
|
$this->Controller->EmailTest->delivery = 'DebugComp';
|
||||||
$this->Controller->EmailTest->messageId = false;
|
$this->Controller->EmailTest->messageId = false;
|
||||||
|
|
||||||
$date = date(DATE_RFC2822);
|
$date = self::$sentDate;
|
||||||
$header = <<<HEADBLOC
|
$header = <<<HEADBLOC
|
||||||
To: postmaster@example.com
|
To: postmaster@example.com
|
||||||
From: noreply@example.com
|
From: noreply@example.com
|
||||||
|
@ -375,7 +385,7 @@ HTMLBLOC;
|
||||||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Cc: cc@example.com\n/', $result);
|
$this->assertRegExp('/Cc: cc@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Bcc: bcc@example.com\n/', $result);
|
$this->assertRegExp('/Bcc: bcc@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Date: ' . preg_quote(date(DATE_RFC2822)) . '\n/', $result);
|
$this->assertRegExp('/Date: ' . preg_quote(self::$sentDate) . '\n/', $result);
|
||||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||||
|
@ -404,7 +414,7 @@ HTMLBLOC;
|
||||||
$this->assertRegExp('/Subject: Cake Debug Test\n/', $result);
|
$this->assertRegExp('/Subject: Cake Debug Test\n/', $result);
|
||||||
$this->assertRegExp('/Reply-To: noreply@example.com\n/', $result);
|
$this->assertRegExp('/Reply-To: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
$this->assertRegExp('/From: noreply@example.com\n/', $result);
|
||||||
$this->assertRegExp('/Date: ' . preg_quote(date(DATE_RFC2822)) . '\n/', $result);
|
$this->assertRegExp('/Date: ' . preg_quote(self::$sentDate) . '\n/', $result);
|
||||||
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
$this->assertRegExp('/X-Mailer: CakePHP Email Component\n/', $result);
|
||||||
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
$this->assertRegExp('/Content-Type: text\/plain; charset=UTF-8\n/', $result);
|
||||||
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
$this->assertRegExp('/Content-Transfer-Encoding: 8bitMessage:\n/', $result);
|
||||||
|
@ -575,7 +585,7 @@ HTMLBLOC;
|
||||||
$this->Controller->EmailTest->to = 'postmaster@example.com';
|
$this->Controller->EmailTest->to = 'postmaster@example.com';
|
||||||
$this->Controller->EmailTest->from = 'noreply@example.com';
|
$this->Controller->EmailTest->from = 'noreply@example.com';
|
||||||
$this->Controller->EmailTest->subject = 'Cake Debug Test';
|
$this->Controller->EmailTest->subject = 'Cake Debug Test';
|
||||||
$this->Controller->EmailTest->date = 'Today!';
|
$this->Controller->EmailTest->date = self::$sentDate = 'Today!';
|
||||||
$this->Controller->EmailTest->template = null;
|
$this->Controller->EmailTest->template = null;
|
||||||
$this->Controller->EmailTest->delivery = 'DebugComp';
|
$this->Controller->EmailTest->delivery = 'DebugComp';
|
||||||
|
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ class ControllerTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testInvokeActionPrefixProtection() {
|
public function testInvokeActionPrefixProtection() {
|
||||||
Router::reload();
|
Router::reload();
|
||||||
Router::connect('/admin/:controller/:action/*', array('prefix'=>'admin'));
|
Router::connect('/admin/:controller/:action/*', array('prefix' => 'admin'));
|
||||||
|
|
||||||
$url = new CakeRequest('test/admin_add/');
|
$url = new CakeRequest('test/admin_add/');
|
||||||
$url->addParams(array('controller' => 'test_controller', 'action' => 'admin_add'));
|
$url->addParams(array('controller' => 'test_controller', 'action' => 'admin_add'));
|
||||||
|
|
|
@ -161,7 +161,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
'pass' => array(),
|
'pass' => array(),
|
||||||
'form' => array(),
|
'form' => array(),
|
||||||
'named' => array(),
|
'named' => array(),
|
||||||
'url' => array('url' =>'admin/scaffold_mock/edit'),
|
'url' => array('url' => 'admin/scaffold_mock/edit'),
|
||||||
'controller' => 'scaffold_mock',
|
'controller' => 'scaffold_mock',
|
||||||
'action' => 'admin_edit',
|
'action' => 'admin_edit',
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
|
@ -191,7 +191,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
'pass' => array(),
|
'pass' => array(),
|
||||||
'form' => array(),
|
'form' => array(),
|
||||||
'named' => array(),
|
'named' => array(),
|
||||||
'url' => array('url' =>'admin/scaffold_mock/edit'),
|
'url' => array('url' => 'admin/scaffold_mock/edit'),
|
||||||
'controller' => 'scaffold_mock',
|
'controller' => 'scaffold_mock',
|
||||||
'action' => 'admin_edit',
|
'action' => 'admin_edit',
|
||||||
'admin' => true,
|
'admin' => true,
|
||||||
|
@ -245,7 +245,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
'pass' => array(1),
|
'pass' => array(1),
|
||||||
'form' => array(),
|
'form' => array(),
|
||||||
'named' => array(),
|
'named' => array(),
|
||||||
'url' => array('url' =>'scaffold_mock'),
|
'url' => array('url' => 'scaffold_mock'),
|
||||||
'controller' => 'scaffold_mock',
|
'controller' => 'scaffold_mock',
|
||||||
'action' => 'edit',
|
'action' => 'edit',
|
||||||
);
|
);
|
||||||
|
@ -285,7 +285,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
'pass' => array(1),
|
'pass' => array(1),
|
||||||
'form' => array(),
|
'form' => array(),
|
||||||
'named' => array(),
|
'named' => array(),
|
||||||
'url' => array('url' =>'scaffold_mock'),
|
'url' => array('url' => 'scaffold_mock'),
|
||||||
'controller' => 'scaffold_mock',
|
'controller' => 'scaffold_mock',
|
||||||
'action' => 'edit',
|
'action' => 'edit',
|
||||||
);
|
);
|
||||||
|
@ -323,7 +323,7 @@ class ScaffoldTest extends CakeTestCase {
|
||||||
'pass' => array(1),
|
'pass' => array(1),
|
||||||
'form' => array(),
|
'form' => array(),
|
||||||
'named' => array(),
|
'named' => array(),
|
||||||
'url' => array('url' =>'scaffold_mock/edit'),
|
'url' => array('url' => 'scaffold_mock/edit'),
|
||||||
'controller' => 'scaffold_mock',
|
'controller' => 'scaffold_mock',
|
||||||
'action' => 'edit',
|
'action' => 'edit',
|
||||||
);
|
);
|
||||||
|
|
|
@ -363,6 +363,9 @@ class AppTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testListObjectsIgnoreDotDirectories() {
|
public function testListObjectsIgnoreDotDirectories() {
|
||||||
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS;
|
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS;
|
||||||
|
|
||||||
|
$this->skipIf(!is_writable($path), $path . ' is not writable.');
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'plugins' => array($path)
|
'plugins' => array($path)
|
||||||
), App::RESET);
|
), App::RESET);
|
||||||
|
|
|
@ -2603,7 +2603,7 @@ class I18nTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTimeDefinitionJapanese(){
|
public function testTimeDefinitionJapanese() {
|
||||||
Configure::write('Config.language', 'ja_jp');
|
Configure::write('Config.language', 'ja_jp');
|
||||||
$result = __c('d_fmt', 5);
|
$result = __c('d_fmt', 5);
|
||||||
|
|
||||||
|
|
|
@ -2921,9 +2921,9 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
'order' => array('Article.id' => 'ASC')
|
'order' => array('Article.id' => 'ASC')
|
||||||
));
|
));
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
foreach($result as $i=>$article) {
|
foreach ($result as $i => $article) {
|
||||||
foreach($article['Comment'] as $j=>$comment) {
|
foreach ($article['Comment'] as $j => $comment) {
|
||||||
$result[$i]['Comment'][$j] = array_diff_key($comment, array('id'=>true));
|
$result[$i]['Comment'][$j] = array_diff_key($comment, array('id' => true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3628,7 +3628,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
return $this->__containments($result['models']);
|
return $this->__containments($result['models']);
|
||||||
} else {
|
} else {
|
||||||
$result = $Model;
|
$result = $Model;
|
||||||
foreach($result as $i => $containment) {
|
foreach ($result as $i => $containment) {
|
||||||
$result[$i] = array_diff_key($containment, array('instance' => true));
|
$result[$i] = array_diff_key($containment, array('instance' => true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3646,7 +3646,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
function __assertBindings(&$Model, $expected = array()) {
|
function __assertBindings(&$Model, $expected = array()) {
|
||||||
$expected = array_merge(array('belongsTo' => array(), 'hasOne' => array(), 'hasMany' => array(), 'hasAndBelongsToMany' => array()), $expected);
|
$expected = array_merge(array('belongsTo' => array(), 'hasOne' => array(), 'hasMany' => array(), 'hasAndBelongsToMany' => array()), $expected);
|
||||||
|
|
||||||
foreach($expected as $binding => $expect) {
|
foreach ($expected as $binding => $expect) {
|
||||||
$this->assertEquals(array_keys($Model->$binding), $expect);
|
$this->assertEquals(array_keys($Model->$binding), $expect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3664,14 +3664,14 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$debug = '[';
|
$debug = '[';
|
||||||
$lines = array();
|
$lines = array();
|
||||||
foreach($relationTypes as $binding) {
|
foreach ($relationTypes as $binding) {
|
||||||
if (!empty($Model->$binding)) {
|
if (!empty($Model->$binding)) {
|
||||||
$models = array_keys($Model->$binding);
|
$models = array_keys($Model->$binding);
|
||||||
foreach($models as $linkedModel) {
|
foreach ($models as $linkedModel) {
|
||||||
$line = $linkedModel;
|
$line = $linkedModel;
|
||||||
if (!empty($extra) && !empty($Model->{$binding}[$linkedModel])) {
|
if (!empty($extra) && !empty($Model->{$binding}[$linkedModel])) {
|
||||||
$extraData = array();
|
$extraData = array();
|
||||||
foreach(array_intersect_key($Model->{$binding}[$linkedModel], array_flip($extra)) as $key => $value) {
|
foreach (array_intersect_key($Model->{$binding}[$linkedModel], array_flip($extra)) as $key => $value) {
|
||||||
$extraData[] = $key . ': ' . (is_array($value) ? '(' . implode(', ', $value) . ')' : $value);
|
$extraData[] = $key . ': ' . (is_array($value) ? '(' . implode(', ', $value) . ')' : $value);
|
||||||
}
|
}
|
||||||
$line .= ' {' . implode(' - ', $extraData) . '}';
|
$line .= ' {' . implode(' - ', $extraData) . '}';
|
||||||
|
|
|
@ -1053,7 +1053,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 2, $leftField => 3, $rightField => 4)),
|
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 2, $leftField => 3, $rightField => 4)),
|
||||||
array($modelClass => array('id' => 4, 'name' => '1.1.2', $parentField => 2, $leftField => 5, $rightField => 6)),
|
array($modelClass => array('id' => 4, 'name' => '1.1.2', $parentField => 2, $leftField => 5, $rightField => 6)),
|
||||||
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 8, $rightField => 13)),
|
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 8, $rightField => 13)),
|
||||||
array($modelClass => array( 'id' => 6, 'name' => '1.2.1', $parentField => 5, $leftField => 9, $rightField => 10)),
|
array($modelClass => array('id' => 6, 'name' => '1.2.1', $parentField => 5, $leftField => 9, $rightField => 10)),
|
||||||
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12)));
|
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12)));
|
||||||
$this->assertEquals($total, $expects);
|
$this->assertEquals($total, $expects);
|
||||||
|
|
||||||
|
@ -1149,7 +1149,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 2, $leftField => 3, $rightField => 4)),
|
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 2, $leftField => 3, $rightField => 4)),
|
||||||
array($modelClass => array('id' => 4, 'name' => '1.1.2', $parentField => 2, $leftField => 5, $rightField => 6)),
|
array($modelClass => array('id' => 4, 'name' => '1.1.2', $parentField => 2, $leftField => 5, $rightField => 6)),
|
||||||
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 8, $rightField => 13)),
|
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 8, $rightField => 13)),
|
||||||
array($modelClass => array( 'id' => 6, 'name' => '1.2.1', $parentField => 5, $leftField => 9, $rightField => 10)),
|
array($modelClass => array('id' => 6, 'name' => '1.2.1', $parentField => 5, $leftField => 9, $rightField => 10)),
|
||||||
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12))
|
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12))
|
||||||
);
|
);
|
||||||
$this->assertEquals($total, $expects);
|
$this->assertEquals($total, $expects);
|
||||||
|
|
|
@ -135,7 +135,7 @@ class TreeBehaviorScopedTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testMoveUpWithScope() {
|
public function testMoveUpWithScope() {
|
||||||
$this->Ad = new Ad();
|
$this->Ad = new Ad();
|
||||||
$this->Ad->Behaviors->attach('Tree', array('scope'=>'Campaign'));
|
$this->Ad->Behaviors->attach('Tree', array('scope' => 'Campaign'));
|
||||||
$this->Ad->moveUp(6);
|
$this->Ad->moveUp(6);
|
||||||
|
|
||||||
$this->Ad->id = 4;
|
$this->Ad->id = 4;
|
||||||
|
|
|
@ -665,7 +665,7 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 1),
|
'Apple' => array('id' => 1),
|
||||||
'Child' => array(
|
'Child' => array(
|
||||||
array('id' => 2,'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
|
array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 2),
|
'Apple' => array('id' => 2),
|
||||||
'Child' => array(
|
'Child' => array(
|
||||||
|
@ -737,7 +737,7 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 1),
|
'Apple' => array('id' => 1),
|
||||||
'Child' => array(
|
'Child' => array(
|
||||||
array('id' => 2,'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
|
array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 2),
|
'Apple' => array('id' => 2),
|
||||||
'Child' => array(
|
'Child' => array(
|
||||||
|
@ -807,13 +807,13 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
$expected2 = array(
|
$expected2 = array(
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 1),
|
'Apple' => array('id' => 1),
|
||||||
'Parent' => array('id' => 2,'name' => 'Bright Red Apple', 'mytime' => '22:57:17')),
|
'Parent' => array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17')),
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 2),
|
'Apple' => array('id' => 2),
|
||||||
'Parent' => array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17')),
|
'Parent' => array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17')),
|
||||||
array(
|
array(
|
||||||
'Apple' => array('id' => 3),
|
'Apple' => array('id' => 3),
|
||||||
'Parent' => array('id' => 2,'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))
|
'Parent' => array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))
|
||||||
);
|
);
|
||||||
$result2 = $Apple->find('all', array(
|
$result2 = $Apple->find('all', array(
|
||||||
'fields' => array('Apple.id', 'Parent.id', 'Parent.name', 'Parent.mytime'),
|
'fields' => array('Apple.id', 'Parent.id', 'Parent.name', 'Parent.mytime'),
|
||||||
|
|
|
@ -741,7 +741,7 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)),
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)),
|
||||||
);
|
);
|
||||||
$result = $this->Schema->generateTable('posts', $posts);
|
$result = $this->Schema->generateTable('posts', $posts);
|
||||||
$this->assertRegExp('/var \$posts/', $result);
|
$this->assertRegExp('/public \$posts/', $result);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* testSchemaWrite method
|
* testSchemaWrite method
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
$this->_buildRelatedModels($this->Model);
|
$this->_buildRelatedModels($this->Model);
|
||||||
|
|
||||||
$binding = array('type'=>'belongsTo', 'model'=>'TestModel4');
|
$binding = array('type' => 'belongsTo', 'model' => 'TestModel4');
|
||||||
$queryData = array();
|
$queryData = array();
|
||||||
$resultSet = null;
|
$resultSet = null;
|
||||||
$null = null;
|
$null = null;
|
||||||
|
@ -1716,7 +1716,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
$this->_buildRelatedModels($this->Model);
|
$this->_buildRelatedModels($this->Model);
|
||||||
|
|
||||||
$binding = array('type'=>'hasAndBelongsToMany', 'model'=>'TestModel7');
|
$binding = array('type' => 'hasAndBelongsToMany', 'model' => 'TestModel7');
|
||||||
$queryData = array('conditions' => array('TestModel4.name !=' => 'mariano'));
|
$queryData = array('conditions' => array('TestModel4.name !=' => 'mariano'));
|
||||||
$resultSet = null;
|
$resultSet = null;
|
||||||
$null = null;
|
$null = null;
|
||||||
|
@ -1749,7 +1749,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2;
|
$this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2;
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
||||||
|
|
||||||
$binding = array('type'=>'hasAndBelongsToMany', 'model'=>'TestModel7');
|
$binding = array('type' => 'hasAndBelongsToMany', 'model' => 'TestModel7');
|
||||||
$queryData = array();
|
$queryData = array();
|
||||||
$resultSet = null;
|
$resultSet = null;
|
||||||
$null = null;
|
$null = null;
|
||||||
|
@ -1785,7 +1785,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2;
|
$this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2;
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
||||||
|
|
||||||
$binding = array('type'=>'hasAndBelongsToMany', 'model'=>'TestModel7');
|
$binding = array('type' => 'hasAndBelongsToMany', 'model' => 'TestModel7');
|
||||||
$queryData = array();
|
$queryData = array();
|
||||||
$resultSet = null;
|
$resultSet = null;
|
||||||
$null = null;
|
$null = null;
|
||||||
|
@ -1856,7 +1856,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$expected = " WHERE score BETWEEN 90.1 AND 95.7";
|
$expected = " WHERE score BETWEEN 90.1 AND 95.7";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $this->Dbo->conditions(array('score' => array(2=>1, 2, 10)));
|
$result = $this->Dbo->conditions(array('score' => array(2 => 1, 2, 10)));
|
||||||
$expected = " WHERE score IN (1, 2, 10)";
|
$expected = " WHERE score IN (1, 2, 10)";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
|
@ -487,22 +487,22 @@ class PostgresTest extends CakeTestCase {
|
||||||
$schema = new CakeSchema();
|
$schema = new CakeSchema();
|
||||||
$schema->tables = array('i18n' => array(
|
$schema->tables = array('i18n' => array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
'type' => 'integer', 'null' => false, 'default' => null,
|
'type' => 'integer', 'null' => false, 'default' => null,
|
||||||
'length' => 10, 'key' => 'primary'
|
'length' => 10, 'key' => 'primary'
|
||||||
),
|
),
|
||||||
'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
|
||||||
'model' => array('type'=>'string', 'null' => false, 'key' => 'index'),
|
'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||||
'foreign_key' => array(
|
'foreign_key' => array(
|
||||||
'type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'
|
'type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'
|
||||||
),
|
),
|
||||||
'field' => array('type'=>'string', 'null' => false, 'key' => 'index'),
|
'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
|
||||||
'content' => array('type'=>'text', 'null' => true, 'default' => null),
|
'content' => array('type' => 'text', 'null' => true, 'default' => null),
|
||||||
'indexes' => array(
|
'indexes' => array(
|
||||||
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
||||||
'locale' => array('column' => 'locale', 'unique' => 0),
|
'locale' => array('column' => 'locale', 'unique' => 0),
|
||||||
'model' => array('column' => 'model', 'unique' => 0),
|
'model' => array('column' => 'model', 'unique' => 0),
|
||||||
'row_id' => array('column' => 'foreign_key', 'unique' => 0),
|
'row_id' => array('column' => 'foreign_key', 'unique' => 0),
|
||||||
'field' => array('column' => 'field', 'unique' => 0)
|
'field' => array('column' => 'field', 'unique' => 0)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,10 @@ class SqliteTest extends CakeTestCase {
|
||||||
public function testDescribe() {
|
public function testDescribe() {
|
||||||
$this->loadFixtures('User');
|
$this->loadFixtures('User');
|
||||||
$Model = new Model(array('name' => 'User', 'ds' => 'test', 'table' => 'users'));
|
$Model = new Model(array('name' => 'User', 'ds' => 'test', 'table' => 'users'));
|
||||||
|
|
||||||
|
$this->Dbo->cacheSources = true;
|
||||||
|
Configure::write('Cache.disable', false);
|
||||||
|
|
||||||
$result = $this->Dbo->describe($Model);
|
$result = $this->Dbo->describe($Model);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
|
@ -300,6 +304,9 @@ class SqliteTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Dbo->describe($Model->useTable);
|
$result = $this->Dbo->describe($Model->useTable);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$result = Cache::read('test_users', '_cake_model_');
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -549,6 +549,85 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$this->assertTrue($Article->delete(1));
|
$this->assertTrue($Article->delete(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testDeleteDependent method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testDeleteDependent() {
|
||||||
|
$this->loadFixtures('Bidding', 'BiddingMessage');
|
||||||
|
$Bidding = new Bidding();
|
||||||
|
$result = $Bidding->find('all');
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 1, 'bid' => 'One', 'name' => 'Bid 1'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'One', 'name' => 'Message 1'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 2, 'bid' => 'Two', 'name' => 'Bid 2'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'Two', 'name' => 'Message 2'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 3, 'bid' => 'Three', 'name' => 'Bid 3'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'Three', 'name' => 'Message 3'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 4, 'bid' => 'Five', 'name' => 'Bid 5'),
|
||||||
|
'BiddingMessage' => array('bidding' => '', 'name' => ''),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$Bidding->delete(4, true);
|
||||||
|
$result = $Bidding->find('all');
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 1, 'bid' => 'One', 'name' => 'Bid 1'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'One', 'name' => 'Message 1'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 2, 'bid' => 'Two', 'name' => 'Bid 2'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'Two', 'name' => 'Message 2'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 3, 'bid' => 'Three', 'name' => 'Bid 3'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'Three', 'name' => 'Message 3'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$Bidding->delete(2, true);
|
||||||
|
$result = $Bidding->find('all');
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 1, 'bid' => 'One', 'name' => 'Bid 1'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'One', 'name' => 'Message 1'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'Bidding' => array('id' => 3, 'bid' => 'Three', 'name' => 'Bid 3'),
|
||||||
|
'BiddingMessage' => array('bidding' => 'Three', 'name' => 'Message 3'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$result = $Bidding->BiddingMessage->find('all', array('order' => array('BiddingMessage.name' => 'ASC')));
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'BiddingMessage' => array('bidding' => 'One', 'name' => 'Message 1'),
|
||||||
|
'Bidding' => array('id' => 1, 'bid' => 'One', 'name' => 'Bid 1'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'BiddingMessage' => array('bidding' => 'Three', 'name' => 'Message 3'),
|
||||||
|
'Bidding' => array('id' => 3, 'bid' => 'Three', 'name' => 'Bid 3'),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'BiddingMessage' => array('bidding' => 'Four', 'name' => 'Message 4'),
|
||||||
|
'Bidding' => array('id' => '', 'bid' => '', 'name' => ''),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test deleteLinks with Multiple habtm associations
|
* test deleteLinks with Multiple habtm associations
|
||||||
*
|
*
|
||||||
|
|
|
@ -245,13 +245,13 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->loadFixtures('Article', 'User');
|
$this->loadFixtures('Article', 'User');
|
||||||
$TestUser =& new User();
|
$TestUser =& new User();
|
||||||
|
|
||||||
$options = array (
|
$options = array(
|
||||||
'fields' => array(
|
'fields' => array(
|
||||||
'user',
|
'user',
|
||||||
'Article.published',
|
'Article.published',
|
||||||
),
|
),
|
||||||
'joins' => array (
|
'joins' => array(
|
||||||
array (
|
array(
|
||||||
'table' => 'articles',
|
'table' => 'articles',
|
||||||
'alias' => 'Article',
|
'alias' => 'Article',
|
||||||
'type' => 'LEFT',
|
'type' => 'LEFT',
|
||||||
|
@ -678,7 +678,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('mytime'=> ''));
|
$expected = array('Apple' => array('mytime' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -688,7 +688,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('mytime'=> ''));
|
$expected = array('Apple' => array('mytime' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected, 'Empty values are not returning properly. %s');
|
$this->assertEquals($TestModel->data, $expected, 'Empty values are not returning properly. %s');
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -698,7 +698,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('mytime'=> '00:00:00'));
|
$expected = array('Apple' => array('mytime' => '00:00:00'));
|
||||||
$this->assertEquals($TestModel->data, $expected, 'Midnight is not returning proper values. %s');
|
$this->assertEquals($TestModel->data, $expected, 'Midnight is not returning proper values. %s');
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -707,7 +707,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('mytime'=> '00:00:00'));
|
$expected = array('Apple' => array('mytime' => '00:00:00'));
|
||||||
$this->assertEquals($TestModel->data, $expected, 'Midnight is not returning proper values. %s');
|
$this->assertEquals($TestModel->data, $expected, 'Midnight is not returning proper values. %s');
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -717,7 +717,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('mytime'=> '03:04:04'));
|
$expected = array('Apple' => array('mytime' => '03:04:04'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -727,7 +727,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple' => array('mytime'=> '03:04:04'));
|
$expected = array('Apple' => array('mytime' => '03:04:04'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -737,7 +737,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('mytime'=> '03:04:04'));
|
$expected = array('Apple' => array('mytime' => '03:04:04'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$db = ConnectionManager::getDataSource('test');
|
$db = ConnectionManager::getDataSource('test');
|
||||||
|
@ -769,7 +769,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> ''));
|
$expected = array('Apple' => array('created' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -779,7 +779,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('date'=> ''));
|
$expected = array('Apple' => array('date' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -792,7 +792,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> '2007-08-20 00:00:00'));
|
$expected = array('Apple' => array('created' => '2007-08-20 00:00:00'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -805,7 +805,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> '2007-08-20 10:12:00'));
|
$expected = array('Apple' => array('created' => '2007-08-20 10:12:00'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -818,7 +818,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> ''));
|
$expected = array('Apple' => array('created' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -827,7 +827,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> ''));
|
$expected = array('Apple' => array('created' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -837,7 +837,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> ''));
|
$expected = array('Apple' => array('created' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -850,9 +850,9 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Apple'=> array(
|
'Apple' => array(
|
||||||
'created'=> '',
|
'created' => '',
|
||||||
'date'=> '2006-12-25'
|
'date' => '2006-12-25'
|
||||||
));
|
));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
|
@ -870,9 +870,9 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Apple'=> array(
|
'Apple' => array(
|
||||||
'created'=> '2007-08-20 10:12:09',
|
'created' => '2007-08-20 10:12:09',
|
||||||
'date'=> '2006-12-25'
|
'date' => '2006-12-25'
|
||||||
));
|
));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> '', 'date'=> ''));
|
$expected = array('Apple' => array('created' => '', 'date' => ''));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -905,7 +905,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('created'=> '', 'date'=> '2006-12-25'));
|
$expected = array('Apple' => array('created' => '', 'date' => '2006-12-25'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -915,7 +915,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
$TestModel->data = null;
|
$TestModel->data = null;
|
||||||
$TestModel->set($data);
|
$TestModel->set($data);
|
||||||
$expected = array('Apple'=> array('date'=> '2006-12-25'));
|
$expected = array('Apple' => array('date' => '2006-12-25'));
|
||||||
$this->assertEquals($TestModel->data, $expected);
|
$this->assertEquals($TestModel->data, $expected);
|
||||||
|
|
||||||
$db = ConnectionManager::getDataSource('test');
|
$db = ConnectionManager::getDataSource('test');
|
||||||
|
@ -1954,7 +1954,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'length' => null
|
'length' => null
|
||||||
),
|
),
|
||||||
'updated'=> array(
|
'updated' => array(
|
||||||
'type' => 'datetime',
|
'type' => 'datetime',
|
||||||
'null' => true,
|
'null' => true,
|
||||||
'default' => null,
|
'default' => null,
|
||||||
|
|
|
@ -131,7 +131,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'fields' => array('Thread.project_id', 'COUNT(*) AS total')
|
'fields' => array('Thread.project_id', 'COUNT(*) AS total')
|
||||||
));
|
));
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$result[$row['Thread']['project_id']] = $row[0]['total'];
|
$result[$row['Thread']['project_id']] = $row[0]['total'];
|
||||||
}
|
}
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -143,10 +143,10 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$rows = $Thread->find('all', array(
|
$rows = $Thread->find('all', array(
|
||||||
'group' => 'Thread.project_id',
|
'group' => 'Thread.project_id',
|
||||||
'fields' => array('Thread.project_id', 'COUNT(*) AS total'),
|
'fields' => array('Thread.project_id', 'COUNT(*) AS total'),
|
||||||
'order'=> 'Thread.project_id'
|
'order' => 'Thread.project_id'
|
||||||
));
|
));
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$result[$row['Thread']['project_id']] = $row[0]['total'];
|
$result[$row['Thread']['project_id']] = $row[0]['total'];
|
||||||
}
|
}
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -211,19 +211,19 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('Product' => array('type' => 'Clothing'), array('price' => 32)),
|
array('Product' => array('type' => 'Clothing'), array('price' => 32)),
|
||||||
array('Product' => array('type' => 'Food'), array('price' => 9)),
|
array('Product' => array('type' => 'Food'), array('price' => 9)),
|
||||||
array('Product' => array('type' => 'Music'), array( 'price' => 4)),
|
array('Product' => array('type' => 'Music'), array('price' => 4)),
|
||||||
array('Product' => array('type' => 'Toy'), array('price' => 3))
|
array('Product' => array('type' => 'Toy'), array('price' => 3))
|
||||||
);
|
);
|
||||||
$result = $Product->find('all',array(
|
$result = $Product->find('all',array(
|
||||||
'fields'=>array('Product.type', 'MIN(Product.price) as price'),
|
'fields' => array('Product.type', 'MIN(Product.price) as price'),
|
||||||
'group'=> 'Product.type',
|
'group' => 'Product.type',
|
||||||
'order' => 'Product.type ASC'
|
'order' => 'Product.type ASC'
|
||||||
));
|
));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $Product->find('all', array(
|
$result = $Product->find('all', array(
|
||||||
'fields'=>array('Product.type', 'MIN(Product.price) as price'),
|
'fields' => array('Product.type', 'MIN(Product.price) as price'),
|
||||||
'group'=> array('Product.type'),
|
'group' => array('Product.type'),
|
||||||
'order' => 'Product.type ASC'));
|
'order' => 'Product.type ASC'));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $TestModel->find('all');
|
$result = $TestModel->find('all');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
'Apple' => array (
|
'Apple' => array(
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'apple_id' => 2,
|
'apple_id' => 2,
|
||||||
'color' => 'Red 1',
|
'color' => 'Red 1',
|
||||||
|
@ -452,7 +452,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'mytime' => '22:57:17'
|
'mytime' => '22:57:17'
|
||||||
))),
|
))),
|
||||||
'Sample' => array(
|
'Sample' => array(
|
||||||
'id' =>'',
|
'id' => '',
|
||||||
'apple_id' => '',
|
'apple_id' => '',
|
||||||
'name' => ''
|
'name' => ''
|
||||||
),
|
),
|
||||||
|
@ -1133,7 +1133,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'mytime' => '22:57:17'
|
'mytime' => '22:57:17'
|
||||||
))),
|
))),
|
||||||
'Sample' => array(
|
'Sample' => array(
|
||||||
'id' =>'',
|
'id' => '',
|
||||||
'apple_id' => '',
|
'apple_id' => '',
|
||||||
'name' => ''
|
'name' => ''
|
||||||
),
|
),
|
||||||
|
@ -1742,7 +1742,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$result = $TestModel->find('all');
|
$result = $TestModel->find('all');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
'Apple' => array (
|
'Apple' => array(
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'apple_id' => 2,
|
'apple_id' => 2,
|
||||||
'color' => 'Red 1',
|
'color' => 'Red 1',
|
||||||
|
@ -1803,7 +1803,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'mytime' => '22:57:17'
|
'mytime' => '22:57:17'
|
||||||
))),
|
))),
|
||||||
'Sample' => array(
|
'Sample' => array(
|
||||||
'id' =>'',
|
'id' => '',
|
||||||
'apple_id' => '',
|
'apple_id' => '',
|
||||||
'name' => ''
|
'name' => ''
|
||||||
)),
|
)),
|
||||||
|
@ -2237,7 +2237,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'mytime' => '22:57:17'
|
'mytime' => '22:57:17'
|
||||||
))),
|
))),
|
||||||
'Sample' => array(
|
'Sample' => array(
|
||||||
'id' =>'',
|
'id' => '',
|
||||||
'apple_id' => '',
|
'apple_id' => '',
|
||||||
'name' => ''
|
'name' => ''
|
||||||
)),
|
)),
|
||||||
|
@ -2646,7 +2646,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'mytime' => '22:57:17'
|
'mytime' => '22:57:17'
|
||||||
))),
|
))),
|
||||||
'Sample' => array(
|
'Sample' => array(
|
||||||
'id' =>'',
|
'id' => '',
|
||||||
'apple_id' => '',
|
'apple_id' => '',
|
||||||
'name' => ''
|
'name' => ''
|
||||||
)),
|
)),
|
||||||
|
@ -3397,38 +3397,38 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'fields' => 'id, name, parent_id',
|
'fields' => 'id, name, parent_id',
|
||||||
'conditions' => array('Category.id !=' => 1)
|
'conditions' => array('Category.id !=' => 1)
|
||||||
));
|
));
|
||||||
$expected = array (
|
$expected = array(
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '2',
|
'id' => '2',
|
||||||
'name' => 'Category 1.1',
|
'name' => 'Category 1.1',
|
||||||
'parent_id' => '1'
|
'parent_id' => '1'
|
||||||
)),
|
)),
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '3',
|
'id' => '3',
|
||||||
'name' => 'Category 1.2',
|
'name' => 'Category 1.2',
|
||||||
'parent_id' => '1'
|
'parent_id' => '1'
|
||||||
)),
|
)),
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '4',
|
'id' => '4',
|
||||||
'name' => 'Category 2',
|
'name' => 'Category 2',
|
||||||
'parent_id' => '0'
|
'parent_id' => '0'
|
||||||
)),
|
)),
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '5',
|
'id' => '5',
|
||||||
'name' => 'Category 3',
|
'name' => 'Category 3',
|
||||||
'parent_id' => '0'
|
'parent_id' => '0'
|
||||||
)),
|
)),
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '6',
|
'id' => '6',
|
||||||
'name' => 'Category 3.1',
|
'name' => 'Category 3.1',
|
||||||
'parent_id' => '5'
|
'parent_id' => '5'
|
||||||
)),
|
)),
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '7',
|
'id' => '7',
|
||||||
'name' => 'Category 1.1.1',
|
'name' => 'Category 1.1.1',
|
||||||
'parent_id' => '2'
|
'parent_id' => '2'
|
||||||
)),
|
)),
|
||||||
array ('Category' => array(
|
array('Category' => array(
|
||||||
'id' => '8',
|
'id' => '8',
|
||||||
'name' => 'Category 1.1.2',
|
'name' => 'Category 1.1.2',
|
||||||
'parent_id' => '2'
|
'parent_id' => '2'
|
||||||
|
@ -6087,7 +6087,7 @@ class ModelReadTest extends BaseModelTest {
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'user' => 'larry'),
|
'user' => 'larry'),
|
||||||
'fields' => NULL,
|
'fields' => NULL,
|
||||||
'joins' => array (),
|
'joins' => array(),
|
||||||
'limit' => NULL,
|
'limit' => NULL,
|
||||||
'offset' => NULL,
|
'offset' => NULL,
|
||||||
'order' => array(
|
'order' => array(
|
||||||
|
|
|
@ -69,6 +69,7 @@ abstract class BaseModelTest extends CakeTestCase {
|
||||||
'core.uuiditems_uuidportfolio', 'core.uuiditems_uuidportfolio_numericid', 'core.fruit',
|
'core.uuiditems_uuidportfolio', 'core.uuiditems_uuidportfolio_numericid', 'core.fruit',
|
||||||
'core.fruits_uuid_tag', 'core.uuid_tag', 'core.product_update_all', 'core.group_update_all',
|
'core.fruits_uuid_tag', 'core.uuid_tag', 'core.product_update_all', 'core.group_update_all',
|
||||||
'core.player', 'core.guild', 'core.guilds_player', 'core.armor', 'core.armors_player',
|
'core.player', 'core.guild', 'core.guilds_player', 'core.armor', 'core.armors_player',
|
||||||
|
'core.bidding', 'core.bidding_message'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -435,7 +435,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$TestModel2->save(array(
|
$TestModel2->save(array(
|
||||||
'name' => 'Item 7',
|
'name' => 'Item 7',
|
||||||
'syfile_id' => 1,
|
'syfile_id' => 1,
|
||||||
'published'=> true
|
'published' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
$result = $TestModel->findById(1);
|
$result = $TestModel->findById(1);
|
||||||
|
@ -450,7 +450,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$TestModel2->save(array(
|
$TestModel2->save(array(
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
'syfile_id' => 1,
|
'syfile_id' => 1,
|
||||||
'published'=> false
|
'published' => false
|
||||||
));
|
));
|
||||||
|
|
||||||
$result = $TestModel->findById(1);
|
$result = $TestModel->findById(1);
|
||||||
|
@ -993,11 +993,11 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$TestModel->recursive = -1;
|
$TestModel->recursive = -1;
|
||||||
$result = $TestModel->find('all', array('fields' => array('id', 'title')));
|
$result = $TestModel->find('all', array('fields' => array('id', 'title')));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('Article' => array('id' => 1, 'title' => 'First Article' )),
|
array('Article' => array('id' => 1, 'title' => 'First Article')),
|
||||||
array('Article' => array('id' => 2, 'title' => 'Second Article' )),
|
array('Article' => array('id' => 2, 'title' => 'Second Article')),
|
||||||
array('Article' => array('id' => 3, 'title' => 'Third Article' )),
|
array('Article' => array('id' => 3, 'title' => 'Third Article')),
|
||||||
array('Article' => array('id' => 4, 'title' => 'Fourth Article - New Title' )),
|
array('Article' => array('id' => 4, 'title' => 'Fourth Article - New Title')),
|
||||||
array('Article' => array('id' => 5, 'title' => 'Fifth Article - New Title 5' ))
|
array('Article' => array('id' => 5, 'title' => 'Fifth Article - New Title 5'))
|
||||||
);
|
);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -3661,7 +3661,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
1 => array('title' => 'title 1'),
|
1 => array('title' => 'title 1'),
|
||||||
2 => array('title' => 'title 2'),
|
2 => array('title' => 'title 2'),
|
||||||
),
|
),
|
||||||
array('validate'=>'only')
|
array('validate' => 'only')
|
||||||
);
|
);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -3675,7 +3675,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
1 => array('title' => ''),
|
1 => array('title' => ''),
|
||||||
2 => array('title' => 'title 2'),
|
2 => array('title' => 'title 2'),
|
||||||
),
|
),
|
||||||
array('validate'=>'only')
|
array('validate' => 'only')
|
||||||
);
|
);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -3778,7 +3778,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'body' => 3,
|
'body' => 3,
|
||||||
'published' =>'sd',
|
'published' => 'sd',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$Something->create();
|
$Something->create();
|
||||||
|
@ -3810,7 +3810,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
array(
|
array(
|
||||||
'title' => 'valid',
|
'title' => 'valid',
|
||||||
'body' => 'this body',
|
'body' => 'this body',
|
||||||
'published' =>'sd',
|
'published' => 'sd',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$Something->create();
|
$Something->create();
|
||||||
|
@ -5083,7 +5083,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'body' => 3,
|
'body' => 3,
|
||||||
'published' =>'sd',
|
'published' => 'sd',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$Something->create();
|
$Something->create();
|
||||||
|
@ -5115,7 +5115,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
array(
|
array(
|
||||||
'title' => 'valid',
|
'title' => 'valid',
|
||||||
'body' => 'this body',
|
'body' => 'this body',
|
||||||
'published' =>'sd',
|
'published' => 'sd',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$Something->create();
|
$Something->create();
|
||||||
|
@ -5305,7 +5305,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$results = $ProductUpdateAll->find('all', compact('conditions'));
|
$results = $ProductUpdateAll->find('all', compact('conditions'));
|
||||||
$this->assertTrue(!empty($results));
|
$this->assertTrue(!empty($results));
|
||||||
|
|
||||||
$ProductUpdateAll->bindModel(array('belongsTo'=>array('Group')));
|
$ProductUpdateAll->bindModel(array('belongsTo' => array('Group')));
|
||||||
$ProductUpdateAll->belongsTo = array(
|
$ProductUpdateAll->belongsTo = array(
|
||||||
'Group' => array(
|
'Group' => array(
|
||||||
'className' => 'GroupUpdateAll',
|
'className' => 'GroupUpdateAll',
|
||||||
|
@ -5431,7 +5431,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
);
|
);
|
||||||
|
|
||||||
$ProductUpdateAll->updateAll(array('name' => "'new product'"), $conditions);
|
$ProductUpdateAll->updateAll(array('name' => "'new product'"), $conditions);
|
||||||
$resultsFkFalse = $ProductUpdateAll->find('all', array('conditions' => array('ProductUpdateAll.name'=>'new product')));
|
$resultsFkFalse = $ProductUpdateAll->find('all', array('conditions' => array('ProductUpdateAll.name' => 'new product')));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'0' => array(
|
'0' => array(
|
||||||
'ProductUpdateAll' => array(
|
'ProductUpdateAll' => array(
|
||||||
|
|
|
@ -46,12 +46,12 @@ class Test extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_schema = array(
|
protected $_schema = array(
|
||||||
'id'=> array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'),
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key' => 'primary'),
|
||||||
'name'=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'email'=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'notes'=> array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
|
'notes' => array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
|
||||||
'created'=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ class TestAlias extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_schema = array(
|
protected $_schema = array(
|
||||||
'id'=> array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key'=>'primary'),
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '1', 'length' => '8', 'key' => 'primary'),
|
||||||
'name'=> array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'email'=> array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'notes'=> array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
|
'notes' => array('type' => 'text', 'null' => '1', 'default' => 'write some notes here', 'length' => ''),
|
||||||
'created'=> array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ class ModifiedAuthor extends Author {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function afterFind($results, $primary = false) {
|
public function afterFind($results, $primary = false) {
|
||||||
foreach($results as $index => $result) {
|
foreach ($results as $index => $result) {
|
||||||
$results[$index]['Author']['user'] .= ' (CakePHP)';
|
$results[$index]['Author']['user'] .= ' (CakePHP)';
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
|
@ -1001,6 +1001,69 @@ class Bid extends CakeTestModel {
|
||||||
public $belongsTo = array('Message');
|
public $belongsTo = array('Message');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BiddingMessage class
|
||||||
|
*
|
||||||
|
* @package Cake.Test.Case.Model
|
||||||
|
*/
|
||||||
|
class BiddingMessage extends CakeTestModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name property
|
||||||
|
*
|
||||||
|
* @var string 'BiddingMessage'
|
||||||
|
*/
|
||||||
|
public $name = 'BiddingMessage';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* primaryKey property
|
||||||
|
*
|
||||||
|
* @var string 'bidding'
|
||||||
|
*/
|
||||||
|
public $primaryKey = 'bidding';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* belongsTo property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $belongsTo = array(
|
||||||
|
'Bidding' => array(
|
||||||
|
'foreignKey' => false,
|
||||||
|
'conditions' => array('BiddingMessage.bidding = Bidding.bid')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bidding class
|
||||||
|
*
|
||||||
|
* @package Cake.Test.Case.Model
|
||||||
|
*/
|
||||||
|
class Bidding extends CakeTestModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name property
|
||||||
|
*
|
||||||
|
* @var string 'Bidding'
|
||||||
|
*/
|
||||||
|
public $name = 'Bidding';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hasOne property
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $hasOne = array(
|
||||||
|
'BiddingMessage' => array(
|
||||||
|
'foreignKey' => false,
|
||||||
|
'conditions' => array('BiddingMessage.bidding = Bidding.bid'),
|
||||||
|
'dependent' => true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NodeAfterFind class
|
* NodeAfterFind class
|
||||||
*
|
*
|
||||||
|
@ -2480,7 +2543,7 @@ class Campaign extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $hasMany = array('Ad' => array('fields' => array('id','campaign_id','name')));
|
public $hasMany = array('Ad' => array('fields' => array('id', 'campaign_id', 'name')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3782,7 +3845,7 @@ class Level extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $hasMany = array(
|
public $hasMany = array(
|
||||||
'Group'=> array(
|
'Group' => array(
|
||||||
'className' => 'Group'
|
'className' => 'Group'
|
||||||
),
|
),
|
||||||
'User2' => array(
|
'User2' => array(
|
||||||
|
@ -3993,9 +4056,9 @@ class Category2 extends CakeTestModel {
|
||||||
),
|
),
|
||||||
'Article2' => array(
|
'Article2' => array(
|
||||||
'className' => 'Article2',
|
'className' => 'Article2',
|
||||||
'order'=>'Article2.published_date DESC',
|
'order' => 'Article2.published_date DESC',
|
||||||
'foreignKey' => 'category_id',
|
'foreignKey' => 'category_id',
|
||||||
'limit'=>'3')
|
'limit' => '3')
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4300,7 +4363,7 @@ class ArticleFeatured2 extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $hasMany = array(
|
public $hasMany = array(
|
||||||
'Comment2' => array('className'=>'Comment2', 'dependent' => true)
|
'Comment2' => array('className' => 'Comment2', 'dependent' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1048,6 +1048,29 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$this->assertEquals('/app/webroot/', $request->webroot);
|
$this->assertEquals('/app/webroot/', $request->webroot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that a sub-directory containing app|webroot doesn't get mishandled when re-writing is off.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testBaseUrlWithAppAndWebrootInDirname() {
|
||||||
|
Configure::write('App.baseUrl', '/approval/index.php');
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] = '/Users/markstory/Sites/';
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = '/Users/markstory/Sites/approval/index.php';
|
||||||
|
|
||||||
|
$request = new CakeRequest();
|
||||||
|
$this->assertEquals('/approval/index.php', $request->base);
|
||||||
|
$this->assertEquals('/approval/app/webroot/', $request->webroot);
|
||||||
|
|
||||||
|
Configure::write('App.baseUrl', '/webrootable/index.php');
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] = '/Users/markstory/Sites/';
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = '/Users/markstory/Sites/webrootable/index.php';
|
||||||
|
|
||||||
|
$request = new CakeRequest();
|
||||||
|
$this->assertEquals('/webrootable/index.php', $request->base);
|
||||||
|
$this->assertEquals('/webrootable/app/webroot/', $request->webroot);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test baseUrl with no rewrite, and using the app/webroot/index.php file as is normal with virtual hosts.
|
* test baseUrl with no rewrite, and using the app/webroot/index.php file as is normal with virtual hosts.
|
||||||
*
|
*
|
||||||
|
@ -1063,6 +1086,21 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$this->assertEquals('/', $request->webroot);
|
$this->assertEquals('/', $request->webroot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that a request with a . in the main GET parameter is filtered out.
|
||||||
|
* PHP changes GET parameter keys containing dots to _.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetParamsWithDot() {
|
||||||
|
$_GET['/posts/index/add_add'] = '';
|
||||||
|
$_SERVER['SCRIPT_NAME'] = '/cake_dev/app/webroot/index.php';
|
||||||
|
$_SERVER['REQUEST_URI'] = '/cake_dev/posts/index/add.add';
|
||||||
|
|
||||||
|
$request = new CakeRequest();
|
||||||
|
$this->assertEquals(array(), $request->query);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generator for environment configurations
|
* generator for environment configurations
|
||||||
*
|
*
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue