mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge branch '2.0-phpunit' of github.com:cakephp/cakephp into 2.0-phpunit
This commit is contained in:
commit
3586626833
276 changed files with 1128 additions and 824 deletions
|
@ -157,6 +157,11 @@
|
|||
|
||||
/**
|
||||
* The name of CakePHP's session cookie.
|
||||
*
|
||||
* Note the guidelines for Session names states: "The session name references
|
||||
* the session id in cookies and URLs. It should contain only alphanumeric
|
||||
* characters."
|
||||
* @link http://php.net/session_name
|
||||
*/
|
||||
Configure::write('Session.cookie', 'CAKEPHP');
|
||||
|
||||
|
@ -183,8 +188,8 @@
|
|||
* Valid values:
|
||||
*
|
||||
* 'high' Session timeout in 'Session.timeout' x 10
|
||||
* 'medium' Session timeout in 'Session.timeout' x 100
|
||||
* 'low' Session timeout in 'Session.timeout' x 300
|
||||
* 'medium' Session timeout in 'Session.timeout' x 5040
|
||||
* 'low' Session timeout in 'Session.timeout' x 2628000
|
||||
*
|
||||
* CakePHP session IDs are also regenerated between requests if
|
||||
* 'Security.level' is set to 'high'.
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.libs
|
||||
* @subpackage cake.app.webroot
|
||||
* @since CakePHP(tm) v 1.2.0.4433
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
|
|
|
@ -432,7 +432,7 @@ class ShellDispatcher {
|
|||
$printOptions = '(' . implode('/', $options) . ')';
|
||||
}
|
||||
|
||||
if ($default == null) {
|
||||
if ($default === null) {
|
||||
$this->stdout($prompt . " $printOptions \n" . '> ', false);
|
||||
} else {
|
||||
$this->stdout($prompt . " $printOptions \n" . "[$default] > ", false);
|
||||
|
|
|
@ -551,13 +551,13 @@ class Shell extends Object {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates the proper singular model key for associations
|
||||
* Creates the proper underscored model key for associations
|
||||
*
|
||||
* @param string $name Controller class name
|
||||
* @param string $name Model class name
|
||||
* @return string Singular model key
|
||||
*/
|
||||
protected function _modelKey($name) {
|
||||
return Inflector::underscore(Inflector::singularize($name)) . '_id';
|
||||
return Inflector::underscore($name) . '_id';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,7 +57,7 @@ class ControllerTask extends BakeTask {
|
|||
*/
|
||||
public function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->_interactive();
|
||||
return $this->_interactive();
|
||||
}
|
||||
|
||||
if (isset($this->args[0])) {
|
||||
|
@ -175,7 +175,7 @@ class ControllerTask extends BakeTask {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
list($wannaBakeCrud, $wannaBakeCrud) = $this->_askAboutMethods();
|
||||
list($wannaBakeCrud, $wannaBakeAdminCrud) = $this->_askAboutMethods();
|
||||
}
|
||||
|
||||
if (strtolower($wannaBakeCrud) == 'y') {
|
||||
|
@ -186,6 +186,7 @@ class ControllerTask extends BakeTask {
|
|||
$actions .= $this->bakeActions($controllerName, $admin, strtolower($wannaUseSession) == 'y');
|
||||
}
|
||||
|
||||
$baked = false;
|
||||
if ($this->interactive === true) {
|
||||
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
|
||||
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
|
||||
|
@ -202,6 +203,7 @@ class ControllerTask extends BakeTask {
|
|||
$this->bakeTest($controllerName);
|
||||
}
|
||||
}
|
||||
return $baked;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,7 +284,7 @@ class ControllerTask extends BakeTask {
|
|||
$controllerPath = $this->_controllerPath($controllerName);
|
||||
$pluralName = $this->_pluralName($currentModelName);
|
||||
$singularName = Inflector::variable($currentModelName);
|
||||
$singularHumanName = $this->_singularHumanName($currentModelName);
|
||||
$singularHumanName = $this->_singularHumanName($controllerName);
|
||||
$pluralHumanName = $this->_pluralName($controllerName);
|
||||
|
||||
$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
|
||||
|
|
|
@ -54,7 +54,7 @@ class TemplateTask extends Shell {
|
|||
protected function _findThemes() {
|
||||
$paths = App::path('shells');
|
||||
$core = array_pop($paths);
|
||||
$core = str_replace('libs' . DS, '', $core);
|
||||
$core = preg_replace('#libs' . DS . '$#', '', $core);
|
||||
$paths[] = $core;
|
||||
$Folder =& new Folder($core . 'templates' . DS . 'default');
|
||||
$contents = $Folder->read();
|
||||
|
|
|
@ -94,14 +94,12 @@ class TestTask extends BakeTask {
|
|||
$this->out(sprintf(__('Path: %s'), $this->path));
|
||||
$this->hr();
|
||||
|
||||
$selection = null;
|
||||
if ($type) {
|
||||
$type = Inflector::camelize($type);
|
||||
if (!in_array($type, $this->classTypes)) {
|
||||
unset($type);
|
||||
$this->error(sprintf('Incorrect type provided. Please choose one of %s', implode(', ', $this->classTypes)));
|
||||
}
|
||||
}
|
||||
if (!$type) {
|
||||
} else {
|
||||
$type = $this->getObjectType();
|
||||
}
|
||||
$className = $this->getClassName($type);
|
||||
|
|
|
@ -195,6 +195,7 @@ class ViewTask extends BakeTask {
|
|||
$actions = $this->_methodsToBake();
|
||||
}
|
||||
$this->bakeActions($actions, $vars);
|
||||
$actions = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -290,7 +291,7 @@ class ViewTask extends BakeTask {
|
|||
$primaryKey = $modelObj->primaryKey;
|
||||
$displayField = $modelObj->displayField;
|
||||
$singularVar = Inflector::variable($modelClass);
|
||||
$singularHumanName = $this->_singularHumanName($modelClass);
|
||||
$singularHumanName = $this->_singularHumanName($this->controllerName);
|
||||
$schema = $modelObj->schema(true);
|
||||
$fields = array_keys($schema);
|
||||
$associations = $this->__associations($modelObj);
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.cake.console.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4433
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4433
|
||||
|
|
|
@ -130,6 +130,14 @@ class CakeSession extends Object {
|
|||
*/
|
||||
public $host = null;
|
||||
|
||||
/**
|
||||
* Session timeout multiplier factor
|
||||
*
|
||||
* @var ineteger
|
||||
* @access public
|
||||
*/
|
||||
var $timeout = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -455,20 +463,20 @@ class CakeSession extends Object {
|
|||
|
||||
switch ($this->security) {
|
||||
case 'high':
|
||||
$this->cookieLifeTime = 0;
|
||||
$this->cookieLifeTime = Configure::read('Session.timeout') * Security::inactiveMins();
|
||||
if ($iniSet) {
|
||||
ini_set('session.referer_check', $this->host);
|
||||
}
|
||||
break;
|
||||
case 'medium':
|
||||
$this->cookieLifeTime = 7 * 86400;
|
||||
$this->cookieLifeTime = Configure::read('Session.timeout') * Security::inactiveMins();
|
||||
if ($iniSet) {
|
||||
ini_set('session.referer_check', $this->host);
|
||||
}
|
||||
break;
|
||||
case 'low':
|
||||
default:
|
||||
$this->cookieLifeTime = 788940000;
|
||||
$this->cookieLifeTime = Configure::read('Session.timeout') * Security::inactiveMins();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -591,15 +599,14 @@ class CakeSession extends Object {
|
|||
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
|
||||
$time = $this->read('Config.time');
|
||||
$this->write('Config.time', $this->sessionTime);
|
||||
|
||||
if (Configure::read('Security.level') === 'high') {
|
||||
$check = $this->read('Config.timeout');
|
||||
$check = $check - 1;
|
||||
$check -= 1;
|
||||
$this->write('Config.timeout', $check);
|
||||
|
||||
if (time() > ($time - (Security::inactiveMins() * Configure::read('Session.timeout')) + 2) || $check < 1) {
|
||||
$this->renew();
|
||||
$this->write('Config.timeout', 10);
|
||||
$this->write('Config.timeout', Security::inactiveMins());
|
||||
}
|
||||
}
|
||||
$this->valid = true;
|
||||
|
@ -611,7 +618,7 @@ class CakeSession extends Object {
|
|||
} else {
|
||||
$this->write('Config.userAgent', $this->_userAgent);
|
||||
$this->write('Config.time', $this->sessionTime);
|
||||
$this->write('Config.timeout', 10);
|
||||
$this->write('Config.timeout', Security::inactiveMins());
|
||||
$this->valid = true;
|
||||
$this->__setError(1, 'Session is valid');
|
||||
}
|
||||
|
@ -738,21 +745,7 @@ class CakeSession extends Object {
|
|||
* @access private
|
||||
*/
|
||||
function __write($id, $data) {
|
||||
switch (Configure::read('Security.level')) {
|
||||
case 'medium':
|
||||
$factor = 100;
|
||||
break;
|
||||
case 'low':
|
||||
$factor = 300;
|
||||
break;
|
||||
case 'high':
|
||||
default:
|
||||
$factor = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
$expires = time() + Configure::read('Session.timeout') * $factor;
|
||||
|
||||
$expires = time() + Configure::read('Session.timeout') * Security::inactiveMins();
|
||||
$model =& ClassRegistry::getObject('Session');
|
||||
$return = $model->save(compact('id', 'data', 'expires'));
|
||||
return $return;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.controller
|
||||
* @link http://book.cakephp.org/view/62/Components
|
||||
* @link http://book.cakephp.org/view/993/Components
|
||||
*/
|
||||
class Component extends Object {
|
||||
|
||||
|
|
|
@ -258,8 +258,9 @@ class RequestHandlerComponent extends Object {
|
|||
*
|
||||
* @param object $controller A reference to the controller
|
||||
* @param mixed $url A string or array containing the redirect location
|
||||
* @param mixed HTTP Status for redirect
|
||||
*/
|
||||
public function beforeRedirect(&$controller, $url) {
|
||||
public function beforeRedirect(&$controller, $url, $status = null) {
|
||||
if (!$this->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
@ -269,6 +270,12 @@ class RequestHandlerComponent extends Object {
|
|||
if (is_array($url)) {
|
||||
$url = Router::url($url + array('base' => false));
|
||||
}
|
||||
if (!empty($status)) {
|
||||
$statusCode = $controller->httpCodes($status);
|
||||
$code = key($statusCode);
|
||||
$msg = $statusCode[$code];
|
||||
$controller->header("HTTP/1.1 {$code} {$msg}");
|
||||
}
|
||||
echo $this->requestAction($url, array('return'));
|
||||
$this->_stop();
|
||||
}
|
||||
|
|
|
@ -109,7 +109,6 @@ class SecurityComponent extends Object {
|
|||
|
||||
/**
|
||||
* An associative array of usernames/passwords used for HTTP-authenticated logins.
|
||||
* If using digest authentication, passwords should be MD5-hashed.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
|
|
|
@ -390,7 +390,7 @@ class Scaffold extends Object {
|
|||
|
||||
if ($this->ScaffoldModel->delete($id)) {
|
||||
$message = __(
|
||||
sprintf('The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id),
|
||||
sprintf('The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id)
|
||||
);
|
||||
if ($this->_validSession) {
|
||||
$this->controller->Session->setFlash($message);
|
||||
|
|
|
@ -186,7 +186,7 @@ class File {
|
|||
if ($bytes === false) {
|
||||
$this->close();
|
||||
}
|
||||
return $data;
|
||||
return trim($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -66,7 +66,7 @@ class Folder {
|
|||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
private $__errors = false;
|
||||
private $__errors = array();
|
||||
|
||||
/**
|
||||
* Holds array of complete directory paths.
|
||||
|
@ -678,11 +678,14 @@ class Folder {
|
|||
$to = $options;
|
||||
$options = (array)$options;
|
||||
}
|
||||
$options = array_merge(array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array()), $options);
|
||||
$options = array_merge(
|
||||
array('to' => $to, 'from' => $this->path, 'mode' => $this->mode, 'skip' => array()),
|
||||
$options
|
||||
);
|
||||
|
||||
if ($this->copy($options)) {
|
||||
if ($this->delete($options['from'])) {
|
||||
return $this->cd($options['to']);
|
||||
return (bool)$this->cd($options['to']);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -172,6 +172,7 @@ class L10n {
|
|||
/* Urdu */ 'urd' => 'ur',
|
||||
/* Venda */ 'ven' => 've',
|
||||
/* Vietnamese */ 'vie' => 'vi',
|
||||
/* Welsh */ 'cym' => 'cy',
|
||||
/* Xhosa */ 'xho' => 'xh',
|
||||
/* Yiddish */ 'yid' => 'yi',
|
||||
/* Zulu */ 'zul' => 'zu');
|
||||
|
@ -315,6 +316,7 @@ class L10n {
|
|||
'ur' => array('language' => 'Urdu', 'locale' => 'urd', 'localeFallback' => 'urd', 'charset' => 'utf-8', 'direction' => 'rtl'),
|
||||
've' => array('language' => 'Venda', 'locale' => 'ven', 'localeFallback' => 'ven', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'vi' => array('language' => 'Vietnamese', 'locale' => 'vie', 'localeFallback' => 'vie', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'xh' => array('language' => 'Xhosa', 'locale' => 'xho', 'localeFallback' => 'xho', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'yi' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
'zh' => array('language' => 'Chinese', 'locale' => 'chi', 'localeFallback' => 'chi', 'charset' => 'utf-8', 'direction' => 'ltr'),
|
||||
|
|
|
@ -726,8 +726,8 @@ class DboMysql extends DboMysqlBase {
|
|||
$j = 0;
|
||||
|
||||
while ($j < $numFields) {
|
||||
$column = mysql_fetch_field($results,$j);
|
||||
if (!empty($column->table)) {
|
||||
$column = mysql_fetch_field($results, $j);
|
||||
if (!empty($column->table) && strpos($column->name, '__') === false) {
|
||||
$this->map[$index++] = array($column->table, $column->name);
|
||||
} else {
|
||||
$this->map[$index++] = array(0, $column->name);
|
||||
|
|
|
@ -1263,7 +1263,7 @@ class Model extends Object {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($this->data[$this->alias][$this->primaryKey]) && empty($this->data[$this->alias][$this->primaryKey])) {
|
||||
if (empty($this->data[$this->alias][$this->primaryKey])) {
|
||||
unset($this->data[$this->alias][$this->primaryKey]);
|
||||
}
|
||||
$fields = $values = array();
|
||||
|
|
|
@ -361,6 +361,7 @@ class BehaviorCollection extends Object {
|
|||
* @return void
|
||||
*/
|
||||
public function detach($name) {
|
||||
list($plugin, $name) = pluginSplit($name);
|
||||
if (isset($this->{$name})) {
|
||||
$this->{$name}->cleanup(ClassRegistry::getObject($this->modelName));
|
||||
unset($this->{$name});
|
||||
|
|
|
@ -156,7 +156,7 @@ class Sanitize {
|
|||
* @static
|
||||
*/
|
||||
public static function stripScripts($str) {
|
||||
return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/i', '', $str);
|
||||
return preg_replace('/(<link[^>]+rel="[^"]*stylesheet"[^>]*>|<img[^>]*>|style="[^"]*")|<script[^>]*>.*?<\/script>|<style[^>]*>.*?<\/style>|<!--.*?-->/is', '', $str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -382,13 +382,13 @@ class Validation {
|
|||
}
|
||||
|
||||
if ($return === true && preg_match('/@(' . self::$__pattern['hostname'] . ')$/i', $check, $regs)) {
|
||||
$host = gethostbynamel($regs[1]);
|
||||
$return = is_array($host);
|
||||
$isWindows = (DIRECTORY_SEPARATOR === '\\');
|
||||
if (!$isWindows || (version_compare(PHP_VERSION, '5.3.0', '>=') && $isWindows)) {
|
||||
$return = $return && getmxrr($regs[1], $mxhosts);
|
||||
if (function_exists('getmxrr') && getmxrr($regs[1], $mxhosts)) {
|
||||
return true;
|
||||
}
|
||||
return $return;
|
||||
if (function_exists('checkdnsrr') && checkdnsrr($regs[1], 'MX')) {
|
||||
return true;
|
||||
}
|
||||
return is_array(gethostbynamel($regs[1]));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
}
|
||||
|
||||
$object =& $this->_introspectModel($model);
|
||||
$object = $this->_introspectModel($model);
|
||||
$this->setEntity($model . '.', true);
|
||||
|
||||
$modelEntity = $this->model();
|
||||
|
|
|
@ -252,9 +252,13 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
if (isset($options['update'])) {
|
||||
$wrapCallbacks = isset($options['wrapCallbacks']) ? $options['wrapCallbacks'] : true;
|
||||
if ($wrapCallbacks) {
|
||||
$success = '$("' . $options['update'] . '").html(data);';
|
||||
$success = $this->jQueryObject . '("' . $options['update'] . '").html(data);';
|
||||
} else {
|
||||
$success = 'function (data, textStatus) {$("' . $options['update'] . '").html(data);}';
|
||||
$success = sprintf(
|
||||
'function (data, textStatus) {%s("%s").html(data);}',
|
||||
$this->jQueryObject,
|
||||
$options['update']
|
||||
);
|
||||
}
|
||||
$options['dataType'] = 'html';
|
||||
$options['success'] = $success;
|
||||
|
@ -267,7 +271,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
}
|
||||
$options = $this->_prepareCallbacks('request', $options);
|
||||
$options = $this->_parseOptions($options, $callbacks);
|
||||
return '$.ajax({' . $options .'});';
|
||||
return $this->jQueryObject . '.ajax({' . $options .'});';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -301,17 +301,22 @@ class JsHelper extends AppHelper {
|
|||
list($options, $htmlOptions) = $this->_getHtmlOptions($options);
|
||||
$out = $this->Html->link($title, $url, $htmlOptions);
|
||||
$this->get('#' . $htmlOptions['id']);
|
||||
$requestString = '';
|
||||
$requestString = $event = '';
|
||||
if (isset($options['confirm'])) {
|
||||
$requestString = $this->confirmReturn($options['confirm']);
|
||||
unset($options['confirm']);
|
||||
}
|
||||
$buffer = isset($options['buffer']) ? $options['buffer'] : null;
|
||||
$safe = isset($options['safe']) ? $options['safe'] : true;
|
||||
unset($options['buffer'], $options['safe']);
|
||||
|
||||
$requestString .= $this->request($url, $options);
|
||||
|
||||
if (!empty($requestString)) {
|
||||
$event = $this->event('click', $requestString, $options);
|
||||
$event = $this->event('click', $requestString, $options + array('buffer' => $buffer));
|
||||
}
|
||||
if (isset($options['buffer']) && $options['buffer'] == false) {
|
||||
$opts = array_intersect_key(array('safe' => null), $options);
|
||||
if (isset($buffer) && !$buffer) {
|
||||
$opts = array('safe' => $safe);
|
||||
$out .= $this->Html->scriptBlock($event, $opts);
|
||||
}
|
||||
return $out;
|
||||
|
@ -351,8 +356,16 @@ class JsHelper extends AppHelper {
|
|||
* Forms submitting with this method, cannot send files. Files do not transfer over XmlHttpRequest
|
||||
* and require an iframe or flash.
|
||||
*
|
||||
* ### Options
|
||||
*
|
||||
* - `url` The url you wish the XHR request to submit to.
|
||||
* - `confirm` A string to use for a confirm() message prior to submitting the request.
|
||||
* - `method` The method you wish the form to send by, defaults to POST
|
||||
* - `buffer` Whether or not you wish the script code to be buffered, defaults to true.
|
||||
* - Also see options for JsHelper::request() and JsHelper::event()
|
||||
*
|
||||
* @param string $title The display text of the submit button.
|
||||
* @param array $options Array of options to use.
|
||||
* @param array $options Array of options to use. See the options for the above mentioned methods.
|
||||
* @return string Completed submit button.
|
||||
*/
|
||||
public function submit($caption = null, $options = array()) {
|
||||
|
@ -379,12 +392,17 @@ class JsHelper extends AppHelper {
|
|||
$options['method'] = 'post';
|
||||
}
|
||||
$options['dataExpression'] = true;
|
||||
|
||||
$buffer = isset($options['buffer']) ? $options['buffer'] : null;
|
||||
$safe = isset($options['safe']) ? $options['safe'] : true;
|
||||
unset($options['buffer'], $options['safe']);
|
||||
|
||||
$requestString .= $this->request($url, $options);
|
||||
if (!empty($requestString)) {
|
||||
$event = $this->event('click', $requestString, $options);
|
||||
$event = $this->event('click', $requestString, $options + array('buffer' => $buffer));
|
||||
}
|
||||
if (isset($options['buffer']) && $options['buffer'] == false) {
|
||||
$opts = array_intersect_key(array('safe' => null), $options);
|
||||
if (isset($buffer) && !$buffer) {
|
||||
$opts = array('safe' => $safe);
|
||||
$out .= $this->Html->scriptBlock($event, $opts);
|
||||
}
|
||||
return $out;
|
||||
|
|
|
@ -192,18 +192,10 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
|
||||
if (isset($options['sort']) && !empty($options['sort'])) {
|
||||
if (preg_match('/(?:\w+\.)?(\w+)/', $options['sort'], $result) && isset($result[1])) {
|
||||
if ($result[0] == $this->defaultModel()) {
|
||||
return $result[1];
|
||||
}
|
||||
}
|
||||
return $options['sort'];
|
||||
} elseif (isset($options['order']) && is_array($options['order'])) {
|
||||
return key($options['order']);
|
||||
} elseif (isset($options['order']) && is_string($options['order'])) {
|
||||
if (preg_match('/(?:\w+\.)?(\w+)/', $options['order'], $result) && isset($result[1])) {
|
||||
return $result[1];
|
||||
}
|
||||
return $options['order'];
|
||||
}
|
||||
return null;
|
||||
|
@ -304,13 +296,18 @@ class PaginatorHelper extends AppHelper {
|
|||
unset($options['direction']);
|
||||
|
||||
$sortKey = $this->sortKey($options['model']);
|
||||
$isSorted = ($sortKey === $key || $sortKey === $this->defaultModel() . '.' . $key);
|
||||
$defaultModel = $this->defaultModel();
|
||||
$isSorted = (
|
||||
$sortKey === $key ||
|
||||
$sortKey === $defaultModel . '.' . $key ||
|
||||
$key === $defaultModel . '.' . $sortKey
|
||||
);
|
||||
|
||||
if ($isSorted) {
|
||||
$dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc';
|
||||
$class = $dir === 'asc' ? 'desc' : 'asc';
|
||||
if (!empty($options['class'])) {
|
||||
$options['class'] .= $class;
|
||||
$options['class'] .= ' ' . $class;
|
||||
} else {
|
||||
$options['class'] = $class;
|
||||
}
|
||||
|
|
|
@ -106,8 +106,8 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
|
|||
<p>
|
||||
<?php
|
||||
echo $this->Html->link(
|
||||
sprintf('<strong>%s</strong>%s', __('new'), __('CakePHP 1.2 Docs')),
|
||||
'http://book.cakephp.org',
|
||||
sprintf('<strong>%s</strong>%s', __('new'), __('CakePHP 1.3 Docs')),
|
||||
'http://book.cakephp.org/view/875/x1-3-Collection',
|
||||
array('target' => '_blank', 'escape' => false)
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.console
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -94,7 +94,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
array(&$this->Dispatcher)
|
||||
);
|
||||
$this->Task->Project = $this->getMock('ProjectTask',
|
||||
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest'),
|
||||
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest', 'getPrefix'),
|
||||
array(&$this->Dispatcher)
|
||||
);
|
||||
$this->Task->Test = $this->getMock('TestTask', array(), array(&$this->Dispatcher));
|
||||
|
@ -248,16 +248,16 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestConfirmController() {
|
||||
public function testConfirmController() {
|
||||
$controller = 'Posts';
|
||||
$scaffold = false;
|
||||
$helpers = array('Ajax', 'Time');
|
||||
$components = array('Acl', 'Auth');
|
||||
$uses = array('Comment', 'User');
|
||||
|
||||
$this->Task->expects($this->at(2))->method('out')->with("Controller Name:\n\t$controller");
|
||||
$this->Task->expects($this->at(3))->method('out')->with("Helpers:\n\tAjax, Time");
|
||||
$this->Task->expects($this->at(4))->method('out')->with("Components:\n\tAcl, Auth");
|
||||
$this->Task->expects($this->at(4))->method('out')->with("Controller Name:\n\t$controller");
|
||||
$this->Task->expects($this->at(5))->method('out')->with("Helpers:\n\tAjax, Time");
|
||||
$this->Task->expects($this->at(6))->method('out')->with("Components:\n\tAcl, Auth");
|
||||
$this->Task->confirmController($controller, $scaffold, $helpers, $components);
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestBake() {
|
||||
public function testBake() {
|
||||
$helpers = array('Ajax', 'Time');
|
||||
$components = array('Acl', 'Auth');
|
||||
$this->Task->expects($this->any())->method('createFile')->will($this->returnValue(true));
|
||||
|
@ -295,7 +295,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestBakeWithPlugin() {
|
||||
public function testBakeWithPlugin() {
|
||||
$this->Task->plugin = 'ControllerTest';
|
||||
$helpers = array('Ajax', 'Time');
|
||||
$components = array('Acl', 'Auth');
|
||||
|
@ -303,7 +303,10 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'articles_controller.php';
|
||||
|
||||
$this->Task->expects($this->at(0))->method('createFile')->with($path, '*');
|
||||
$this->Task->expects($this->at(0))->method('createFile')->with(
|
||||
$path,
|
||||
new PHPUnit_Framework_Constraint_IsAnything()
|
||||
);
|
||||
$this->Task->expects($this->at(1))->method('createFile')->with(
|
||||
$path,
|
||||
new PHPUnit_Framework_Constraint_PCREMatch('/ArticlesController extends ControllerTestAppController/')
|
||||
|
@ -321,7 +324,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestBakeActionsUsingSessions() {
|
||||
public function testBakeActionsUsingSessions() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s');
|
||||
if ($skip) {
|
||||
|
@ -334,20 +337,20 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('Invalid %s'), 'article'));") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Invalid article'));") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function add()') !== false);
|
||||
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
|
||||
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s has been saved'), 'article'));") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article has been saved'));") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.'), 'article'));") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article could not be saved. Please, try again.'));") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(sprintf(__('%s deleted'), 'Article'));") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Article deleted'));") !== false);
|
||||
|
||||
$result = $this->Task->bakeActions('Articles', 'admin_', true);
|
||||
|
||||
|
@ -363,7 +366,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestBakeActionsWithNoSessions() {
|
||||
public function testBakeActionsWithNoSessions() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s');
|
||||
if ($skip) {
|
||||
|
@ -376,13 +379,14 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->assertTrue(strpos($result, "\$this->set('articles', \$this->paginate());") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function view($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('Invalid %s'), 'article'), array('action' => 'index'))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(__('Invalid article'), array('action' => 'index'))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->set('article', \$this->Article->read(null, \$id)") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function add()') !== false);
|
||||
$this->assertTrue(strpos($result, 'if (!empty($this->data))') !== false);
|
||||
$this->assertTrue(strpos($result, 'if ($this->Article->save($this->data))') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('The %s has been saved.'), 'article'), array('action' => 'index'))") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, "\$this->flash(__('The article has been saved.'), array('action' => 'index'))") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
|
||||
|
@ -390,7 +394,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
|
||||
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(sprintf(__('%s deleted'), 'Article'), array('action' => 'index'))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(__('Article deleted'), array('action' => 'index'))") !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -398,7 +402,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestBakeTest() {
|
||||
public function testBakeTest() {
|
||||
$this->Task->plugin = 'ControllerTest';
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->interactive = false;
|
||||
|
@ -416,23 +420,60 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestInteractive() {
|
||||
public function testInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path';
|
||||
$this->Task->expects($this->any())->method('in')->will($this->returnValue('1'));
|
||||
$this->Task->expects($this->at(1))->method('in')->will($this->returnValue('y')); // build interactive
|
||||
$this->Task->expects($this->at(2))->method('in')->will($this->returnValue('n')); // build no scaffolds
|
||||
$this->Task->expects($this->at(3))->method('in')->will($this->returnValue('y')); // build normal methods
|
||||
$this->Task->expects($this->at(4))->method('in')->will($this->returnValue('n')); // build admin methods
|
||||
$this->Task->expects($this->at(5))->method('in')->will($this->returnValue('n')); // helpers?
|
||||
$this->Task->expects($this->at(6))->method('in')->will($this->returnValue('n')); // components?
|
||||
$this->Task->expects($this->at(7))->method('in')->will($this->returnValue('y')); // use sessions
|
||||
$this->Task->expects($this->at(8))->method('in')->will($this->returnValue('y')); // looks good
|
||||
$this->Task->path = '/my/path/';
|
||||
|
||||
$this->Task->execute();
|
||||
$this->Task->expects($this->at(8))->method('in')->will($this->returnValue('1'));
|
||||
$this->Task->expects($this->at(12))->method('in')->will($this->returnValue('y')); // build interactive
|
||||
$this->Task->expects($this->at(13))->method('in')->will($this->returnValue('n')); // build no scaffolds
|
||||
$this->Task->expects($this->at(14))->method('in')->will($this->returnValue('y')); // build normal methods
|
||||
$this->Task->expects($this->at(15))->method('in')->will($this->returnValue('n')); // build admin methods
|
||||
$this->Task->expects($this->at(16))->method('in')->will($this->returnValue('n')); // helpers?
|
||||
$this->Task->expects($this->at(17))->method('in')->will($this->returnValue('n')); // components?
|
||||
$this->Task->expects($this->at(18))->method('in')->will($this->returnValue('y')); // use sessions
|
||||
$this->Task->expects($this->at(25))->method('in')->will($this->returnValue('y')); // looks good
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expects($this->at(0))->method('createFile')->with($filename, new PatternExpectation('/class ArticlesController/'));
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename,
|
||||
new PHPUnit_Framework_Constraint_PCREMatch('/class ArticlesController/')
|
||||
);
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* test Interactive mode.
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testInteractiveAdminMethodsNotInteractive() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->interactive = true;
|
||||
$this->Task->path = '/my/path/';
|
||||
|
||||
$this->Task->expects($this->at(8))->method('in')->will($this->returnValue('1'));
|
||||
$this->Task->expects($this->at(12))->method('in')->will($this->returnValue('y')); // build interactive
|
||||
$this->Task->expects($this->at(13))->method('in')->will($this->returnValue('n')); // build no scaffolds
|
||||
$this->Task->expects($this->at(14))->method('in')->will($this->returnValue('y')); // build normal methods
|
||||
$this->Task->expects($this->at(15))->method('in')->will($this->returnValue('y')); // build admin methods
|
||||
$this->Task->expects($this->at(16))->method('in')->will($this->returnValue('n')); // helpers?
|
||||
$this->Task->expects($this->at(17))->method('in')->will($this->returnValue('n')); // components?
|
||||
$this->Task->expects($this->at(18))->method('in')->will($this->returnValue('y')); // use sessions
|
||||
$this->Task->expects($this->at(25))->method('in')->will($this->returnValue('y')); // looks good
|
||||
$this->Task->Project->expects($this->any())
|
||||
->method('getPrefix')
|
||||
->will($this->returnValue('admin_'));
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename,
|
||||
new PHPUnit_Framework_Constraint_PCREMatch('/class ArticlesController/')
|
||||
)->will($this->returnValue(true));
|
||||
|
||||
$result = $this->Task->execute();
|
||||
$this->assertPattern('/admin_index/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -440,7 +481,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestExecuteIntoAll() {
|
||||
public function testExecuteIntoAll() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s');
|
||||
if ($skip) {
|
||||
|
@ -450,12 +491,14 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->path = '/my/path/';
|
||||
$this->Task->args = array('all');
|
||||
|
||||
$this->Task->expects($this->any())->method('createFile')->will($this->returnValue(true));
|
||||
$this->Task->expects($this->any())->method('_checkUnitTest')->will($this->returnValue(true));
|
||||
$this->Task->Test->expectCallCount('bake', 1);
|
||||
$this->Task->Test->expects($this->once())->method('bake');
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expects($this->at(0))->method('createFile')->with($filename, new PatternExpectation('/class ArticlesController/'));
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename,
|
||||
new PHPUnit_Framework_Constraint_PCREMatch('/class ArticlesController/')
|
||||
)->will($this->returnValue(true));
|
||||
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
@ -465,7 +508,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestExecuteWithController() {
|
||||
public function testExecuteWithController() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
if ($skip) {
|
||||
|
@ -476,19 +519,31 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->args = array('Articles');
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
$filename, new PatternExpectation('/\$scaffold/')
|
||||
));
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename,
|
||||
new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/')
|
||||
);
|
||||
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* test that both plural and singular forms work for controller baking.
|
||||
* data provider for testExecuteWithControllerNameVariations
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestExecuteWithControllerNameVariations() {
|
||||
static function nameVariations() {
|
||||
return array(
|
||||
array('Articles'), array('Article'), array('article'), array('articles')
|
||||
);
|
||||
}
|
||||
/**
|
||||
* test that both plural and singular forms work for controller baking.
|
||||
*
|
||||
* @dataProvider nameVariations
|
||||
* @return void
|
||||
*/
|
||||
public function testExecuteWithControllerNameVariations($name) {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
if ($skip) {
|
||||
|
@ -496,41 +551,12 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
}
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->path = '/my/path/';
|
||||
$this->Task->args = array('Articles');
|
||||
$this->Task->args = array($name);
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
$filename, new PatternExpectation('/\$scaffold/')
|
||||
));
|
||||
|
||||
$this->Task->execute();
|
||||
|
||||
$this->Task->args = array('Article');
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(1, 'createFile', array(
|
||||
$filename, new PatternExpectation('/class ArticlesController/')
|
||||
));
|
||||
$this->Task->execute();
|
||||
|
||||
$this->Task->args = array('article');
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
$filename, new PatternExpectation('/class ArticlesController/')
|
||||
));
|
||||
|
||||
$this->Task->args = array('articles');
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(3, 'createFile', array(
|
||||
$filename, new PatternExpectation('/class ArticlesController/')
|
||||
));
|
||||
$this->Task->execute();
|
||||
|
||||
$this->Task->args = array('Articles');
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(4, 'createFile', array(
|
||||
$filename, new PatternExpectation('/class ArticlesController/')
|
||||
));
|
||||
$this->Task->execute();
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename, new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/')
|
||||
);
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
|
@ -539,7 +565,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestExecuteWithPublicParam() {
|
||||
public function testExecuteWithPublicParam() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
if ($skip) {
|
||||
|
@ -550,10 +576,10 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->args = array('Articles', 'public');
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
$filename, new NoPatternExpectation('/var \$scaffold/')
|
||||
));
|
||||
|
||||
$expected = new PHPUnit_Framework_Constraint_Not(new PHPUnit_Framework_Constraint_PCREMatch('/\$scaffold/'));
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename, $expected
|
||||
);
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
|
@ -562,7 +588,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestExecuteWithControllerAndBoth() {
|
||||
public function testExecuteWithControllerAndBoth() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
if ($skip) {
|
||||
|
@ -574,10 +600,9 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->args = array('Articles', 'public', 'admin');
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
$filename, new PatternExpectation('/admin_index/')
|
||||
));
|
||||
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename, new PHPUnit_Framework_Constraint_PCREMatch('/admin_index/')
|
||||
);
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
|
@ -586,7 +611,7 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function xxtestExecuteWithControllerAndAdmin() {
|
||||
public function testExecuteWithControllerAndAdmin() {
|
||||
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
|
||||
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
|
||||
if ($skip) {
|
||||
|
@ -598,10 +623,9 @@ class ControllerTaskTest extends CakeTestCase {
|
|||
$this->Task->args = array('Articles', 'admin');
|
||||
|
||||
$filename = '/my/path/articles_controller.php';
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
$filename, new PatternExpectation('/admin_index/')
|
||||
));
|
||||
|
||||
$this->Task->expects($this->once())->method('createFile')->with(
|
||||
$filename, new PHPUnit_Framework_Constraint_PCREMatch('/admin_index/')
|
||||
);
|
||||
$this->Task->execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,10 +286,10 @@ class ViewTaskTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Task->getContent('view', $vars);
|
||||
|
||||
$this->assertPattern('/Delete .+Test View Model/', $result);
|
||||
$this->assertPattern('/Edit .+Test View Model/', $result);
|
||||
$this->assertPattern('/List .+Test View Models/', $result);
|
||||
$this->assertPattern('/New .+Test View Model/', $result);
|
||||
$this->assertPattern('/Delete Test View Model/', $result);
|
||||
$this->assertPattern('/Edit Test View Model/', $result);
|
||||
$this->assertPattern('/List Test View Models/', $result);
|
||||
$this->assertPattern('/New Test View Model/', $result);
|
||||
|
||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
||||
|
@ -318,10 +318,10 @@ class ViewTaskTest extends CakeTestCase {
|
|||
);
|
||||
$result = $this->Task->getContent('admin_view', $vars);
|
||||
|
||||
$this->assertPattern('/Delete .+Test View Model/', $result);
|
||||
$this->assertPattern('/Edit .+Test View Model/', $result);
|
||||
$this->assertPattern('/List .+Test View Models/', $result);
|
||||
$this->assertPattern('/New .+Test View Model/', $result);
|
||||
$this->assertPattern('/Delete Test View Model/', $result);
|
||||
$this->assertPattern('/Edit Test View Model/', $result);
|
||||
$this->assertPattern('/List Test View Models/', $result);
|
||||
$this->assertPattern('/New Test View Model/', $result);
|
||||
|
||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'id\'\]/', $result);
|
||||
$this->assertPattern('/testViewModel\[\'TestViewModel\'\]\[\'name\'\]/', $result);
|
||||
|
@ -330,7 +330,7 @@ class ViewTaskTest extends CakeTestCase {
|
|||
$result = $this->Task->getContent('admin_add', $vars);
|
||||
$this->assertPattern("/input\('name'\)/", $result);
|
||||
$this->assertPattern("/input\('body'\)/", $result);
|
||||
$this->assertPattern('/List .+Test View Models/', $result);
|
||||
$this->assertPattern('/List Test View Models/', $result);
|
||||
|
||||
Configure::write('Routing', $_back);
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ class ViewTaskTest extends CakeTestCase {
|
|||
));
|
||||
$this->Task->expectAt(1, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
||||
new PatternExpectation('/Edit .+View Task Comment/')
|
||||
new PatternExpectation('/Edit View Task Comment/')
|
||||
));
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'index.ctp',
|
||||
|
@ -552,11 +552,11 @@ class ViewTaskTest extends CakeTestCase {
|
|||
));
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'add.ctp',
|
||||
new PatternExpectation('/Add .+View Task Comment/')
|
||||
new PatternExpectation('/Add View Task Comment/')
|
||||
));
|
||||
$this->Task->expectAt(3, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
||||
new PatternExpectation('/Edit .+View Task Comment/')
|
||||
new PatternExpectation('/Edit View Task Comment/')
|
||||
));
|
||||
|
||||
$this->Task->execute();
|
||||
|
@ -607,11 +607,11 @@ class ViewTaskTest extends CakeTestCase {
|
|||
));
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'admin_add.ctp',
|
||||
new PatternExpectation('/Add .+View Task Comment/')
|
||||
new PatternExpectation('/Add View Task Comment/')
|
||||
));
|
||||
$this->Task->expectAt(3, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
|
||||
new PatternExpectation('/Edit .+View Task Comment/')
|
||||
new PatternExpectation('/Edit View Task Comment/')
|
||||
));
|
||||
|
||||
$this->Task->execute();
|
||||
|
@ -634,4 +634,5 @@ class ViewTaskTest extends CakeTestCase {
|
|||
$result = $this->Task->getTemplate('admin_add');
|
||||
$this->assertEqual($result, 'form');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
4
cake/tests/cases/libs/cache/apc.test.php
vendored
4
cake/tests/cases/libs/cache/apc.test.php
vendored
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
|
|
4
cake/tests/cases/libs/cache/file.test.php
vendored
4
cake/tests/cases/libs/cache/file.test.php
vendored
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
|
@ -205,7 +205,7 @@ class MemcacheEngineTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expecting);
|
||||
|
||||
$result = Cache::read('long_expiry_test');
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals($expecting, $result);
|
||||
|
||||
Cache::config('memcache', array('duration' => 3600));
|
||||
}
|
||||
|
|
4
cake/tests/cases/libs/cache/xcache.test.php
vendored
4
cake/tests/cases/libs/cache/xcache.test.php
vendored
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.5434
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
* @since CakePHP(tm) v 1.2.0.5436
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5435
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5347
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5435
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5347
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5435
|
||||
|
@ -21,6 +21,7 @@ App::import('Controller', 'Controller', false);
|
|||
App::import('Component', array('RequestHandler'));
|
||||
|
||||
Mock::generatePartial('RequestHandlerComponent', 'NoStopRequestHandler', array('_stop'));
|
||||
Mock::generatePartial('Controller', 'RequestHandlerMockController', array('header'));
|
||||
|
||||
/**
|
||||
* RequestHandlerTestController class
|
||||
|
@ -601,9 +602,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
*/
|
||||
function testBeforeRedirectCallbackWithArrayUrl() {
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
|
||||
App::build(array(
|
||||
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
|
||||
), true);
|
||||
|
||||
Router::setRequestInfo(array(
|
||||
array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'named' => array(), 'form' => array(), 'url' => array('url' => 'accounts/'), 'bare' => 0),
|
||||
array('base' => '/officespace', 'here' => '/officespace/accounts/', 'webroot' => '/officespace/')
|
||||
|
@ -618,7 +617,22 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
);
|
||||
$result = ob_get_clean();
|
||||
$this->assertEqual($result, 'one: first two: second');
|
||||
App::build();
|
||||
}
|
||||
|
||||
/**
|
||||
* assure that beforeRedirect with a status code will correctly set the status header
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testBeforeRedirectCallingHeader() {
|
||||
$controller =& new RequestHandlerMockController();
|
||||
$RequestHandler =& new NoStopRequestHandler();
|
||||
|
||||
$controller->expectOnce('header', array('HTTP/1.1 403 Forbidden'));
|
||||
|
||||
ob_start();
|
||||
$RequestHandler->beforeRedirect($controller, 'request_handler_test/param_method/first/second', 403);
|
||||
$result = ob_get_clean();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5435
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5436
|
||||
|
@ -339,4 +339,41 @@ class SessionComponentTest extends CakeTestCase {
|
|||
$Session->destroy('Test');
|
||||
$this->assertNull($Session->read('Test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* testSessionTimeout method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testSessionTimeout() {
|
||||
|
||||
session_destroy();
|
||||
Configure::write('Security.level', 'low');
|
||||
$Session =& new SessionComponent();
|
||||
$Session->write('Test', 'some value');
|
||||
$this->assertEqual($_SESSION['Config']['timeout'], Security::inactiveMins());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||
$this->assertEqual($Session->time, mktime());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||
|
||||
session_destroy();
|
||||
Configure::write('Security.level', 'medium');
|
||||
$Session =& new SessionComponent();
|
||||
$Session->write('Test', 'some value');
|
||||
$this->assertEqual($_SESSION['Config']['timeout'], Security::inactiveMins());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||
$this->assertEqual($Session->time, mktime());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||
|
||||
session_destroy();
|
||||
Configure::write('Security.level', 'high');
|
||||
$Session =& new SessionComponent();
|
||||
$Session->write('Test', 'some value');
|
||||
$this->assertEqual($_SESSION['Config']['timeout'], Security::inactiveMins());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->sessionTime);
|
||||
$this->assertEqual($Session->time, mktime());
|
||||
$this->assertEqual($_SESSION['Config']['time'], $Session->time + (Security::inactiveMins() * Configure::read('Session.timeout')));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
* @since CakePHP(tm) v 1.2.3
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
* @since CakePHP(tm) v 1.2.0.5436
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller
|
||||
* @since CakePHP(tm) v 1.2.0.5436
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
@ -35,6 +35,28 @@ class FileTest extends CakeTestCase {
|
|||
*/
|
||||
public $File = null;
|
||||
|
||||
/**
|
||||
* setup the test case
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
$file = __FILE__;
|
||||
$this->File = new File($file);
|
||||
}
|
||||
|
||||
/**
|
||||
* tear down for test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function teardown() {
|
||||
parent::teardown();
|
||||
$this->File->close();
|
||||
unset($this->File);
|
||||
}
|
||||
|
||||
/**
|
||||
* testBasic method
|
||||
*
|
||||
|
@ -43,7 +65,6 @@ class FileTest extends CakeTestCase {
|
|||
*/
|
||||
function testBasic() {
|
||||
$file = __FILE__;
|
||||
$this->File =& new File($file);
|
||||
|
||||
$result = $this->File->pwd();
|
||||
$expecting = $file;
|
||||
|
@ -112,7 +133,7 @@ class FileTest extends CakeTestCase {
|
|||
$this->File->lock = true;
|
||||
$result = $this->File->read();
|
||||
$expecting = file_get_contents(__FILE__);
|
||||
$this->assertEqual($result, $expecting);
|
||||
$this->assertEqual($result, trim($expecting));
|
||||
$this->File->lock = null;
|
||||
|
||||
$data = $expecting;
|
||||
|
@ -210,7 +231,7 @@ class FileTest extends CakeTestCase {
|
|||
*/
|
||||
function testCreate() {
|
||||
$tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp';
|
||||
$File =& new File($tmpFile, true, 0777);
|
||||
$File = new File($tmpFile, true, 0777);
|
||||
$this->assertTrue($File->exists());
|
||||
}
|
||||
|
||||
|
@ -221,7 +242,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testOpeningNonExistantFileCreatesIt() {
|
||||
$someFile =& new File(TMP . 'some_file.txt', false);
|
||||
$someFile = new File(TMP . 'some_file.txt', false);
|
||||
$this->assertTrue($someFile->open());
|
||||
$this->assertEqual($someFile->read(), '');
|
||||
$someFile->close();
|
||||
|
@ -256,7 +277,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testReadable() {
|
||||
$someFile =& new File(TMP . 'some_file.txt', false);
|
||||
$someFile = new File(TMP . 'some_file.txt', false);
|
||||
$this->assertTrue($someFile->open());
|
||||
$this->assertTrue($someFile->readable());
|
||||
$someFile->close();
|
||||
|
@ -270,7 +291,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testWritable() {
|
||||
$someFile =& new File(TMP . 'some_file.txt', false);
|
||||
$someFile = new File(TMP . 'some_file.txt', false);
|
||||
$this->assertTrue($someFile->open());
|
||||
$this->assertTrue($someFile->writable());
|
||||
$someFile->close();
|
||||
|
@ -284,7 +305,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testExecutable() {
|
||||
$someFile =& new File(TMP . 'some_file.txt', false);
|
||||
$someFile = new File(TMP . 'some_file.txt', false);
|
||||
$this->assertTrue($someFile->open());
|
||||
$this->assertFalse($someFile->executable());
|
||||
$someFile->close();
|
||||
|
@ -298,7 +319,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testLastAccess() {
|
||||
$someFile =& new File(TMP . 'some_file.txt', false);
|
||||
$someFile = new File(TMP . 'some_file.txt', false);
|
||||
$this->assertFalse($someFile->lastAccess());
|
||||
$this->assertTrue($someFile->open());
|
||||
$this->assertEqual($someFile->lastAccess(), time());
|
||||
|
@ -313,7 +334,7 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testLastChange() {
|
||||
$someFile =& new File(TMP . 'some_file.txt', false);
|
||||
$someFile = new File(TMP . 'some_file.txt', false);
|
||||
$this->assertFalse($someFile->lastChange());
|
||||
$this->assertTrue($someFile->open('r+'));
|
||||
$this->assertEqual($someFile->lastChange(), time());
|
||||
|
@ -337,7 +358,7 @@ class FileTest extends CakeTestCase {
|
|||
unlink($tmpFile);
|
||||
}
|
||||
|
||||
$TmpFile =& new File($tmpFile);
|
||||
$TmpFile = new File($tmpFile);
|
||||
$this->assertFalse(file_exists($tmpFile));
|
||||
$this->assertFalse(is_resource($TmpFile->handle));
|
||||
|
||||
|
@ -368,7 +389,7 @@ class FileTest extends CakeTestCase {
|
|||
unlink($tmpFile);
|
||||
}
|
||||
|
||||
$TmpFile =& new File($tmpFile);
|
||||
$TmpFile = new File($tmpFile);
|
||||
$this->assertFalse(file_exists($tmpFile));
|
||||
|
||||
$fragments = array('CakePHP\'s', ' test suite', ' was here ...', '');
|
||||
|
@ -397,13 +418,13 @@ class FileTest extends CakeTestCase {
|
|||
if (!file_exists($tmpFile)) {
|
||||
touch($tmpFile);
|
||||
}
|
||||
$TmpFile =& new File($tmpFile);
|
||||
$TmpFile = new File($tmpFile);
|
||||
$this->assertTrue(file_exists($tmpFile));
|
||||
$result = $TmpFile->delete();
|
||||
$this->assertTrue($result);
|
||||
$this->assertFalse(file_exists($tmpFile));
|
||||
|
||||
$TmpFile =& new File('/this/does/not/exist');
|
||||
$TmpFile = new File('/this/does/not/exist');
|
||||
$result = $TmpFile->delete();
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
@ -417,7 +438,7 @@ class FileTest extends CakeTestCase {
|
|||
function testCopy() {
|
||||
$dest = TMP . 'tests' . DS . 'cakephp.file.test.tmp';
|
||||
$file = __FILE__;
|
||||
$this->File =& new File($file);
|
||||
$this->File = new File($file);
|
||||
$result = $this->File->copy($dest);
|
||||
$this->assertTrue($result);
|
||||
|
||||
|
@ -430,7 +451,7 @@ class FileTest extends CakeTestCase {
|
|||
$this->File->close();
|
||||
unlink($dest);
|
||||
|
||||
$TmpFile =& new File('/this/does/not/exist');
|
||||
$TmpFile = new File('/this/does/not/exist');
|
||||
$result = $TmpFile->copy($dest);
|
||||
$this->assertFalse($result);
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
@ -35,7 +35,7 @@ class FolderTest extends CakeTestCase {
|
|||
*/
|
||||
function testBasic() {
|
||||
$path = dirname(__FILE__);
|
||||
$Folder =& new Folder($path);
|
||||
$Folder = new Folder($path);
|
||||
|
||||
$result = $Folder->pwd();
|
||||
$this->assertEqual($result, $path);
|
||||
|
@ -62,7 +62,7 @@ class FolderTest extends CakeTestCase {
|
|||
$path = dirname(dirname(__FILE__));
|
||||
$inside = dirname($path) . DS;
|
||||
|
||||
$Folder =& new Folder($path);
|
||||
$Folder = new Folder($path);
|
||||
|
||||
$result = $Folder->pwd();
|
||||
$this->assertEqual($result, $path);
|
||||
|
@ -86,7 +86,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testCreation() {
|
||||
$folder =& new Folder(TMP . 'tests');
|
||||
$folder = new Folder(TMP . 'tests');
|
||||
$result = $folder->create(TMP . 'tests' . DS . 'first' . DS . 'second' . DS . 'third');
|
||||
$this->assertTrue($result);
|
||||
|
||||
|
@ -94,7 +94,7 @@ class FolderTest extends CakeTestCase {
|
|||
rmdir(TMP . 'tests' . DS . 'first' . DS . 'second');
|
||||
rmdir(TMP . 'tests' . DS . 'first');
|
||||
|
||||
$folder =& new Folder(TMP . 'tests');
|
||||
$folder = new Folder(TMP . 'tests');
|
||||
$result = $folder->create(TMP . 'tests' . DS . 'first');
|
||||
$this->assertTrue($result);
|
||||
rmdir(TMP . 'tests' . DS . 'first');
|
||||
|
@ -106,13 +106,13 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testCreateWithTrailingDs() {
|
||||
$folder =& new Folder(TMP);
|
||||
$folder = new Folder(TMP);
|
||||
$path = TMP . 'tests' . DS . 'trailing' . DS . 'dir' . DS;
|
||||
$folder->create($path);
|
||||
|
||||
$this->assertTrue(is_dir($path), 'Folder was not made');
|
||||
|
||||
$folder =& new Folder(TMP . 'tests' . DS . 'trailing');
|
||||
$folder = new Folder(TMP . 'tests' . DS . 'trailing');
|
||||
$this->assertTrue($folder->delete());
|
||||
}
|
||||
|
||||
|
@ -129,11 +129,13 @@ class FolderTest extends CakeTestCase {
|
|||
mkdir($path);
|
||||
chmod($path, '0444');
|
||||
|
||||
$this->expectError();
|
||||
|
||||
$folder =& new Folder($path);
|
||||
$result = $folder->create($path . DS . 'two' . DS . 'three');
|
||||
$this->assertFalse($result);
|
||||
try {
|
||||
$folder = new Folder($path);
|
||||
$result = $folder->create($path . DS . 'two' . DS . 'three');
|
||||
$this->assertFalse($result);
|
||||
} catch (PHPUnit_Framework_Error $e) {
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
chmod($path, '0777');
|
||||
rmdir($path);
|
||||
|
@ -146,7 +148,7 @@ class FolderTest extends CakeTestCase {
|
|||
*/
|
||||
function testOperations() {
|
||||
$path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'templates' . DS . 'skel';
|
||||
$Folder =& new Folder($path);
|
||||
$Folder = new Folder($path);
|
||||
|
||||
$result = is_dir($Folder->pwd());
|
||||
$this->assertTrue($result);
|
||||
|
@ -168,7 +170,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
|
||||
$result = $Folder->cd($copy);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue((bool)$result);
|
||||
|
||||
$mv = TMP . 'test_folder_mv';
|
||||
$result = $Folder->move($mv);
|
||||
|
@ -200,12 +202,12 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertTrue($result);
|
||||
|
||||
$result = $Folder->cd($new);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue((bool)$result);
|
||||
|
||||
$result = $Folder->delete();
|
||||
$this->assertTrue($result);
|
||||
|
||||
$Folder =& new Folder('non-existent');
|
||||
$Folder = new Folder('non-existent');
|
||||
$result = $Folder->pwd();
|
||||
$this->assertNull($result);
|
||||
}
|
||||
|
@ -219,7 +221,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Folder permissions tests not supported on Windows');
|
||||
|
||||
$path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'templates' . DS . 'skel';
|
||||
$Folder =& new Folder($path);
|
||||
$Folder = new Folder($path);
|
||||
|
||||
$subdir = 'test_folder_new';
|
||||
$new = TMP . $subdir;
|
||||
|
@ -229,7 +231,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertTrue($Folder->create($new . DS . 'test2'));
|
||||
|
||||
$filePath = $new . DS . 'test1.php';
|
||||
$File =& new File($filePath);
|
||||
$File = new File($filePath);
|
||||
$this->assertTrue($File->create());
|
||||
$copy = TMP . 'test_folder_copy';
|
||||
|
||||
|
@ -257,7 +259,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testZeroAsDirectory() {
|
||||
$Folder =& new Folder(TMP);
|
||||
$Folder = new Folder(TMP);
|
||||
$new = TMP . '0';
|
||||
$this->assertTrue($Folder->create($new));
|
||||
|
||||
|
@ -292,7 +294,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testFolderRead() {
|
||||
$Folder =& new Folder(TMP);
|
||||
$Folder = new Folder(TMP);
|
||||
|
||||
$expected = array('cache', 'logs', 'sessions', 'tests');
|
||||
$result = $Folder->read(true, true);
|
||||
|
@ -311,7 +313,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testFolderTree() {
|
||||
$Folder =& new Folder();
|
||||
$Folder = new Folder();
|
||||
$expected = array(
|
||||
array(
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'config',
|
||||
|
@ -458,7 +460,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testInCakePath() {
|
||||
$Folder =& new Folder();
|
||||
$Folder = new Folder();
|
||||
$Folder->cd(ROOT);
|
||||
$path = 'C:\\path\\to\\file';
|
||||
$result = $Folder->inCakePath($path);
|
||||
|
@ -483,7 +485,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testFind() {
|
||||
$Folder =& new Folder();
|
||||
$Folder = new Folder();
|
||||
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config');
|
||||
$result = $Folder->find();
|
||||
$expected = array('config.php', 'paths.php');
|
||||
|
@ -536,7 +538,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testFindRecursive() {
|
||||
$Folder =& new Folder();
|
||||
$Folder = new Folder();
|
||||
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH);
|
||||
$result = $Folder->findRecursive('(config|paths)\.php');
|
||||
$expected = array(
|
||||
|
@ -556,7 +558,7 @@ class FolderTest extends CakeTestCase {
|
|||
$Folder->cd(TMP);
|
||||
$Folder->create($Folder->pwd() . DS . 'testme');
|
||||
$Folder->cd('testme');
|
||||
$File =& new File($Folder->pwd() . DS . 'paths.php');
|
||||
$File = new File($Folder->pwd() . DS . 'paths.php');
|
||||
$File->create();
|
||||
$Folder->cd(TMP . 'sessions');
|
||||
$result = $Folder->findRecursive('paths\.php');
|
||||
|
@ -564,7 +566,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertIdentical($result, $expected);
|
||||
|
||||
$Folder->cd(TMP . 'testme');
|
||||
$File =& new File($Folder->pwd() . DS . 'my.php');
|
||||
$File = new File($Folder->pwd() . DS . 'my.php');
|
||||
$File->create();
|
||||
$Folder->cd($Folder->pwd() . '/../..');
|
||||
|
||||
|
@ -596,7 +598,7 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testConstructWithNonExistantPath() {
|
||||
$Folder =& new Folder(TMP . 'config_non_existant', true);
|
||||
$Folder = new Folder(TMP . 'config_non_existant', true);
|
||||
$this->assertTrue(is_dir(TMP . 'config_non_existant'));
|
||||
$Folder->cd(TMP);
|
||||
$Folder->delete($Folder->pwd() . 'config_non_existant');
|
||||
|
@ -609,10 +611,10 @@ class FolderTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function testDirSize() {
|
||||
$Folder =& new Folder(TMP . 'config_non_existant', true);
|
||||
$Folder = new Folder(TMP . 'config_non_existant', true);
|
||||
$this->assertEqual($Folder->dirSize(), 0);
|
||||
|
||||
$File =& new File($Folder->pwd() . DS . 'my.php', true, 0777);
|
||||
$File = new File($Folder->pwd() . DS . 'my.php', true, 0777);
|
||||
$File->create();
|
||||
$File->write('something here');
|
||||
$File->close();
|
||||
|
@ -630,7 +632,7 @@ class FolderTest extends CakeTestCase {
|
|||
*/
|
||||
function testDelete() {
|
||||
$path = TMP . 'folder_delete_test';
|
||||
$Folder =& new Folder($path, true);
|
||||
$Folder = new Folder($path, true);
|
||||
touch(TMP . 'folder_delete_test' . DS . 'file1');
|
||||
touch(TMP . 'folder_delete_test' . DS . 'file2');
|
||||
|
||||
|
@ -639,7 +641,7 @@ class FolderTest extends CakeTestCase {
|
|||
|
||||
$messages = $Folder->messages();
|
||||
$errors = $Folder->errors();
|
||||
$this->assertEqual($errors, array());
|
||||
$this->assertEquals($errors, array());
|
||||
|
||||
$expected = array(
|
||||
$path . ' created',
|
||||
|
@ -677,35 +679,35 @@ class FolderTest extends CakeTestCase {
|
|||
touch($file1);
|
||||
touch($file2);
|
||||
|
||||
$Folder =& new Folder($folder1);
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->copy($folder3);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
|
||||
|
||||
$Folder =& new Folder($folder3);
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder->delete();
|
||||
|
||||
$Folder =& new Folder($folder1);
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->copy($folder3);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'folder2' . DS . 'file2.php'));
|
||||
|
||||
$Folder =& new Folder($folder3);
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder->delete();
|
||||
|
||||
new Folder($folder3, true);
|
||||
new Folder($folder3 . DS . 'folder2', true);
|
||||
file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
|
||||
|
||||
$Folder =& new Folder($folder1);
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->copy($folder3);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
$this->assertEqual(file_get_contents($folder3 . DS . 'folder2' . DS . 'file2.php'), 'untouched');
|
||||
|
||||
$Folder =& new Folder($path);
|
||||
$Folder = new Folder($path);
|
||||
$Folder->delete();
|
||||
}
|
||||
|
||||
|
@ -736,7 +738,7 @@ class FolderTest extends CakeTestCase {
|
|||
touch($file1);
|
||||
touch($file2);
|
||||
|
||||
$Folder =& new Folder($folder1);
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->move($folder3);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
|
@ -746,7 +748,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertFalse(file_exists($folder2));
|
||||
$this->assertFalse(file_exists($file2));
|
||||
|
||||
$Folder =& new Folder($folder3);
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder->delete();
|
||||
|
||||
new Folder($folder1, true);
|
||||
|
@ -754,7 +756,7 @@ class FolderTest extends CakeTestCase {
|
|||
touch($file1);
|
||||
touch($file2);
|
||||
|
||||
$Folder =& new Folder($folder1);
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->move($folder3);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
|
@ -764,7 +766,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertFalse(file_exists($folder2));
|
||||
$this->assertFalse(file_exists($file2));
|
||||
|
||||
$Folder =& new Folder($folder3);
|
||||
$Folder = new Folder($folder3);
|
||||
$Folder->delete();
|
||||
|
||||
new Folder($folder1, true);
|
||||
|
@ -775,7 +777,7 @@ class FolderTest extends CakeTestCase {
|
|||
touch($file2);
|
||||
file_put_contents($folder3 . DS . 'folder2' . DS . 'file2.php', 'untouched');
|
||||
|
||||
$Folder =& new Folder($folder1);
|
||||
$Folder = new Folder($folder1);
|
||||
$result = $Folder->move($folder3);
|
||||
$this->assertTrue($result);
|
||||
$this->assertTrue(file_exists($folder3 . DS . 'file1.php'));
|
||||
|
@ -784,7 +786,7 @@ class FolderTest extends CakeTestCase {
|
|||
$this->assertFalse(file_exists($folder2));
|
||||
$this->assertFalse(file_exists($file2));
|
||||
|
||||
$Folder =& new Folder($path);
|
||||
$Folder = new Folder($path);
|
||||
$Folder->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/160/Testing
|
||||
* @link http://book.cakephp.org/view/1196/Testing
|
||||
* @package cake.tests
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
@ -427,6 +427,10 @@ class L10nTest extends CakeTestCase {
|
|||
$expected = array('xho' => 'xh', 'xh' => 'xho');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $l10n->map(array('cy', 'cym'));
|
||||
$expected = array('cym' => 'cy', 'cy' => 'cym');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $l10n->map(array('yid', 'yi'));
|
||||
$expected = array('yid' => 'yi', 'yi' => 'yid');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
@ -878,6 +882,13 @@ class L10nTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $l10n->catalog(array('cy'));
|
||||
$expected = array(
|
||||
'cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8',
|
||||
'direction' => 'ltr')
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $l10n->catalog(array('xh'));
|
||||
$expected = array(
|
||||
'xh' => array('language' => 'Xhosa', 'locale' => 'xho', 'localeFallback' => 'xho', 'charset' => 'utf-8', 'direction' => 'ltr')
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.log
|
||||
* @since CakePHP(tm) v 1.3
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model.behaviors
|
||||
* @since CakePHP(tm) v 1.2.0.5669
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model.behaviors
|
||||
* @since CakePHP(tm) v 1.2.0.5669
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model.behaviors
|
||||
* @since CakePHP(tm) v 1.2.0.5330
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5550
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5550
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model.datasources
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -504,6 +504,28 @@ class BehaviorTest extends CakeTestCase {
|
|||
$this->assertEqual($Apple->Behaviors->Test->settings['Apple'], $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that attach()/detach() works with plugin.banana
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testDetachWithPluginNames() {
|
||||
$Apple = new Apple();
|
||||
$Apple->Behaviors->attach('Plugin.Test');
|
||||
$this->assertTrue(isset($Apple->Behaviors->Test), 'Missing behavior');
|
||||
$this->assertEqual($Apple->Behaviors->attached(), array('Test'));
|
||||
|
||||
$Apple->Behaviors->detach('Plugin.Test');
|
||||
$this->assertEqual($Apple->Behaviors->attached(), array());
|
||||
|
||||
$Apple->Behaviors->attach('Plugin.Test');
|
||||
$this->assertTrue(isset($Apple->Behaviors->Test), 'Missing behavior');
|
||||
$this->assertEqual($Apple->Behaviors->attached(), array('Test'));
|
||||
|
||||
$Apple->Behaviors->detach('Test');
|
||||
$this->assertEqual($Apple->Behaviors->attached(), array());
|
||||
}
|
||||
|
||||
/**
|
||||
* test that attaching a non existant Behavior triggers a cake error.
|
||||
*
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
@ -7291,6 +7291,21 @@ class ModelReadTest extends BaseModelTest {
|
|||
$this->assertTrue(isset($result['Author']['full_name']));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that virtual fields work when they don't contain functions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testVirtualFieldAsAString() {
|
||||
$this->loadFixtures('Post', 'Author');
|
||||
$Post =& new Post();
|
||||
$Post->virtualFields = array(
|
||||
'writer' => 'Author.user'
|
||||
);
|
||||
$result = $Post->find('first');
|
||||
$this->assertTrue(isset($result['Post']['writer']), 'virtual field not fetched %s');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that isVirtualField will accept both aliased and non aliased fieldnames
|
||||
*
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
@ -897,6 +897,30 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that a null Id doesn't cause errors
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testSaveWithNullId() {
|
||||
$this->loadFixtures('User');
|
||||
$User =& new User();
|
||||
$User->read(null, 1);
|
||||
$User->data['User']['id'] = null;
|
||||
$this->assertTrue($User->save(array('password' => 'test')));
|
||||
$this->assertTrue($User->id > 0);
|
||||
|
||||
$result = $User->read(null, 2);
|
||||
$User->data['User']['id'] = null;
|
||||
$this->assertTrue($User->save(array('password' => 'test')));
|
||||
$this->assertTrue($User->id > 0);
|
||||
|
||||
$User->data['User'] = array('password' => 'something');
|
||||
$this->assertTrue($User->save());
|
||||
$result = $User->read();
|
||||
$this->assertEqual($User->data['User']['password'], 'something');
|
||||
}
|
||||
|
||||
/**
|
||||
* testSaveWithSet method
|
||||
*
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.model
|
||||
* @since CakePHP(tm) v 1.2.0.6464
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.6833
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5428
|
||||
|
@ -334,6 +334,32 @@ class SanitizeTest extends CakeTestCase {
|
|||
$expected = '';
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$string = <<<HTML
|
||||
text
|
||||
<style type="text/css">
|
||||
<!--
|
||||
#content { display:none; }
|
||||
-->
|
||||
</style>
|
||||
text
|
||||
HTML;
|
||||
$expected = "text\n\ntext";
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$string = <<<HTML
|
||||
text
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
alert('wooo');
|
||||
-->
|
||||
</script>
|
||||
text
|
||||
HTML;
|
||||
$expected = "text\n\ntext";
|
||||
$result = Sanitize::stripScripts($string);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.5432
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
|
@ -13,7 +13,7 @@
|
|||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP Version 5.x
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2006-2010, Cake Software Foundation, Inc.
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2006-2010, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2006-2010, Cake Software Foundation, Inc.
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2006-2010, Cake Software Foundation, Inc.
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -209,6 +209,26 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that alternate jQuery object values work for request()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testRequestWithAlternateJqueryObject() {
|
||||
$this->Jquery->jQueryObject = '$j';
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
'update' => '#updated',
|
||||
'success' => 'doFoo',
|
||||
'method' => 'post',
|
||||
'dataExpression' => true,
|
||||
'data' => '$j("#someId").serialize()',
|
||||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$j.ajax({data:$j("#someId").serialize(), dataType:"html", success:function (data, textStatus) {$j("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test sortable list generation
|
||||
*
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.3
|
||||
|
@ -319,6 +319,7 @@ class JsHelperTestCase extends CakeTestCase {
|
|||
*/
|
||||
function testLinkWithMock() {
|
||||
$this->_useMock();
|
||||
|
||||
$options = array('update' => '#content');
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
|
@ -335,7 +336,7 @@ class JsHelperTestCase extends CakeTestCase {
|
|||
|
||||
$this->Js->TestJsEngine->expects($this->at(2))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('event'), $this->equalTo( array('click', 'ajax code', $options)));
|
||||
->with($this->equalTo('event'), $this->equalTo( array('click', 'ajax code', $options + array('buffer' => null))));
|
||||
|
||||
$result = $this->Js->link('test link', '/posts/view/1', $options);
|
||||
$expected = array(
|
||||
|
@ -344,6 +345,15 @@ class JsHelperTestCase extends CakeTestCase {
|
|||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test link with a mock and confirmation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testLinkWithMockAndConfirm() {
|
||||
$this->_useMock();
|
||||
|
||||
$options = array(
|
||||
'confirm' => 'Are you sure?',
|
||||
|
@ -369,6 +379,7 @@ CODE;
|
|||
$this->Js->TestJsEngine->expects($this->at(1))
|
||||
->method('event')
|
||||
->with($this->equalTo('click'), $this->equalTo($code));
|
||||
|
||||
$result = $this->Js->link('test link »', '/posts/view/1', $options);
|
||||
$expected = array(
|
||||
'a' => array('id' => $options['id'], 'class' => $options['class'], 'href' => '/posts/view/1'),
|
||||
|
@ -376,6 +387,15 @@ CODE;
|
|||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test link passing on htmlAttributes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testLinkWithAribtraryAttributes() {
|
||||
$this->_useMock();
|
||||
|
||||
$options = array('id' => 'something', 'htmlAttributes' => array('arbitrary' => 'value', 'batman' => 'robin'));
|
||||
$result = $this->Js->link('test link', '/posts/view/1', $options);
|
||||
|
@ -395,14 +415,15 @@ CODE;
|
|||
*/
|
||||
function testLinkWithNoBuffering() {
|
||||
$this->_useMock();
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(1))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('request'))
|
||||
->with('request', array('/posts/view/1', array('update' => '#content')))
|
||||
->will($this->returnValue('ajax code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
$this->Js->TestJsEngine->expects($this->at(2))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('get'))
|
||||
->with('event')
|
||||
->will($this->returnValue('-event handler-'));
|
||||
|
||||
$options = array('update' => '#content', 'buffer' => false);
|
||||
|
@ -418,9 +439,29 @@ CODE;
|
|||
'/script'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test link with buffering off and safe on.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testLinkWithNoBufferingAndSafe() {
|
||||
$this->_useMock();
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(1))
|
||||
->method('dispatchMethod')
|
||||
->with('request', array('/posts/view/1', array('update' => '#content')))
|
||||
->will($this->returnValue('ajax code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(2))
|
||||
->method('dispatchMethod')
|
||||
->with('event')
|
||||
->will($this->returnValue('-event handler-'));
|
||||
|
||||
$options = array('update' => '#content', 'buffer' => false, 'safe' => false);
|
||||
$result = $this->Js->link('test link', '/posts/view/1', $options);
|
||||
|
||||
$expected = array(
|
||||
'a' => array('id' => 'preg:/link-\d+/', 'href' => '/posts/view/1'),
|
||||
'test link',
|
||||
|
@ -441,41 +482,29 @@ CODE;
|
|||
$this->_useMock();
|
||||
|
||||
$options = array('update' => '#content', 'id' => 'test-submit');
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('serializeform'))
|
||||
->will($this->returnValue('serialize-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('serializeForm'))
|
||||
->will($this->returnValue('serialize-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('get'))
|
||||
->will($this->returnValue('ajax-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(0))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('get'));
|
||||
->with('get');
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(1))
|
||||
->method('dispatchMethod')
|
||||
->with($this->matchesRegularExpression('/serializeForm/i'));
|
||||
->with('serializeForm')
|
||||
->will($this->returnValue('serialize-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(2))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('request'));
|
||||
->with('request')
|
||||
->will($this->returnValue('ajax-code'));
|
||||
|
||||
$params = array(
|
||||
'update' => $options['update'], 'data' => 'serialize-code',
|
||||
'method' => 'post', 'dataExpression' => true
|
||||
'method' => 'post', 'dataExpression' => true, 'buffer' => null
|
||||
);
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(3))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('event'), $this->equalTo( array('click', "ajax-code", $params)));
|
||||
->with('event', $this->equalTo( array('click', "ajax-code", $params)));
|
||||
|
||||
$result = $this->Js->submit('Save', $options);
|
||||
$expected = array(
|
||||
|
@ -487,7 +516,7 @@ CODE;
|
|||
|
||||
$this->Js->TestJsEngine->expects($this->at(4))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('get'));
|
||||
->with('get');
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(5))
|
||||
->method('dispatchMethod')
|
||||
|
@ -508,7 +537,7 @@ CODE;
|
|||
|
||||
$params = array(
|
||||
'update' => '#content', 'data' => 'serialize-code',
|
||||
'method' => 'post', 'dataExpression' => true
|
||||
'method' => 'post', 'dataExpression' => true, 'buffer' => null
|
||||
);
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(7))
|
||||
|
@ -534,36 +563,28 @@ CODE;
|
|||
$this->_useMock();
|
||||
$options = array('update' => '#content', 'id' => 'test-submit', 'buffer' => false, 'safe' => false);
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('serializeform'))
|
||||
->will($this->returnValue('serialize-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('request'))
|
||||
->will($this->returnValue('ajax-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->any())
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('event'))
|
||||
->will($this->returnValue('event-handler'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(0))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('get'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(1))
|
||||
->method('dispatchMethod')
|
||||
->with($this->matchesRegularExpression('/serializeForm/i'));
|
||||
->with('serializeForm')
|
||||
->will($this->returnValue('serialize-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(2))
|
||||
->method('dispatchMethod')
|
||||
->with($this->equalTo('request'));
|
||||
->with('request')
|
||||
->will($this->returnValue('ajax-code'));
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(3))
|
||||
->method('dispatchMethod')
|
||||
->with('event')
|
||||
->will($this->returnValue('event-handler'));
|
||||
|
||||
$params = array(
|
||||
'update' => $options['update'], 'buffer' => false, 'safe' => false, 'data' => 'serialize-code',
|
||||
'method' => 'post', 'dataExpression' => true
|
||||
'update' => $options['update'], 'data' => 'serialize-code',
|
||||
'method' => 'post', 'dataExpression' => true, 'buffer' => false
|
||||
);
|
||||
|
||||
$this->Js->TestJsEngine->expects($this->at(3))
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
@ -179,7 +179,6 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
$result = $this->Paginator->sort('title');
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||
|
||||
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('title');
|
||||
|
@ -190,23 +189,71 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||
|
||||
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'desc');
|
||||
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||
|
||||
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'asc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||
|
||||
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||
$this->Paginator->params['paging']['Article']['options']['sort'] = null;
|
||||
$result = $this->Paginator->sort('Title', 'title', array('direction' => 'desc', 'class' => 'foo'));
|
||||
$this->assertPattern('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="foo asc">Title<\/a>$/', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that sort() works with virtual field order options.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testSortLinkWithVirtualField() {
|
||||
Router::setRequestInfo(array(
|
||||
array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), 'form' => array(), 'url' => array('url' => 'accounts/')),
|
||||
array('base' => '', 'here' => '/accounts/', 'webroot' => '/')
|
||||
));
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('full_name' => 'asc');
|
||||
|
||||
$result = $this->Paginator->sort('Article.full_name');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/accounts/index/page:1/sort:Article.full_name/direction:desc', 'class' => 'asc'),
|
||||
'Article.full Name',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->sort('full_name');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/accounts/index/page:1/sort:full_name/direction:desc', 'class' => 'asc'),
|
||||
'Full Name',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$this->Paginator->params['paging']['Article']['options']['order'] = array('full_name' => 'desc');
|
||||
$result = $this->Paginator->sort('Article.full_name');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/accounts/index/page:1/sort:Article.full_name/direction:asc', 'class' => 'desc'),
|
||||
'Article.full Name',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Paginator->sort('full_name');
|
||||
$expected = array(
|
||||
'a' => array('href' => '/accounts/index/page:1/sort:full_name/direction:asc', 'class' => 'desc'),
|
||||
'Full Name',
|
||||
'/a'
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.tests.cases.libs.view.helpers
|
||||
* @since CakePHP(tm) v 1.2.0.4206
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue