mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Merge branch '2.next' into 2.x
This commit is contained in:
commit
ad5130cd31
44 changed files with 488 additions and 271 deletions
15
app/View/Elements/Flash/default.ctp
Executable file
15
app/View/Elements/Flash/default.ctp
Executable file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package app.View.Emails.html
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
<div id="<?php echo $key; ?>Message" class="<?php echo !empty($params['class']) ? $params['class'] : 'message'; ?>"><?php echo $message; ?></div>
|
|
@ -367,7 +367,7 @@ class TestTask extends BakeTask {
|
|||
* Generate the list of fixtures that will be required to run this test based on
|
||||
* loaded models.
|
||||
*
|
||||
* @param object $subject The object you want to generate fixtures for.
|
||||
* @param CakeObject $subject The object you want to generate fixtures for.
|
||||
* @return array Array of fixtures to be included in the test.
|
||||
*/
|
||||
public function generateFixtureList($subject) {
|
||||
|
|
|
@ -532,7 +532,7 @@ class UpgradeShell extends AppShell {
|
|||
/**
|
||||
* Update components.
|
||||
*
|
||||
* - Make components that extend Object to extend Component.
|
||||
* - Make components that extend CakeObject to extend Component.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -547,6 +547,11 @@ class UpgradeShell extends AppShell {
|
|||
'/([a-zA-Z]*Component extends) Object/',
|
||||
'\1 Component'
|
||||
),
|
||||
array(
|
||||
'*Component extends CakeObject to *Component extends Component',
|
||||
'/([a-zA-Z]*Component extends) CakeObject/',
|
||||
'\1 Component'
|
||||
),
|
||||
);
|
||||
|
||||
$this->_filesRegexpUpdate($patterns);
|
||||
|
|
|
@ -28,7 +28,7 @@ App::uses('File', 'Utility');
|
|||
*
|
||||
* @package Cake.Console
|
||||
*/
|
||||
class Shell extends Object {
|
||||
class Shell extends CakeObject {
|
||||
|
||||
/**
|
||||
* Default error code
|
||||
|
@ -369,7 +369,7 @@ class Shell extends Object {
|
|||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to another Shell. Similar to Object::requestAction()
|
||||
* Dispatch a command to another Shell. Similar to CakeObject::requestAction()
|
||||
* but intended for running shells from other shells.
|
||||
*
|
||||
* ### Usage:
|
||||
|
@ -974,15 +974,48 @@ class Shell extends Object {
|
|||
CakeLog::drop('stderr');
|
||||
return;
|
||||
}
|
||||
if (!$this->_loggerIsConfigured("stdout")) {
|
||||
$this->_configureStdOutLogger();
|
||||
}
|
||||
if (!$this->_loggerIsConfigured("stderr")) {
|
||||
$this->_configureStdErrLogger();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the stdout logger
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _configureStdOutLogger() {
|
||||
CakeLog::config('stdout', array(
|
||||
'engine' => 'Console',
|
||||
'types' => array('notice', 'info'),
|
||||
'stream' => $this->stdout,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the stderr logger
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _configureStdErrLogger() {
|
||||
CakeLog::config('stderr', array(
|
||||
'engine' => 'Console',
|
||||
'types' => array('emergency', 'alert', 'critical', 'error', 'warning', 'debug'),
|
||||
'stream' => $this->stderr,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given logger is configured
|
||||
*
|
||||
* @param string $logger The name of the logger to check
|
||||
* @return bool
|
||||
*/
|
||||
protected function _loggerIsConfigured($logger) {
|
||||
$configured = CakeLog::configured();
|
||||
return in_array($logger, $configured);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ App::uses('ComponentCollection', 'Controller');
|
|||
* @link http://book.cakephp.org/2.0/en/controllers/components.html
|
||||
* @see Controller::$components
|
||||
*/
|
||||
class Component extends Object {
|
||||
class Component extends CakeObject {
|
||||
|
||||
/**
|
||||
* Component collection class used to lazy load components.
|
||||
|
|
|
@ -37,7 +37,7 @@ App::uses('ClassRegistry', 'Utility');
|
|||
*
|
||||
* @package Cake.Controller.Component.Acl
|
||||
*/
|
||||
class DbAcl extends Object implements AclInterface {
|
||||
class DbAcl extends CakeObject implements AclInterface {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
|
@ -22,7 +22,7 @@ App::uses('AclInterface', 'Controller/Component/Acl');
|
|||
*
|
||||
* @package Cake.Controller.Component.Acl
|
||||
*/
|
||||
class IniAcl extends Object implements AclInterface {
|
||||
class IniAcl extends CakeObject implements AclInterface {
|
||||
|
||||
/**
|
||||
* Array with configuration, parsed from ini file
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* @package Cake.Controller.Component.Acl
|
||||
*/
|
||||
class PhpAcl extends Object implements AclInterface {
|
||||
class PhpAcl extends CakeObject implements AclInterface {
|
||||
|
||||
/**
|
||||
* Constant for deny
|
||||
|
|
|
@ -55,7 +55,7 @@ App::uses('CakeEventManager', 'Event');
|
|||
* @property FlashComponent $Flash
|
||||
* @link http://book.cakephp.org/2.0/en/controllers.html
|
||||
*/
|
||||
class Controller extends Object implements CakeEventListener {
|
||||
class Controller extends CakeObject implements CakeEventListener {
|
||||
|
||||
/**
|
||||
* The name of this controller. Controller names are plural, named after the model they manipulate.
|
||||
|
|
212
lib/Cake/Core/CakeObject.php
Normal file
212
lib/Cake/Core/CakeObject.php
Normal file
|
@ -0,0 +1,212 @@
|
|||
<?php
|
||||
/**
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package Cake.Core
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('CakeLog', 'Log');
|
||||
App::uses('Dispatcher', 'Routing');
|
||||
App::uses('Router', 'Routing');
|
||||
App::uses('Set', 'Utility');
|
||||
|
||||
/**
|
||||
* CakeObject class provides a few generic methods used in several subclasses.
|
||||
*
|
||||
* Also includes methods for logging and the special method RequestAction,
|
||||
* to call other Controllers' Actions from anywhere.
|
||||
*
|
||||
* @package Cake.Core
|
||||
*/
|
||||
class CakeObject {
|
||||
|
||||
/**
|
||||
* Constructor, no-op
|
||||
*/
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* CakeObject-to-string conversion.
|
||||
* Each class can override this method as necessary.
|
||||
*
|
||||
* @return string The name of this class
|
||||
*/
|
||||
public function toString() {
|
||||
$class = get_class($this);
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a controller's method from any location. Can be used to connect controllers together
|
||||
* or tie plugins into a main application. requestAction can be used to return rendered views
|
||||
* or fetch the return value from controller actions.
|
||||
*
|
||||
* 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()
|
||||
*
|
||||
* #### Passing POST and GET data
|
||||
*
|
||||
* POST and GET data can be simulated in requestAction. Use `$extra['url']` for
|
||||
* GET data. The `$extra['data']` parameter allows POST data simulation.
|
||||
*
|
||||
* @param string|array $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 parameter.
|
||||
* @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.
|
||||
* @return mixed Boolean true or false on success/failure, or contents
|
||||
* of rendered action if 'return' is set in $extra.
|
||||
*/
|
||||
public function requestAction($url, $extra = array()) {
|
||||
if (empty($url)) {
|
||||
return false;
|
||||
}
|
||||
if (($index = array_search('return', $extra)) !== false) {
|
||||
$extra['return'] = 0;
|
||||
$extra['autoRender'] = 1;
|
||||
unset($extra[$index]);
|
||||
}
|
||||
$arrayUrl = is_array($url);
|
||||
if ($arrayUrl && !isset($extra['url'])) {
|
||||
$extra['url'] = array();
|
||||
}
|
||||
if ($arrayUrl && !isset($extra['data'])) {
|
||||
$extra['data'] = array();
|
||||
}
|
||||
$extra += array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1);
|
||||
$data = isset($extra['data']) ? $extra['data'] : null;
|
||||
unset($extra['data']);
|
||||
|
||||
if (is_string($url) && strpos($url, Router::fullBaseUrl()) === 0) {
|
||||
$url = Router::normalize(str_replace(Router::fullBaseUrl(), '', $url));
|
||||
}
|
||||
if (is_string($url)) {
|
||||
$request = new CakeRequest($url);
|
||||
} elseif (is_array($url)) {
|
||||
$params = $url + array('pass' => array(), 'named' => array(), 'base' => false);
|
||||
$params = $extra + $params;
|
||||
$request = new CakeRequest(Router::reverse($params));
|
||||
}
|
||||
if (isset($data)) {
|
||||
$request->data = $data;
|
||||
}
|
||||
|
||||
$dispatcher = new Dispatcher();
|
||||
$result = $dispatcher->dispatch($request, new CakeResponse(), $extra);
|
||||
Router::popRequest();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a method on this object with the given parameters. Provides an OO wrapper
|
||||
* for `call_user_func_array`
|
||||
*
|
||||
* @param string $method Name of the method to call
|
||||
* @param array $params Parameter list to use when calling $method
|
||||
* @return mixed Returns the result of the method call
|
||||
*/
|
||||
public function dispatchMethod($method, $params = array()) {
|
||||
switch (count($params)) {
|
||||
case 0:
|
||||
return $this->{$method}();
|
||||
case 1:
|
||||
return $this->{$method}($params[0]);
|
||||
case 2:
|
||||
return $this->{$method}($params[0], $params[1]);
|
||||
case 3:
|
||||
return $this->{$method}($params[0], $params[1], $params[2]);
|
||||
case 4:
|
||||
return $this->{$method}($params[0], $params[1], $params[2], $params[3]);
|
||||
case 5:
|
||||
return $this->{$method}($params[0], $params[1], $params[2], $params[3], $params[4]);
|
||||
default:
|
||||
return call_user_func_array(array(&$this, $method), $params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop execution of the current script. Wraps exit() making
|
||||
* testing easier.
|
||||
*
|
||||
* @param int|string $status see http://php.net/exit for values
|
||||
* @return void
|
||||
*/
|
||||
protected function _stop($status = 0) {
|
||||
exit($status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to write a message to CakeLog. See CakeLog::write()
|
||||
* for more information on writing to logs.
|
||||
*
|
||||
* @param string $msg Log message
|
||||
* @param int $type Error type constant. Defined in app/Config/core.php.
|
||||
* @param null|string|array $scope The scope(s) a log message is being created in.
|
||||
* See CakeLog::config() for more information on logging scopes.
|
||||
* @return bool Success of log write
|
||||
*/
|
||||
public function log($msg, $type = LOG_ERR, $scope = null) {
|
||||
if (!is_string($msg)) {
|
||||
$msg = print_r($msg, true);
|
||||
}
|
||||
|
||||
return CakeLog::write($type, $msg, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting of multiple properties of the object in a single line of code. Will only set
|
||||
* properties that are part of a class declaration.
|
||||
*
|
||||
* @param array $properties An associative array containing properties and corresponding values.
|
||||
* @return void
|
||||
*/
|
||||
protected function _set($properties = array()) {
|
||||
if (is_array($properties) && !empty($properties)) {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($properties as $key => $val) {
|
||||
if (array_key_exists($key, $vars)) {
|
||||
$this->{$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges this objects $property with the property in $class' definition.
|
||||
* This classes value for the property will be merged on top of $class'
|
||||
*
|
||||
* This provides some of the DRY magic CakePHP provides. If you want to shut it off, redefine
|
||||
* this method as an empty function.
|
||||
*
|
||||
* @param array $properties The name of the properties to merge.
|
||||
* @param string $class The class to merge the property with.
|
||||
* @param bool $normalize Set to true to run the properties through Hash::normalize() before merging.
|
||||
* @return void
|
||||
*/
|
||||
protected function _mergeVars($properties, $class, $normalize = true) {
|
||||
$classProperties = get_class_vars($class);
|
||||
foreach ($properties as $var) {
|
||||
if (isset($classProperties[$var]) &&
|
||||
!empty($classProperties[$var]) &&
|
||||
is_array($this->{$var}) &&
|
||||
$this->{$var} != $classProperties[$var]
|
||||
) {
|
||||
if ($normalize) {
|
||||
$classProperties[$var] = Hash::normalize($classProperties[$var]);
|
||||
$this->{$var} = Hash::normalize($this->{$var});
|
||||
}
|
||||
$this->{$var} = Hash::merge($classProperties[$var], $this->{$var});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -14,199 +14,5 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('CakeLog', 'Log');
|
||||
App::uses('Dispatcher', 'Routing');
|
||||
App::uses('Router', 'Routing');
|
||||
App::uses('Set', 'Utility');
|
||||
|
||||
/**
|
||||
* Object class provides a few generic methods used in several subclasses.
|
||||
*
|
||||
* Also includes methods for logging and the special method RequestAction,
|
||||
* to call other Controllers' Actions from anywhere.
|
||||
*
|
||||
* @package Cake.Core
|
||||
*/
|
||||
class Object {
|
||||
|
||||
/**
|
||||
* Constructor, no-op
|
||||
*/
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Object-to-string conversion.
|
||||
* Each class can override this method as necessary.
|
||||
*
|
||||
* @return string The name of this class
|
||||
*/
|
||||
public function toString() {
|
||||
$class = get_class($this);
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a controller's method from any location. Can be used to connect controllers together
|
||||
* or tie plugins into a main application. requestAction can be used to return rendered views
|
||||
* or fetch the return value from controller actions.
|
||||
*
|
||||
* 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()
|
||||
*
|
||||
* #### Passing POST and GET data
|
||||
*
|
||||
* POST and GET data can be simulated in requestAction. Use `$extra['url']` for
|
||||
* GET data. The `$extra['data']` parameter allows POST data simulation.
|
||||
*
|
||||
* @param string|array $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 parameter.
|
||||
* @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.
|
||||
* @return mixed Boolean true or false on success/failure, or contents
|
||||
* of rendered action if 'return' is set in $extra.
|
||||
*/
|
||||
public function requestAction($url, $extra = array()) {
|
||||
if (empty($url)) {
|
||||
return false;
|
||||
}
|
||||
if (($index = array_search('return', $extra)) !== false) {
|
||||
$extra['return'] = 0;
|
||||
$extra['autoRender'] = 1;
|
||||
unset($extra[$index]);
|
||||
}
|
||||
$arrayUrl = is_array($url);
|
||||
if ($arrayUrl && !isset($extra['url'])) {
|
||||
$extra['url'] = array();
|
||||
}
|
||||
if ($arrayUrl && !isset($extra['data'])) {
|
||||
$extra['data'] = array();
|
||||
}
|
||||
$extra += array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1);
|
||||
$data = isset($extra['data']) ? $extra['data'] : null;
|
||||
unset($extra['data']);
|
||||
|
||||
if (is_string($url) && strpos($url, Router::fullBaseUrl()) === 0) {
|
||||
$url = Router::normalize(str_replace(Router::fullBaseUrl(), '', $url));
|
||||
}
|
||||
if (is_string($url)) {
|
||||
$request = new CakeRequest($url);
|
||||
} elseif (is_array($url)) {
|
||||
$params = $url + array('pass' => array(), 'named' => array(), 'base' => false);
|
||||
$params = $extra + $params;
|
||||
$request = new CakeRequest(Router::reverse($params));
|
||||
}
|
||||
if (isset($data)) {
|
||||
$request->data = $data;
|
||||
}
|
||||
|
||||
$dispatcher = new Dispatcher();
|
||||
$result = $dispatcher->dispatch($request, new CakeResponse(), $extra);
|
||||
Router::popRequest();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls a method on this object with the given parameters. Provides an OO wrapper
|
||||
* for `call_user_func_array`
|
||||
*
|
||||
* @param string $method Name of the method to call
|
||||
* @param array $params Parameter list to use when calling $method
|
||||
* @return mixed Returns the result of the method call
|
||||
*/
|
||||
public function dispatchMethod($method, $params = array()) {
|
||||
switch (count($params)) {
|
||||
case 0:
|
||||
return $this->{$method}();
|
||||
case 1:
|
||||
return $this->{$method}($params[0]);
|
||||
case 2:
|
||||
return $this->{$method}($params[0], $params[1]);
|
||||
case 3:
|
||||
return $this->{$method}($params[0], $params[1], $params[2]);
|
||||
case 4:
|
||||
return $this->{$method}($params[0], $params[1], $params[2], $params[3]);
|
||||
case 5:
|
||||
return $this->{$method}($params[0], $params[1], $params[2], $params[3], $params[4]);
|
||||
default:
|
||||
return call_user_func_array(array(&$this, $method), $params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop execution of the current script. Wraps exit() making
|
||||
* testing easier.
|
||||
*
|
||||
* @param int|string $status see http://php.net/exit for values
|
||||
* @return void
|
||||
*/
|
||||
protected function _stop($status = 0) {
|
||||
exit($status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to write a message to CakeLog. See CakeLog::write()
|
||||
* for more information on writing to logs.
|
||||
*
|
||||
* @param string $msg Log message
|
||||
* @param int $type Error type constant. Defined in app/Config/core.php.
|
||||
* @param null|string|array $scope The scope(s) a log message is being created in.
|
||||
* See CakeLog::config() for more information on logging scopes.
|
||||
* @return bool Success of log write
|
||||
*/
|
||||
public function log($msg, $type = LOG_ERR, $scope = null) {
|
||||
if (!is_string($msg)) {
|
||||
$msg = print_r($msg, true);
|
||||
}
|
||||
|
||||
return CakeLog::write($type, $msg, $scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting of multiple properties of the object in a single line of code. Will only set
|
||||
* properties that are part of a class declaration.
|
||||
*
|
||||
* @param array $properties An associative array containing properties and corresponding values.
|
||||
* @return void
|
||||
*/
|
||||
protected function _set($properties = array()) {
|
||||
if (is_array($properties) && !empty($properties)) {
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($properties as $key => $val) {
|
||||
if (array_key_exists($key, $vars)) {
|
||||
$this->{$key} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges this objects $property with the property in $class' definition.
|
||||
* This classes value for the property will be merged on top of $class'
|
||||
*
|
||||
* This provides some of the DRY magic CakePHP provides. If you want to shut it off, redefine
|
||||
* this method as an empty function.
|
||||
*
|
||||
* @param array $properties The name of the properties to merge.
|
||||
* @param string $class The class to merge the property with.
|
||||
* @param bool $normalize Set to true to run the properties through Hash::normalize() before merging.
|
||||
* @return void
|
||||
*/
|
||||
protected function _mergeVars($properties, $class, $normalize = true) {
|
||||
$classProperties = get_class_vars($class);
|
||||
foreach ($properties as $var) {
|
||||
if (isset($classProperties[$var]) &&
|
||||
!empty($classProperties[$var]) &&
|
||||
is_array($this->{$var}) &&
|
||||
$this->{$var} != $classProperties[$var]
|
||||
) {
|
||||
if ($normalize) {
|
||||
$classProperties[$var] = Hash::normalize($classProperties[$var]);
|
||||
$this->{$var} = Hash::normalize($this->{$var});
|
||||
}
|
||||
$this->{$var} = Hash::merge($classProperties[$var], $this->{$var});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
App::uses('CakeObject', 'Core');
|
||||
class_alias('CakeObject', 'Object');
|
||||
|
|
|
@ -207,7 +207,6 @@ class ErrorHandler {
|
|||
if (error_reporting() === 0) {
|
||||
return false;
|
||||
}
|
||||
$errorConfig = Configure::read('Error');
|
||||
list($error, $log) = static::mapErrorCode($code);
|
||||
if ($log === LOG_ERR) {
|
||||
return static::handleFatalError($code, $description, $file, $line);
|
||||
|
@ -228,21 +227,7 @@ class ErrorHandler {
|
|||
);
|
||||
return Debugger::getInstance()->outputError($data);
|
||||
}
|
||||
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
||||
if (!empty($errorConfig['trace'])) {
|
||||
// https://bugs.php.net/bug.php?id=65322
|
||||
if (version_compare(PHP_VERSION, '5.4.21', '<')) {
|
||||
if (!class_exists('Debugger')) {
|
||||
App::load('Debugger');
|
||||
}
|
||||
if (!class_exists('CakeText')) {
|
||||
App::uses('CakeText', 'Utility');
|
||||
App::load('CakeText');
|
||||
}
|
||||
}
|
||||
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
||||
$message .= "\nTrace:\n" . $trace . "\n";
|
||||
}
|
||||
$message = static::_getErrorMessage($error, $code, $description, $file, $line);
|
||||
return CakeLog::write($log, $message);
|
||||
}
|
||||
|
||||
|
@ -328,4 +313,33 @@ class ErrorHandler {
|
|||
return array($error, $log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the string to use to describe the error.
|
||||
*
|
||||
* @param string $error The error type (e.g. "Warning")
|
||||
* @param int $code Code of error
|
||||
* @param string $description Error description
|
||||
* @param string $file File on which error occurred
|
||||
* @param int $line Line that triggered the error
|
||||
* @return string
|
||||
*/
|
||||
protected static function _getErrorMessage($error, $code, $description, $file, $line) {
|
||||
$errorConfig = Configure::read('Error');
|
||||
$message = $error . ' (' . $code . '): ' . $description . ' in [' . $file . ', line ' . $line . ']';
|
||||
if (!empty($errorConfig['trace'])) {
|
||||
// https://bugs.php.net/bug.php?id=65322
|
||||
if (version_compare(PHP_VERSION, '5.4.21', '<')) {
|
||||
if (!class_exists('Debugger')) {
|
||||
App::load('Debugger');
|
||||
}
|
||||
if (!class_exists('CakeText')) {
|
||||
App::uses('CakeText', 'Utility');
|
||||
App::load('CakeText');
|
||||
}
|
||||
}
|
||||
$trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
|
||||
$message .= "\nTrace:\n" . $trace . "\n";
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ App::uses('File', 'Utility');
|
|||
*
|
||||
* @package Cake.Model
|
||||
*/
|
||||
class CakeSchema extends Object {
|
||||
class CakeSchema extends CakeObject {
|
||||
|
||||
/**
|
||||
* Name of the schema.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* @link http://book.cakephp.org/2.0/en/models/datasources.html#basic-api-for-datasources
|
||||
* @package Cake.Model.Datasource
|
||||
*/
|
||||
class DataSource extends Object {
|
||||
class DataSource extends CakeObject {
|
||||
|
||||
/**
|
||||
* Are we connected to the DataSource?
|
||||
|
|
|
@ -3559,6 +3559,15 @@ class DboSource extends DataSource {
|
|||
return 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Empties the query caches.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function flushQueryCache() {
|
||||
$this->_queryCache = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a new key for the in memory sql query cache
|
||||
*
|
||||
|
|
|
@ -42,7 +42,7 @@ App::uses('CakeEventManager', 'Event');
|
|||
* @package Cake.Model
|
||||
* @link http://book.cakephp.org/2.0/en/models.html
|
||||
*/
|
||||
class Model extends Object implements CakeEventListener {
|
||||
class Model extends CakeObject implements CakeEventListener {
|
||||
|
||||
/**
|
||||
* The name of the DataSource connection that this Model uses
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
* @see Model::$actsAs
|
||||
* @see BehaviorCollection::load()
|
||||
*/
|
||||
class ModelBehavior extends Object {
|
||||
class ModelBehavior extends CakeObject {
|
||||
|
||||
/**
|
||||
* Contains configuration settings for use with individual model objects. This
|
||||
|
|
|
@ -122,6 +122,7 @@ class CakeResponse {
|
|||
'ips' => 'application/x-ipscript',
|
||||
'ipx' => 'application/x-ipix',
|
||||
'js' => 'application/javascript',
|
||||
'jsonapi' => 'application/vnd.api+json',
|
||||
'latex' => 'application/x-latex',
|
||||
'lha' => 'application/octet-stream',
|
||||
'lsp' => 'application/x-lisp',
|
||||
|
@ -264,6 +265,14 @@ class CakeResponse {
|
|||
'xbm' => 'image/x-xbitmap',
|
||||
'xpm' => 'image/x-xpixmap',
|
||||
'xwd' => 'image/x-xwindowdump',
|
||||
'psd' => array(
|
||||
'application/photoshop',
|
||||
'application/psd',
|
||||
'image/psd',
|
||||
'image/x-photoshop',
|
||||
'image/photoshop',
|
||||
'zz-application/zz-winassoc-psd'
|
||||
),
|
||||
'ice' => 'x-conference/x-cooltalk',
|
||||
'iges' => 'model/iges',
|
||||
'igs' => 'model/iges',
|
||||
|
@ -300,7 +309,8 @@ class CakeResponse {
|
|||
'vcf' => 'text/x-vcard',
|
||||
'vtt' => 'text/vtt',
|
||||
'mkv' => 'video/x-matroska',
|
||||
'pkpass' => 'application/vnd.apple.pkpass'
|
||||
'pkpass' => 'application/vnd.apple.pkpass',
|
||||
'ajax' => 'text/html'
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ App::uses('Validation', 'Utility');
|
|||
class CakeSocket {
|
||||
|
||||
/**
|
||||
* Object description
|
||||
* CakeSocket description
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -410,7 +410,7 @@ class CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Resets the state of this Socket instance to it's initial state (before Object::__construct got executed)
|
||||
* Resets the state of this Socket instance to it's initial state (before CakeObject::__construct got executed)
|
||||
*
|
||||
* @param array $state Array with key and values to reset
|
||||
* @return bool True on success
|
||||
|
|
|
@ -1023,7 +1023,7 @@ class HttpSocket extends CakeSocket {
|
|||
}
|
||||
|
||||
/**
|
||||
* Resets the state of this HttpSocket instance to it's initial state (before Object::__construct got executed) or does
|
||||
* Resets the state of this HttpSocket instance to it's initial state (before CakeObject::__construct got executed) or does
|
||||
* the same thing partially for the request and the response property only.
|
||||
*
|
||||
* @param bool $full If set to false only HttpSocket::response and HttpSocket::request are reset
|
||||
|
|
|
@ -664,7 +664,7 @@ class Router {
|
|||
* created later in the request.
|
||||
*
|
||||
* Nested requests will create a stack of requests. You can remove requests using
|
||||
* Router::popRequest(). This is done automatically when using Object::requestAction().
|
||||
* Router::popRequest(). This is done automatically when using CakeObject::requestAction().
|
||||
*
|
||||
* Will accept either a CakeRequest object or an array of arrays. Support for
|
||||
* accepting arrays may be removed in the future.
|
||||
|
|
|
@ -487,9 +487,9 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
*/
|
||||
public function testDispatchNotAShellWithMain() {
|
||||
$Dispatcher = new TestShellDispatcher();
|
||||
$methods = get_class_methods('Object');
|
||||
$methods = get_class_methods('CakeObject');
|
||||
array_push($methods, 'main', 'initdb', 'initialize', 'loadTasks', 'startup', '_secret');
|
||||
$Shell = $this->getMock('Object', $methods);
|
||||
$Shell = $this->getMock('CakeObject', $methods);
|
||||
|
||||
$Shell->expects($this->never())->method('initialize');
|
||||
$Shell->expects($this->once())->method('startup');
|
||||
|
@ -501,7 +501,7 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
$this->assertEquals(array(), $Dispatcher->args);
|
||||
|
||||
$Shell = $this->getMock('Object', $methods);
|
||||
$Shell = $this->getMock('CakeObject', $methods);
|
||||
$Shell->expects($this->once())->method('initdb')->will($this->returnValue(true));
|
||||
$Shell->expects($this->once())->method('startup');
|
||||
$Dispatcher->TestShell = $Shell;
|
||||
|
@ -518,9 +518,9 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
*/
|
||||
public function testDispatchNotAShellWithoutMain() {
|
||||
$Dispatcher = new TestShellDispatcher();
|
||||
$methods = get_class_methods('Object');
|
||||
$methods = get_class_methods('CakeObject');
|
||||
array_push($methods, 'main', 'initdb', 'initialize', 'loadTasks', 'startup', '_secret');
|
||||
$Shell = $this->getMock('Object', $methods);
|
||||
$Shell = $this->getMock('CakeObject', $methods);
|
||||
|
||||
$Shell->expects($this->never())->method('initialize');
|
||||
$Shell->expects($this->once())->method('startup');
|
||||
|
@ -532,7 +532,7 @@ class ShellDispatcherTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
$this->assertEquals(array(), $Dispatcher->args);
|
||||
|
||||
$Shell = $this->getMock('Object', $methods);
|
||||
$Shell = $this->getMock('CakeObject', $methods);
|
||||
$Shell->expects($this->once())->method('initdb')->will($this->returnValue(true));
|
||||
$Shell->expects($this->once())->method('startup');
|
||||
$Dispatcher->TestShell = $Shell;
|
||||
|
|
|
@ -920,6 +920,8 @@ TEXT;
|
|||
* @return void
|
||||
*/
|
||||
public function testFileAndConsoleLogging() {
|
||||
CakeLog::disable('stdout');
|
||||
CakeLog::disable('stderr');
|
||||
// file logging
|
||||
$this->Shell->log_something();
|
||||
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
||||
|
@ -944,6 +946,9 @@ TEXT;
|
|||
$this->assertTrue(file_exists(LOGS . 'error.log'));
|
||||
$contents = file_get_contents(LOGS . 'error.log');
|
||||
$this->assertContains($this->Shell->testMessage, $contents);
|
||||
|
||||
CakeLog::enable('stdout');
|
||||
CakeLog::enable('stderr');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -995,4 +1000,34 @@ TEXT;
|
|||
public function testGetInvalidHelper() {
|
||||
$this->Shell->helper("tomato");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that shell loggers do not get overridden in constructor if already configured
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testShellLoggersDoNotGetOverridden() {
|
||||
$shell = $this->getMock(
|
||||
"Shell", array(
|
||||
"_loggerIsConfigured",
|
||||
"configureStdOutLogger",
|
||||
"configureStdErrLogger",
|
||||
),
|
||||
array(),
|
||||
"",
|
||||
false
|
||||
);
|
||||
|
||||
$shell->expects($this->exactly(2))
|
||||
->method("_loggerIsConfigured")
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$shell->expects($this->never())
|
||||
->method("_configureStdOutLogger");
|
||||
|
||||
$shell->expects($this->never())
|
||||
->method("_configureStdErrLogger");
|
||||
|
||||
$shell->__construct();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ class TestAuthComponent extends AuthComponent {
|
|||
* Helper method to add/set an authenticate object instance
|
||||
*
|
||||
* @param int $index The index at which to add/set the object
|
||||
* @param object $object The object to add/set
|
||||
* @param CakeObject $object The object to add/set
|
||||
* @return void
|
||||
*/
|
||||
public function setAuthenticateObject($index, $object) {
|
||||
|
@ -97,7 +97,7 @@ class TestAuthComponent extends AuthComponent {
|
|||
* Helper method to get an authenticate object instance
|
||||
*
|
||||
* @param int $index The index at which to get the object
|
||||
* @return object $object
|
||||
* @return CakeObject $object
|
||||
*/
|
||||
public function getAuthenticateObject($index) {
|
||||
$this->constructAuthenticate();
|
||||
|
@ -108,7 +108,7 @@ class TestAuthComponent extends AuthComponent {
|
|||
* Helper method to add/set an authorize object instance
|
||||
*
|
||||
* @param int $index The index at which to add/set the object
|
||||
* @param Object $object The object to add/set
|
||||
* @param CakeObject $object The object to add/set
|
||||
* @return void
|
||||
*/
|
||||
public function setAuthorizeObject($index, $object) {
|
||||
|
@ -118,6 +118,7 @@ class TestAuthComponent extends AuthComponent {
|
|||
/**
|
||||
* stop method
|
||||
*
|
||||
* @param int $status
|
||||
* @return void
|
||||
*/
|
||||
protected function _stop($status = 0) {
|
||||
|
|
|
@ -135,7 +135,7 @@ class SessionComponentTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testSessionIdConsistentAcrossRequestAction() {
|
||||
$Object = new Object();
|
||||
$Object = new CakeObject();
|
||||
$Session = new SessionComponent($this->ComponentCollection);
|
||||
$expected = $Session->id();
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class MergeVarsAppController extends Controller {
|
|||
*
|
||||
* @package Cake.Test.Case.Controller
|
||||
*/
|
||||
class MergeVarComponent extends Object {
|
||||
class MergeVarComponent extends CakeObject {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ class TestController extends ControllerTestAppController {
|
|||
*
|
||||
* @package Cake.Test.Case.Controller
|
||||
*/
|
||||
class TestComponent extends Object {
|
||||
class TestComponent extends CakeObject {
|
||||
|
||||
/**
|
||||
* beforeRedirect method
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
App::uses('CakeObject', 'Core');
|
||||
App::uses('Object', 'Core');
|
||||
App::uses('Router', 'Routing');
|
||||
App::uses('Controller', 'Controller');
|
||||
|
@ -128,11 +129,11 @@ class RequestActionController extends Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* TestObject class
|
||||
* TestCakeObject class
|
||||
*
|
||||
* @package Cake.Test.Case.Core
|
||||
*/
|
||||
class TestObject extends Object {
|
||||
class TestCakeObject extends CakeObject {
|
||||
|
||||
/**
|
||||
* firstName property
|
||||
|
@ -274,7 +275,7 @@ class ObjectTestModel extends CakeTestModel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Object Test class
|
||||
* CakeObject Test class
|
||||
*
|
||||
* @package Cake.Test.Case.Core
|
||||
*/
|
||||
|
@ -294,7 +295,7 @@ class ObjectTest extends CakeTestCase {
|
|||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->object = new TestObject();
|
||||
$this->object = new TestCakeObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -365,7 +366,7 @@ class ObjectTest extends CakeTestCase {
|
|||
*/
|
||||
public function testToString() {
|
||||
$result = strtolower($this->object->toString());
|
||||
$this->assertEquals('testobject', $result);
|
||||
$this->assertEquals('testcakeobject', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,7 +395,7 @@ class ObjectTest extends CakeTestCase {
|
|||
$expected[] = array('crazyMethod' => array(1, 2, 3, 4, 5, 6, 7));
|
||||
$this->assertSame($expected, $this->object->methodCalls);
|
||||
|
||||
$this->object = new TestObject();
|
||||
$this->object = new TestCakeObject();
|
||||
$this->assertSame($this->object->methodCalls, array());
|
||||
|
||||
$this->object->dispatchMethod('emptyMethod');
|
||||
|
@ -677,4 +678,15 @@ class ObjectTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEquals($data, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test backward compatibility
|
||||
*
|
||||
* @return voind
|
||||
*/
|
||||
public function testBackwardCompatibility() {
|
||||
$this->skipIf(version_compare(PHP_VERSION, '7.0.0', '>='));
|
||||
|
||||
$this->assertInstanceOf('Object', new ObjectTestModel);
|
||||
}
|
||||
}
|
|
@ -203,7 +203,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
|||
$result[0]
|
||||
);
|
||||
$this->assertRegExp('/^Trace:/', $result[1]);
|
||||
$this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[2]);
|
||||
$this->assertRegExp('/^ErrorHandlerTest\:\:testHandleErrorLoggingTrace\(\)/', $result[3]);
|
||||
if (file_exists(LOGS . 'debug.log')) {
|
||||
unlink(LOGS . 'debug.log');
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class TestSource extends DataSource {
|
|||
/**
|
||||
* Returns the schema for the datasource to enable create/update
|
||||
*
|
||||
* @param object $Model
|
||||
* @param Model $Model
|
||||
* @return array
|
||||
*/
|
||||
public function describe(Model $Model) {
|
||||
|
|
|
@ -97,7 +97,7 @@ class SqlserverTestDb extends Sqlserver {
|
|||
/**
|
||||
* describe method
|
||||
*
|
||||
* @param object $model
|
||||
* @param Model $model
|
||||
* @return void
|
||||
*/
|
||||
public function describe($model) {
|
||||
|
|
|
@ -1810,4 +1810,20 @@ class DboSourceTest extends CakeTestCase {
|
|||
$User->Article = $Article;
|
||||
$User->find('first', array('conditions' => array('User.id' => 1), 'recursive' => 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that flushQueryCache works as expected
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFlushQueryCache() {
|
||||
$this->db->flushQueryCache();
|
||||
$this->db->query('SELECT 1');
|
||||
$this->db->query('SELECT 1');
|
||||
$this->db->query('SELECT 2');
|
||||
$this->assertAttributeCount(2, '_queryCache', $this->db);
|
||||
|
||||
$this->db->flushQueryCache();
|
||||
$this->assertAttributeCount(0, '_queryCache', $this->db);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class TestAuthor extends Author {
|
|||
/**
|
||||
* Helper method to set a datasource object
|
||||
*
|
||||
* @param Object $object The datasource object
|
||||
* @param DataSource $object The datasource object
|
||||
* @return void
|
||||
*/
|
||||
public function setDataSourceObject($object) {
|
||||
|
@ -81,7 +81,7 @@ class TestPost extends Post {
|
|||
/**
|
||||
* Helper method to set a datasource object
|
||||
*
|
||||
* @param Object $object The datasource object
|
||||
* @param DataSource $object The datasource object
|
||||
* @return void
|
||||
*/
|
||||
public function setDataSourceObject($object) {
|
||||
|
|
|
@ -1779,7 +1779,7 @@ class HttpSocketTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* This tests asserts HttpSocket::reset() resets a HttpSocket instance to it's initial state (before Object::__construct
|
||||
* This tests asserts HttpSocket::reset() resets a HttpSocket instance to it's initial state (before CakeObject::__construct
|
||||
* got executed)
|
||||
*
|
||||
* @return void
|
||||
|
@ -1803,7 +1803,7 @@ class HttpSocketTest extends CakeTestCase {
|
|||
|
||||
/**
|
||||
* This tests asserts HttpSocket::reset(false) resets certain HttpSocket properties to their initial state (before
|
||||
* Object::__construct got executed).
|
||||
* CakeObject::__construct got executed).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -2454,7 +2454,7 @@ class RouterTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testCustomRouteException() {
|
||||
Router::connect('/:controller', array(), array('routeClass' => 'Object'));
|
||||
Router::connect('/:controller', array(), array('routeClass' => 'CakeObject'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2801,7 +2801,7 @@ class RouterTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testSettingInvalidDefaultRouteException() {
|
||||
Router::defaultRouteClass('Object');
|
||||
Router::defaultRouteClass('CakeObject');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -558,7 +558,7 @@ class CakeTimeTest extends CakeTestCase {
|
|||
$expected = date('l jS \of F Y h:i:s A', $time);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$this->assertFalse($this->Time->toServer(time(), new Object()));
|
||||
$this->assertFalse($this->Time->toServer(time(), new CakeObject()));
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class GenericObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* First Extension of Generic Object
|
||||
* First Extension of Generic CakeObject
|
||||
*/
|
||||
class FirstGenericObject extends GenericObject {
|
||||
|
||||
|
@ -53,7 +53,7 @@ class FirstGenericObject extends GenericObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* Second Extension of Generic Object
|
||||
* Second Extension of Generic CakeObject
|
||||
*/
|
||||
class SecondGenericObject extends GenericObject {
|
||||
|
||||
|
@ -66,7 +66,7 @@ class SecondGenericObject extends GenericObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* Third Extension of Generic Object
|
||||
* Third Extension of Generic CakeObject
|
||||
*/
|
||||
class ThirdGenericObject extends GenericObject {
|
||||
|
||||
|
@ -86,7 +86,7 @@ class GenericObjectCollection extends ObjectCollection {
|
|||
/**
|
||||
* Loads a generic object
|
||||
*
|
||||
* @param string $object Object name
|
||||
* @param string $object CakeObject name
|
||||
* @param array $settings Settings array
|
||||
* @return array List of loaded objects
|
||||
*/
|
||||
|
@ -109,7 +109,7 @@ class GenericObjectCollection extends ObjectCollection {
|
|||
* settings
|
||||
*
|
||||
* @param string $name Name of the object
|
||||
* @param Object $object The object to use
|
||||
* @param CakeObject $object The object to use
|
||||
* @param array $settings Settings to apply for the object
|
||||
* @return array Loaded objects
|
||||
*/
|
||||
|
@ -542,7 +542,7 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
|
||||
$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
|
||||
|
||||
$subjectClass = new Object();
|
||||
$subjectClass = new CakeObject();
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with($subjectClass, 'first argument')
|
||||
|
@ -568,7 +568,7 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->setObject('TriggerMockFirst', $this->FirstGenericObject);
|
||||
$this->Objects->setObject('TriggerMockSecond', $this->SecondGenericObject);
|
||||
|
||||
$subjectClass = new Object();
|
||||
$subjectClass = new CakeObject();
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with('first argument')
|
||||
|
|
|
@ -66,6 +66,8 @@ class Contact extends CakeTestModel {
|
|||
'email' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||
'phone' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||
'password' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||
'lap_time' => array('type' => 'time', 'null' => '', 'default' => '', 'length' => '2'),
|
||||
'last_seen' => array('type' => 'datetime', 'null' => '', 'default' => '', 'length' => '3'),
|
||||
'published' => array('type' => 'date', 'null' => true, 'default' => null, 'length' => null),
|
||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null),
|
||||
|
@ -3390,6 +3392,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'*/div',
|
||||
array('div' => array('class' => 'input password')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input time')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input datetime')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
|
@ -3415,6 +3421,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'*/div',
|
||||
array('div' => array('class' => 'input password')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input time')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input datetime')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
|
@ -3445,6 +3455,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'*/div',
|
||||
array('div' => array('class' => 'input password')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input time')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input datetime')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
|
@ -3471,6 +3485,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'*/div',
|
||||
array('div' => array('class' => 'input password')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input time')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input datetime')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
|
@ -3504,6 +3522,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'*/div',
|
||||
array('div' => array('class' => 'input password')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input time')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input datetime')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
|
@ -3534,6 +3556,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
'*/div',
|
||||
array('div' => array('class' => 'input password')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input time')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input datetime')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
'*/div',
|
||||
array('div' => array('class' => 'input date')),
|
||||
|
@ -7787,6 +7813,27 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertContains('value="2008" selected="selected"', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testInputTimeWithMicrosecondsAsText method
|
||||
*
|
||||
* since times and datetimes can now have a Length, specifying the microsecond
|
||||
* precision, a text-type input shouldn't have set a maxLength attribute.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testInputTimeWithMicrosecondsAsText() {
|
||||
$this->Form->request->data = array();
|
||||
$this->Form->create('Contact');
|
||||
$result = $this->Form->input('lap_time', array(
|
||||
'type' => 'text',
|
||||
));
|
||||
$this->assertNotContains('maxlength=', $result);
|
||||
$result = $this->Form->input('last_seen', array(
|
||||
'type' => 'text',
|
||||
));
|
||||
$this->assertNotContains('maxlength=', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* testTextArea method
|
||||
*
|
||||
|
|
|
@ -56,7 +56,7 @@ abstract class ObjectCollection {
|
|||
*
|
||||
* @param string $name Name of object to load.
|
||||
* @param array $options Array of configuration options for the object to be constructed.
|
||||
* @return object the constructed object
|
||||
* @return CakeObject the constructed object
|
||||
*/
|
||||
abstract public function load($name, $options = array());
|
||||
|
||||
|
@ -308,7 +308,7 @@ abstract class ObjectCollection {
|
|||
* Adds or overwrites an instantiated object to the collection
|
||||
*
|
||||
* @param string $name Name of the object
|
||||
* @param Object $object The object to use
|
||||
* @param CakeObject $object The object to use
|
||||
* @return array Loaded objects
|
||||
*/
|
||||
public function set($name = null, $object = null) {
|
||||
|
|
|
@ -17,4 +17,4 @@
|
|||
// @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
// +--------------------------------------------------------------------------------------------+ //
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
2.8.9
|
||||
2.9.0
|
||||
|
|
|
@ -24,7 +24,7 @@ App::uses('Inflector', 'Utility');
|
|||
*
|
||||
* @package Cake.View
|
||||
*/
|
||||
class Helper extends Object {
|
||||
class Helper extends CakeObject {
|
||||
|
||||
/**
|
||||
* Settings for this helper.
|
||||
|
|
|
@ -1319,6 +1319,8 @@ class FormHelper extends AppHelper {
|
|||
is_scalar($fieldDef['length']) &&
|
||||
$fieldDef['length'] < 1000000 &&
|
||||
$fieldDef['type'] !== 'decimal' &&
|
||||
$fieldDef['type'] !== 'time' &&
|
||||
$fieldDef['type'] !== 'datetime' &&
|
||||
$options['type'] !== 'select'
|
||||
);
|
||||
if ($autoLength &&
|
||||
|
|
|
@ -53,7 +53,7 @@ App::uses('CakeResponse', 'Network');
|
|||
* @property TimeHelper $Time
|
||||
* @property ViewBlock $Blocks
|
||||
*/
|
||||
class View extends Object {
|
||||
class View extends CakeObject {
|
||||
|
||||
/**
|
||||
* Helpers collection
|
||||
|
|
|
@ -145,7 +145,7 @@ App::uses('ErrorHandler', 'Error');
|
|||
App::uses('Configure', 'Core');
|
||||
App::uses('CakePlugin', 'Core');
|
||||
App::uses('Cache', 'Cache');
|
||||
App::uses('Object', 'Core');
|
||||
App::uses('CakeObject', 'Core');
|
||||
App::uses('Multibyte', 'I18n');
|
||||
|
||||
App::$bootstrapping = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue