Merge branch '1.3-misc' of dev@code.cakephp.org:cakephp into 1.3-logging

This commit is contained in:
mark_story 2009-11-05 18:40:01 -05:00
commit 98f0e370a1
77 changed files with 853 additions and 585 deletions

View file

@ -241,11 +241,6 @@
*/
//date_default_timezone_set('UTC');
/**
* If you are on PHP 5.3 uncomment this line and correct your server timezone
* to fix the date & time related errors.
*/
//date_default_timezone_set('UTC');
/**
*
* Cache Engine Configuration

View file

View file

View file

@ -17,4 +17,4 @@
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
1.3.0.0
1.3.0-alpha

View file

@ -19,5 +19,5 @@
* @since CakePHP(tm) v 1.1.11.4062
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
return $config['Cake.version'] = '1.3.0';
return $config['Cake.version'] = '1.3.0-alpha';
?>

View file

@ -72,7 +72,7 @@ if (!defined('APP')) {
define('COMPONENTS', CONTROLLERS.'components'.DS);
/**
* Path to the application's views directory.
* Path to the application's libs directory.
*/
define('APPLIBS', APP.'libs'.DS);

View file

@ -353,9 +353,10 @@ class DbConfigTask extends Shell {
* @return void
**/
function getConfig() {
App::import('Model', 'ConnectionManager', false);
$useDbConfig = 'default';
$configs = get_class_vars($this->databaseClassName);
if (!is_array($configs)) {
return $this->execute();
}

View file

@ -82,10 +82,6 @@ class FixtureTask extends Shell {
* @access public
*/
function execute() {
if (!class_exists('CakeSchema')) {
App::import('Model', 'CakeSchema', false);
}
if (empty($this->args)) {
$this->__interactive();
}
@ -176,6 +172,9 @@ class FixtureTask extends Shell {
* @access private
*/
function bake($model, $useTable = false, $importOptions = array()) {
if (!class_exists('CakeSchema')) {
App::import('Model', 'CakeSchema', false);
}
$table = $schema = $records = $import = $modelImport = $recordImport = null;
if (!$useTable) {
$useTable = Inflector::tableize($model);

View file

@ -75,16 +75,6 @@ class ModelTask extends Shell {
**/
var $__validations = array();
/**
* startup method
*
* @return void
**/
function startup() {
App::import('Model', 'Model', false);
parent::startup();
}
/**
* Execution method always used for tasks
*
@ -176,6 +166,8 @@ class ModelTask extends Shell {
* @access private
*/
function __interactive() {
App::import('Model', 'Model', false);
$this->hr();
$this->out(sprintf("Bake Model\nPath: %s", $this->path));
$this->hr();
@ -796,6 +788,8 @@ class ModelTask extends Shell {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
App::import('Model', 'ConnectionManager', false);
$db =& ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
$fullTableName = $db->fullTableName($useTable, false);
@ -823,6 +817,8 @@ class ModelTask extends Shell {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
App::import('Model', 'ConnectionManager', false);
$tables = array();
$db =& ConnectionManager::getDataSource($useDbConfig);
$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];

View file

@ -0,0 +1,2 @@
<?php echo $xml->header(); ?>
<?php echo $content_for_layout; ?>

View file

@ -24,7 +24,7 @@
*/
?>
<div class="<?php echo $pluralVar;?> form">
<?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
<fieldset>
<legend><?php echo "<?php printf(__('" . Inflector::humanize($action) . " %s', true), __('{$singularHumanName}', true)); ?>";?></legend>
<?php
@ -33,34 +33,34 @@
if ($action == 'add' && $field == $primaryKey) {
continue;
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
echo "\t\techo \$form->input('{$field}');\n";
echo "\t\techo \$this->Form->input('{$field}');\n";
}
}
if (!empty($associations['hasAndBelongsToMany'])) {
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
echo "\t\techo \$form->input('{$assocName}');\n";
echo "\t\techo \$this->Form->input('{$assocName}');\n";
}
}
echo "\t?>\n";
?>
</fieldset>
<?php
echo "<?php echo \$form->end(__('Submit', true));?>\n";
echo "<?php echo \$this->Form->end(__('Submit', true));?>\n";
?>
</div>
<div class="actions">
<ul>
<?php if ($action != 'add'):?>
<li><?php echo "<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \$form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
<li><?php echo "<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
<?php endif;?>
<li><?php echo "<?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index'));?>";?></li>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
}

View file

@ -27,7 +27,7 @@
<h2><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
<p>
<?php echo "<?php
echo \$paginator->counter(array(
echo \$this->Paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?>";?>
@ -35,7 +35,7 @@ echo \$paginator->counter(array(
<table cellpadding="0" cellspacing="0">
<tr>
<?php foreach ($fields as $field):?>
<th><?php echo "<?php echo \$paginator->sort('{$field}');?>";?></th>
<th><?php echo "<?php echo \$this->Paginator->sort('{$field}');?>";?></th>
<?php endforeach;?>
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
</tr>
@ -55,7 +55,7 @@ foreach (\${$pluralVar} as \${$singularVar}):
foreach ($associations['belongsTo'] as $alias => $details) {
if ($field === $details['foreignKey']) {
$isKey = true;
echo "\t\t<td>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
echo "\t\t<td>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
break;
}
}
@ -66,9 +66,9 @@ foreach (\${$pluralVar} as \${$singularVar}):
}
echo "\t\t<td class=\"actions\">\n";
echo "\t\t\t<?php echo \$html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
echo "\t\t</td>\n";
echo "\t</tr>\n";
@ -77,20 +77,20 @@ echo "<?php endforeach; ?>\n";
</table>
</div>
<div class="paging">
<?php echo "\t<?php echo \$paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
| <?php echo "\t<?php echo \$paginator->numbers();?>\n"?>
<?php echo "\t<?php echo \$paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
<?php echo "\t<?php echo \$this->Paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
| <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?>
<?php echo "\t<?php echo \$this->Paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>\n";?>
</div>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?>";?></li>
<?php
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
}

View file

@ -34,7 +34,7 @@ foreach ($fields as $field) {
if ($field === $details['foreignKey']) {
$isKey = true;
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t&nbsp;\n\t\t</dd>\n";
break;
}
}
@ -50,17 +50,17 @@ foreach ($fields as $field) {
<div class="actions">
<ul>
<?php
echo "\t\t<li><?php echo \$html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('{$singularHumanName}', true)), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('Delete %s', true), __('{$singularHumanName}', true)), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('{$pluralHumanName}', true)), array('action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('{$singularHumanName}', true)), array('action' => 'add')); ?> </li>\n";
$done = array();
foreach ($associations as $type => $data) {
foreach ($data as $alias => $details) {
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
echo "\t\t<li><?php echo \$html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('List %s', true), __('" . Inflector::humanize($details['controller']) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
echo "\t\t<li><?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
$done[] = $details['controller'];
}
}
@ -85,7 +85,7 @@ if (!empty($associations['hasOne'])) :
<?php echo "<?php endif; ?>\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('Edit %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
</ul>
</div>
</div>
@ -132,9 +132,9 @@ echo "\t<?php
}
echo "\t\t\t<td class=\"actions\">\n";
echo "\t\t\t\t<?php echo \$html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo \$html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo \$html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo \$this->Html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
echo "\t\t\t</td>\n";
echo "\t\t</tr>\n";
@ -144,7 +144,7 @@ echo "\t<?php endforeach; ?>\n";
<?php echo "<?php endif; ?>\n\n";?>
<div class="actions">
<ul>
<li><?php echo "<?php echo \$html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
<li><?php echo "<?php echo \$this->Html->link(sprintf(__('New %s', true), __('" . Inflector::humanize(Inflector::underscore($alias)) . "', true)), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
</ul>
</div>
</div>

View file

@ -641,15 +641,15 @@ class CakeSession extends Object {
function __regenerateId() {
$oldSessionId = session_id();
if ($oldSessionId) {
$sessionpath = session_save_path();
if (empty($sessionpath)) {
$sessionpath = "/tmp";
}
if (session_id() != "" || isset($_COOKIE[session_name()])) {
if (session_id() != ''|| isset($_COOKIE[session_name()])) {
setcookie(Configure::read('Session.cookie'), '', time() - 42000, $this->path);
}
session_regenerate_id(true);
if (PHP_VERSION < 5.1) {
$sessionPath = session_save_path();
if (empty($sessionPath)) {
$sessionPath = '/tmp';
}
$newSessid = session_id();
if (function_exists('session_write_close')) {
@ -659,7 +659,7 @@ class CakeSession extends Object {
session_id($oldSessionId);
session_start();
session_destroy();
$file = $sessionpath . DS . "sess_$oldSessionId";
$file = $sessionPath . DS . 'sess_' . $oldSessionId;
@unlink($file);
$this->__initSession();
session_id($newSessid);

View file

@ -488,6 +488,14 @@ class App extends Object {
*/
var $components = array();
/**
* List of additional path(s) where datasource files reside.
*
* @var array
* @access public
*/
var $datasources = array();
/**
* List of additional path(s) where libs files reside.
*

View file

@ -450,10 +450,10 @@ class AuthComponent extends Object {
return false;
}
$defaults = array(
'loginAction' => Router::normalize(array(
'controller'=> Inflector::underscore(Inflector::pluralize($this->userModel)),
'loginAction' => array(
'controller' => Inflector::underscore(Inflector::pluralize($this->userModel)),
'action' => 'login'
)),
),
'sessionKey' => 'Auth.' . $this->userModel,
'logoutRedirect' => $this->loginAction,
'loginError' => __('Login failed. Invalid username or password.', true),

View file

@ -215,7 +215,7 @@ class CookieComponent extends Object {
foreach ($key as $name => $value) {
if (strpos($name, '.') === false) {
$this->__values[$name] = $value;
$this->__write(".$name", $value);
$this->__write("[$name]", $value);
} else {
$names = explode('.', $name, 2);
@ -223,7 +223,7 @@ class CookieComponent extends Object {
$this->__values[$names[0]] = array();
}
$this->__values[$names[0]] = Set::insert($this->__values[$names[0]], $names[1], $value);
$this->__write("." . implode('.', $names), $value);
$this->__write('[' . implode('][', $names) . ']', $value);
}
}
$this->__encrypted = true;
@ -289,12 +289,12 @@ class CookieComponent extends Object {
}
if (strpos($key, '.') === false) {
unset($this->__values[$key]);
$this->__delete(".$key");
$this->__delete("[$key]");
return;
}
$names = explode('.', $key, 2);
$this->__values[$names[0]] = Set::remove($this->__values[$names[0]], $names[1]);
$this->__delete("." . implode('.', $names));
$this->__delete('[' . implode('][', $names) . ']');
}
/**
@ -315,11 +315,11 @@ class CookieComponent extends Object {
if (is_array($value)) {
foreach ($value as $key => $val) {
unset($this->__values[$name][$key]);
$this->__delete(".$name.$key");
$this->__delete("[$name][$key]");
}
}
unset($this->__values[$name]);
$this->__delete(".$name");
$this->__delete("[$name]");
}
}
@ -354,6 +354,11 @@ class CookieComponent extends Object {
return $this->__expires;
}
$this->__reset = $this->__expires;
if ($expires == 0) {
return $this->__expires = 0;
}
if (is_integer($expires) || is_numeric($expires)) {
return $this->__expires = $now + intval($expires);
}

View file

@ -74,6 +74,9 @@ class Controller extends Object {
*
* Example: var $uses = array('Product', 'Post', 'Comment');
*
* Can be set to array() to use no models. Can be set to false to
* use no models and prevent the merging of $uses with AppController
*
* @var mixed A single name as a string or a list of names as an array.
* @access protected
* @link http://book.cakephp.org/view/53/components-helpers-and-uses

View file

@ -229,16 +229,8 @@ class Debugger extends Object {
*/
function log($var, $level = LOG_DEBUG) {
$_this = Debugger::getInstance();
$trace = $_this->trace(array('start' => 1, 'depth' => 2, 'format' => 'array'));
$source = null;
if (is_object($trace[0]['object']) && isset($trace[0]['object']->_reporter->_test_stack)) {
$stack = $trace[0]['object']->_reporter->_test_stack;
$source = sprintf('[%1$s, %3$s::%2$s()]' . "\n",
array_shift($stack), array_pop($stack), array_pop($stack));
}
CakeLog::write($level, $source . $_this->exportVar($var));
$source = $_this->trace(array('start' => 1)) . "\n";
CakeLog::write($level, "\n" . $source . $_this->exportVar($var));
}
/**

View file

@ -326,7 +326,7 @@ class Folder extends Object {
* @static
*/
function addPathElement($path, $element) {
return Folder::slashTerm($path) . $element;
return rtrim($path, DS) . DS . $element;
}
/**

View file

@ -693,7 +693,7 @@ class HttpSocket extends CakeSocket {
foreach ($items as $item) {
if (strpos($item, '=') !== false) {
list($key, $value) = explode('=', $item);
list($key, $value) = explode('=', $item, 2);
} else {
$key = $item;
$value = null;

View file

@ -474,7 +474,7 @@ class TreeBehavior extends ModelBehavior {
'fields' => array($Model->primaryKey, $left, $right), 'recursive' => $recursive)
);
if ($nextNode) {
list($nextNode)= array_values($nextNode);
list($nextNode) = array_values($nextNode);
} else {
return false;
}
@ -657,6 +657,8 @@ class TreeBehavior extends ModelBehavior {
$sort = $field . ' ' . $order;
$nodes = $this->children($Model, $id, true, $fields, $sort, null, null, $recursive);
$cacheQueries = $Model->cacheQueries;
$Model->cacheQueries = false;
if ($nodes) {
foreach ($nodes as $node) {
$id = $node[$Model->alias][$Model->primaryKey];
@ -666,6 +668,7 @@ class TreeBehavior extends ModelBehavior {
}
}
}
$Model->cacheQueries = $cacheQueries;
return true;
}

View file

@ -320,45 +320,53 @@ class DataSource extends Object {
}
/**
* Used to create new records. The "C" CRUD.
*
* To-be-overridden in subclasses.
*
* @param unknown_type $model
* @param unknown_type $fields
* @param unknown_type $values
* @return unknown
* @param Model $model The Model to be created.
* @param array $fields An Array of fields to be saved.
* @param array $values An Array of values to save.
* @return boolean success
*/
function create(&$model, $fields = null, $values = null) {
return false;
}
/**
* Used to read records from the Datasource. The "R" in CRUD
*
* To-be-overridden in subclasses.
*
* @param unknown_type $model
* @param unknown_type $queryData
* @return unknown
* @param Model $model The model being read.
* @param array $queryData An array of query data used to find the data you want
* @return mixed
*/
function read(&$model, $queryData = array()) {
return false;
}
/**
* Update a record(s) in the datasource.
*
* To-be-overridden in subclasses.
*
* @param unknown_type $model
* @param unknown_type $fields
* @param unknown_type $values
* @return unknown
* @param Model $model Instance of the model class being updated
* @param array $fields Array of fields to be updated
* @param array $values Array of values to be update $fields to.
* @return boolean Success
*/
function update(&$model, $fields = null, $values = null) {
return false;
}
/**
* Delete a record(s) in the datasource.
*
* To-be-overridden in subclasses.
*
* @param unknown_type $model
* @param unknown_type $id
* @param Model $model The model class having record(s) deleted
* @param mixed $id Primary key of the model
*/
function delete(&$model, $id = null) {
if ($id == null) {
@ -396,6 +404,16 @@ class DataSource extends Object {
return false;
}
/**
* Check whether the conditions for the Datasource being available
* are satisfied. Often used from connect() to check for support
* before establishing a connection.
*
* @return boolean Whether or not the Datasources conditions for use are met.
**/
function enabled() {
return true;
}
/**
* Returns true if the DataSource supports the given interface (method)
*

View file

@ -110,7 +110,9 @@ class DboAdodb extends DboSource {
$adodb_driver = substr($config['connect'], 0, $persistent);
$connect = 'PConnect';
}
if (!$this->enabled()) {
return false;
}
$this->_adodb = NewADOConnection($adodb_driver);
$this->_adodbDataDict = NewDataDictionary($this->_adodb, $adodb_driver);
@ -123,6 +125,14 @@ class DboAdodb extends DboSource {
return $this->connected;
}
/**
* Check that AdoDB is available.
*
* @return boolean
**/
function enabled() {
return function_exists('NewADOConnection');
}
/**
* Disconnects from database.
*

View file

@ -146,6 +146,14 @@ class DboDb2 extends DboSource {
return $this->connected;
}
/**
* Check that the DB2 extension is installed/loaded
*
* @return boolean
**/
function enabled() {
return extension_loaded('ibm_db2');
}
/**
* Disconnects from database.
*

View file

@ -140,10 +140,19 @@ class DboFirebird extends DboSource {
$connect = $config['connect'];
$this->connected = false;
$this->connection = $connect($config['host'] . ':' . $config['database'], $config['login'], $config['password']);
$this->connected = true;
}
/**
* Check that the interbase extension is loaded
*
* @return boolean
**/
function enabled() {
return extension_loaded('interbase');
}
/**
* Disconnects from database.
*

View file

@ -164,6 +164,14 @@ class DboMssql extends DboSource {
return $this->connected;
}
/**
* Check that MsSQL is installed/loaded
*
* @return boolean
**/
function enabled() {
return extension_loaded('mssql');
}
/**
* Disconnects from database.
*

View file

@ -118,6 +118,40 @@ class DboMysqlBase extends DboSource {
'boolean' => array('name' => 'tinyint', 'limit' => '1')
);
/**
* Returns an array of the fields in given table name.
*
* @param string $tableName Name of database table to inspect
* @return array Fields in table. Keys are name and type
*/
function describe(&$model) {
$cache = parent::describe($model);
if ($cache != null) {
return $cache;
}
$fields = false;
$cols = $this->query('DESCRIBE ' . $this->fullTableName($model));
foreach ($cols as $column) {
$colKey = array_keys($column);
if (isset($column[$colKey[0]]) && !isset($column[0])) {
$column[0] = $column[$colKey[0]];
}
if (isset($column[0])) {
$fields[$column[0]['Field']] = array(
'type' => $this->column($column[0]['Type']),
'null' => ($column[0]['Null'] == 'YES' ? true : false),
'default' => $column[0]['Default'],
'length' => $this->length($column[0]['Type']),
);
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
}
}
}
$this->__cacheDescription($this->fullTableName($model, false), $fields);
return $fields;
}
/**
* Generates and executes an SQL UPDATE statement for given model, fields, and values.
*
@ -498,6 +532,14 @@ class DboMysql extends DboMysqlBase {
return $this->connected;
}
/**
* Check whether the MySQL extension is installed/loaded
*
* @return boolean
**/
function enabled() {
return extension_loaded('mysql');
}
/**
* Disconnects from database.
*
@ -547,52 +589,6 @@ class DboMysql extends DboMysqlBase {
}
}
/**
* Returns an array of the fields in given table name.
*
* @param string $tableName Name of database table to inspect
* @return array Fields in table. Keys are name and type
*/
function describe(&$model) {
$cache = parent::describe($model);
if ($cache != null) {
return $cache;
}
$fields = false;
$cols = $this->query('SHOW FULL COLUMNS FROM ' . $this->fullTableName($model));
foreach ($cols as $column) {
$colKey = array_keys($column);
if (isset($column[$colKey[0]]) && !isset($column[0])) {
$column[0] = $column[$colKey[0]];
}
if (isset($column[0])) {
$fields[$column[0]['Field']] = array(
'type' => $this->column($column[0]['Type']),
'null' => ($column[0]['Null'] == 'YES' ? true : false),
'default' => $column[0]['Default'],
'length' => $this->length($column[0]['Type']),
);
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
}
foreach ($this->fieldParameters as $name => $value) {
if (!empty($column[0][$value['column']])) {
$fields[$column[0]['Field']][$name] = $column[0][$value['column']];
}
}
if (isset($fields[$column[0]['Field']]['collate'])) {
$charset = $this->getCharsetName($fields[$column[0]['Field']]['collate']);
if ($charset) {
$fields[$column[0]['Field']]['charset'] = $charset;
}
}
}
}
$this->__cacheDescription($this->fullTableName($model, false), $fields);
return $fields;
}
/**
* Returns a quoted and escaped string of $data for use in an SQL statement.
*

View file

@ -89,6 +89,14 @@ class DboMysqli extends DboMysqlBase {
return $this->connected;
}
/**
* Check that MySQLi is installed/enabled
*
* @return boolean
**/
function enabled() {
return extension_loaded('mysqli');
}
/**
* Disconnects from database.
*
@ -159,44 +167,6 @@ class DboMysqli extends DboMysqlBase {
return $tables;
}
/**
* Returns an array of the fields in given table name.
*
* @param string $tableName Name of database table to inspect
* @return array Fields in table. Keys are name and type
*/
function describe(&$model) {
$cache = parent::describe($model);
if ($cache != null) {
return $cache;
}
$fields = false;
$cols = $this->query('DESCRIBE ' . $this->fullTableName($model));
foreach ($cols as $column) {
$colKey = array_keys($column);
if (isset($column[$colKey[0]]) && !isset($column[0])) {
$column[0] = $column[$colKey[0]];
}
if (isset($column[0])) {
$fields[$column[0]['Field']] = array(
'type' => $this->column($column[0]['Type']),
'null' => ($column[0]['Null'] == 'YES' ? true : false),
'default' => $column[0]['Default'],
'length' => $this->length($column[0]['Type'])
);
if (!empty($column[0]['Key']) && isset($this->index[$column[0]['Key']])) {
$fields[$column[0]['Field']]['key'] = $this->index[$column[0]['Key']];
}
}
}
$this->__cacheDescription($this->fullTableName($model, false), $fields);
return $fields;
}
/**
* Returns a quoted and escaped string of $data for use in an SQL statement.
*
@ -344,26 +314,6 @@ class DboMysqli extends DboMysqlBase {
return 'text';
}
/**
* Gets the length of a database-native column description, or null if no length
*
* @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return integer An integer representing the length of the column
*/
function length($real) {
$col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null;
if (strpos($col, '(') !== false) {
list($col, $limit) = explode('(', $col);
}
if ($limit != null) {
return intval($limit);
}
return null;
}
/**
* Enter description here...
*

View file

@ -112,6 +112,14 @@ class DboOdbc extends DboSource {
return $this->connected;
}
/**
* Check if the ODBC extension is installed/loaded
*
* @return boolean
**/
function enabled() {
return extension_loaded('odbc');
}
/**
* Disconnects from database.
*

View file

@ -129,6 +129,14 @@ class DboPostgres extends DboSource {
return $this->connected;
}
/**
* Check if PostgreSQL is enabled/loaded
*
* @return boolean
**/
function enabled() {
return extension_loaded('pgsql');
}
/**
* Disconnects from database.
*
@ -289,6 +297,7 @@ class DboPostgres extends DboSource {
case 'date':
case 'datetime':
case 'timestamp':
case 'time':
if ($data === '') {
return $read ? 'NULL' : 'DEFAULT';
}

View file

@ -143,6 +143,14 @@ class DboSqlite extends DboSource {
return $this->connected;
}
/**
* Check that SQLite is enabled/installed
*
* @return boolean
**/
function enabled() {
return extension_loaded('sqlite');
}
/**
* Disconnects from database.
*

View file

@ -111,6 +111,14 @@ class DboSybase extends DboSource {
return $this->connected;
}
/**
* Check that one of the sybase extensions is installed
*
* @return boolean
**/
function enabled() {
return extension_loaded('sybase') || extension_loaded('sybase_ct');
}
/**
* Disconnects from database.
*

View file

@ -116,7 +116,9 @@ class DboSource extends DataSource {
}
parent::__construct($config);
$this->fullDebug = Configure::read() > 1;
if (!$this->enabled()) {
return false;
}
if ($autoConnect) {
return $this->connect();
} else {

View file

@ -2079,12 +2079,13 @@ class Model extends Overloadable {
}
$results = $db->read($this, $query);
$this->resetAssociations();
$this->findQueryType = null;
if ($query['callbacks'] === true || $query['callbacks'] === 'after') {
$results = $this->__filterResults($results);
}
$this->findQueryType = null;
if ($type === 'all') {
return $results;
} else {

View file

@ -229,6 +229,9 @@ class String {
$options += $defaults;
$format = $options['format'];
$data = (array)$data;
if (empty($data)) {
return ($options['clean']) ? String::cleanInsert($str, $options) : $str;
}
if (!isset($format)) {
$format = sprintf(

View file

@ -544,7 +544,7 @@ class Helper extends Overloadable {
$errors = $this->validationErrors;
$entity = $view->entity();
if (!empty($entity)) {
return Set::extract($errors,join('.',$entity));
return Set::extract($errors, join('.', $entity));
}
}
@ -645,10 +645,18 @@ class Helper extends Overloadable {
$view =& ClassRegistry::getObject('view');
$result = null;
$entity = $view->entity();
if (!empty($this->data) && !empty($entity)) {
$result = Set::extract($this->data,join('.',$entity));
$result = Set::extract($this->data, join('.', $entity));
}
$habtmKey = $this->field();
if (empty($result) && isset($this->data[$habtmKey]) && is_array($this->data[$habtmKey])) {
if (ClassRegistry::isKeySet($habtmKey)) {
$model =& ClassRegistry::getObject($habtmKey);
$result = $this->__selectedArray($this->data[$habtmKey], $model->primaryKey);
}
}
if (is_array($result)) {

View file

@ -81,15 +81,15 @@ class CacheHelper extends AppHelper {
$cacheTime = 0;
$useCallbacks = false;
if (is_array($this->cacheAction)) {
$contoller = Inflector::underscore($this->controllerName);
$controller = Inflector::underscore($this->controllerName);
$check = str_replace('/', '_', $this->here);
$replace = str_replace('/', '_', $this->base);
$match = str_replace($this->base, '', $this->here);
$match = str_replace('//', '/', $match);
$match = str_replace('/' . $contoller . '/', '', $match);
$match = str_replace('/' . $controller . '/', '', $match);
$match = str_replace('/' . $this->controllerName . '/', '', $match);
$check = str_replace($replace, '', $check);
$check = str_replace('_' . $contoller . '_', '', $check);
$check = str_replace('_' . $controller . '_', '', $check);
$check = str_replace('_' . $this->controllerName . '_', '', $check);
$check = Inflector::slug($check);
$check = preg_replace('/^_+/', '', $check);
@ -179,7 +179,6 @@ class CacheHelper extends AppHelper {
$outputResult = array_values($outputResult);
}
if (!empty($fileResult)) {
$i = 0;
foreach ($fileResult as $cacheBlock) {
@ -202,24 +201,23 @@ class CacheHelper extends AppHelper {
function __parseOutput($cache) {
$count = 0;
if (!empty($this->__match)) {
foreach ($this->__match as $found) {
$original = $cache;
$length = strlen($found);
$position = 0;
for ($i = 1; $i <= 1; $i++) {
$position = strpos($cache, $found, $position);
for ($i = 1; $i <= 1; $i++) {
$position = strpos($cache, $found, $position);
if ($position !== false) {
$cache = substr($original, 0, $position);
$cache .= $this->__replace[$count];
$cache .= substr($original, $position + $length);
} else {
break;
}
if ($position !== false) {
$cache = substr($original, 0, $position);
$cache .= $this->__replace[$count];
$cache .= substr($original, $position + $length);
} else {
break;
}
$count++;
}
$count++;
}
return $cache;
}
@ -301,5 +299,4 @@ class CacheHelper extends AppHelper {
return cache('views' . DS . $cache, $file, $timestamp);
}
}
?>

View file

@ -772,9 +772,13 @@ class FormHelper extends AppHelper {
if ($label !== false) {
$labelAttributes = $this->domId(array(), 'for');
if (in_array($options['type'], array('date', 'datetime'))) {
$labelAttributes['for'] .= 'Month';
} else if ($options['type'] === 'time') {
if ($options['type'] === 'date' || $options['type'] === 'datetime') {
if (isset($options['dateFormat']) && $options['dateFormat'] === 'NONE') {
$labelAttributes['for'] .= 'Hour';
} else {
$labelAttributes['for'] .= 'Month';
}
} elseif ($options['type'] === 'time') {
$labelAttributes['for'] .= 'Hour';
}
@ -1818,7 +1822,7 @@ class FormHelper extends AppHelper {
}
if ($name !== null) {
if ((!$selectedIsEmpty && $selected == $name) || ($selectedIsArray && in_array($name, $selected))) {
if ((!$selectedIsEmpty && (string)$selected == (string)$name) || ($selectedIsArray && in_array($name, $selected))) {
if ($attributes['style'] === 'checkbox') {
$htmlOptions['checked'] = true;
} else {

View file

@ -250,11 +250,13 @@ class PaginatorHelper extends AppHelper {
}
/**
* Generates a sorting link
* Generates a sorting link. Sets named parameters for the sort and direction. Handles
* direction switching automatically.
*
* @param string $title Title for the link.
* @param string $key The name of the key that the recordset should be sorted.
* @param array $options Options for sorting link. See #options for list of keys.
* @param string $title Title for the link.
* @param string $key The name of the key that the recordset should be sorted. If $key is null
* $title will be used for the key, and a title will be generated by inflection.
* @param array $options Options for sorting link. See #options for list of keys.
* @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified
* key the returned link will sort by 'desc'.
*/

View file

@ -26,15 +26,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php echo $html->charset(); ?>
<?php echo $this->Html->charset(); ?>
<title>
<?php __('CakePHP: the rapid development php framework:'); ?>
<?php echo $title_for_layout; ?>
</title>
<?php
echo $html->meta('icon');
echo $this->Html->meta('icon');
echo $html->css('cake.generic');
echo $this->Html->css('cake.generic');
echo $scripts_for_layout;
?>
@ -42,18 +42,18 @@
<body>
<div id="container">
<div id="header">
<h1><?php echo $html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org'); ?></h1>
<h1><?php echo $this->Html->link(__('CakePHP: the rapid development php framework', true), 'http://cakephp.org'); ?></h1>
</div>
<div id="content">
<?php $session->flash(); ?>
<?php $this->Session->flash(); ?>
<?php echo $content_for_layout; ?>
</div>
<div id="footer">
<?php echo $html->link(
$html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")),
<?php echo $this->Html->link(
$this->Html->image('cake.power.gif', array('alt'=> __("CakePHP: the rapid development php framework", true), 'border'=>"0")),
'http://www.cakephp.org/',
array('target' => '_blank', 'escape' => false)
);

View file

@ -26,7 +26,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php echo $html->charset(); ?>
<?php echo $this->Html->charset(); ?>
<title><?php echo $page_title; ?></title>
<?php if (Configure::read() == 0) { ?>

View file

@ -1,5 +1,5 @@
<?php
echo $rss->header();
echo $this->Rss->header();
if (!isset($channel)) {
$channel = array();
@ -8,8 +8,8 @@ if (!isset($channel['title'])) {
$channel['title'] = $title_for_layout;
}
echo $rss->document(
$rss->channel(
echo $this->Rss->document(
$this->Rss->channel(
array(), $channel, $content_for_layout
)
);

View file

@ -1,2 +1,2 @@
<?php echo $xml->header(); ?>
<?php echo $this->Xml->header(); ?>
<?php echo $content_for_layout; ?>

View file

@ -27,8 +27,9 @@ if (Configure::read() == 0):
endif;
?>
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
<a href="http://code.cakephp.org/wiki/changelog/1_2_x_x"><?php __('Read the changelog'); ?> </a>
<?php
echo $this->Html->link(__('Read the changelog', true), 'http://code.cakephp.org/wiki/changelog/1_3_0-alpha');
if (Configure::read() > 0):
Debugger::checkSessionKey();
endif;
@ -107,13 +108,27 @@ To change its layout, create: APP/views/layouts/default.ctp.<br />
You can also add some CSS styles for your pages at: APP/webroot/css.');
?>
</p>
<h3><?php __('Getting Started'); ?></h3>
<p>
<a href="http://book.cakephp.org"><strong>new</strong> CakePHP 1.2 Docs</a>
<?php
echo $this->Html->link(
sprintf('<strong>%s</strong>%s', __('new', true ), __('CakePHP 1.2 Docs', true )),
'http://book.cakephp.org',
array('target' => '_blank', 'escape' => false)
);
?>
</p>
<p>
<a href="http://book.cakephp.org/view/219/the-cakephp-blog-tutorial"><?php __('The 15 min Blog Tutorial'); ?></a><br />
<?php
echo $this->Html->link(
__('The 15 min Blog Tutorial', true),
'http://book.cakephp.org/view/219/the-cakephp-blog-tutorial',
array('target' => '_blank', 'escape' => false)
);
?>
</p>
<h3><?php __('More about Cake'); ?></h3>
<p>
<?php __('CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.'); ?>
@ -121,7 +136,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
<p>
<?php __('Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.'); ?>
</p>
<br />
<ul>
<li><a href="http://www.cakefoundation.org/"><?php __('Cake Software Foundation'); ?> </a>
<ul><li><?php __('Promoting development related to CakePHP'); ?></li></ul></li>
@ -139,7 +154,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
<ul><li><?php __('Community mailing list'); ?></li></ul></li>
<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
<ul><li><?php __('Live chat about CakePHP'); ?></li></ul></li>
<li><a href="https://code.cakephp.org/"><?php __('CakePHP Code'); ?> </a>
<li><a href="http://code.cakephp.org/"><?php __('CakePHP Code'); ?> </a>
<ul><li><?php __('For the Development of CakePHP (Tickets, Git browser, Roadmap, Changelogs)'); ?></li></ul></li>
<li><a href="http://www.cakeforge.org"><?php __('CakeForge'); ?> </a>
<ul><li><?php __('Open Development for CakePHP'); ?></li></ul></li>

View file

@ -95,7 +95,7 @@ class ApiShellTest extends CakeTestCase {
'3. beforeRender()',
'4. constructClasses()',
'5. disableCache()',
'6. flash($message, $url, $pause = 1)',
'6. flash($message, $url, $pause = 1, $layout = \'flash\')',
'7. header($status)',
'8. isAuthorized()',
'9. loadModel($modelClass = null, $id = null)',

View file

@ -1,6 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* TestTaskTest file
* ModelTaskTest file
*
* Test Case for test generation shell task
*
@ -17,7 +18,7 @@
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
* @since CakePHP v 1.3
* @since CakePHP v 1.2.6
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Shell', 'Shell', false);
@ -37,12 +38,10 @@ require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php';
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'fixture.php';
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
Mock::generatePartial(
'ShellDispatcher', 'TestModelTaskMockShellDispatcher',
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
);
Mock::generatePartial(
'ModelTask', 'MockModelTask',
array('in', 'out', 'err', 'createFile', '_stop', '_checkUnitTest')
@ -217,9 +216,9 @@ class ModelTaskTest extends CakeTestCase {
function testInteractiveFieldValidation() {
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->setReturnValueAt(0, 'in', '20');
$this->Task->setReturnValueAt(0, 'in', '19');
$this->Task->setReturnValueAt(1, 'in', 'y');
$this->Task->setReturnValueAt(2, 'in', '16');
$this->Task->setReturnValueAt(2, 'in', '15');
$this->Task->setReturnValueAt(3, 'in', 'n');
$result = $this->Task->fieldValidation('text', array('type' => 'string', 'length' => 10, 'null' => false));

View file

@ -84,6 +84,7 @@ class CakeTestCaseTest extends CakeTestCase {
* @return void
*/
function setUp() {
$this->_debug = Configure::read('debug');
$this->Case =& new SubjectCakeTestCase();
$reporter =& new MockCakeHtmlReporter();
$this->Case->setReporter($reporter);
@ -97,6 +98,7 @@ class CakeTestCaseTest extends CakeTestCase {
* @return void
*/
function tearDown() {
Configure::write('debug', $this->_debug);
unset($this->Case);
unset($this->Reporter);
}

View file

@ -89,7 +89,7 @@ class CodeCoverageManagerTest extends CakeTestCase {
App::import('Core', 'Folder');
$folder = new Folder();
$folder->cd($path);
$contents = $folder->ls();
$contents = $folder->read();
/**
* remove method

View file

@ -389,6 +389,7 @@ class ComponentTest extends CakeTestCase {
function testNestedComponentLoading() {
$Controller =& new ComponentTestController();
$Controller->components = array('Apple');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@ -409,6 +410,7 @@ class ComponentTest extends CakeTestCase {
function testComponentStartup() {
$Controller =& new ComponentTestController();
$Controller->components = array('Apple');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
$Controller->beforeFilter();
@ -429,6 +431,7 @@ class ComponentTest extends CakeTestCase {
*/
function testMultipleComponentInitialize() {
$Controller =& new ComponentTestController();
$Controller->uses = false;
$Controller->components = array('Orange', 'Banana');
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@ -450,7 +453,7 @@ class ComponentTest extends CakeTestCase {
$Controller =& new ComponentTestController();
$Controller->components = array('ParamTest' => array('test' => 'value', 'flag'), 'Apple');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@ -482,8 +485,12 @@ class ComponentTest extends CakeTestCase {
* @return void
**/
function testComponentParamsNoDuplication() {
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
return;
}
$Controller =& new ComponentTestController();
$Controller->components = array('Orange' => array('setting' => array('itemx')));
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@ -499,6 +506,7 @@ class ComponentTest extends CakeTestCase {
function testMutuallyReferencingComponents() {
$Controller =& new ComponentTestController();
$Controller->components = array('MutuallyReferencingOne');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
@ -524,6 +532,7 @@ class ComponentTest extends CakeTestCase {
function testSomethingReferencingEmailComponent() {
$Controller =& new ComponentTestController();
$Controller->components = array('SomethingWithEmail');
$Controller->uses = false;
$Controller->constructClasses();
$Controller->Component->initialize($Controller);
$Controller->beforeFilter();
@ -550,14 +559,17 @@ class ComponentTest extends CakeTestCase {
* @access public
*/
function testDoubleLoadingOfSessionComponent() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController');
if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
return;
}
$Controller =& new ComponentTestController();
$Controller->uses = array();
$Controller->uses = false;
$Controller->components = array('Session');
$Controller->constructClasses();
$this->assertEqual($Controller->components, array('Session' => '', 'Orange' => array('colour' => 'blood orange')));
}
}
?>

View file

@ -408,8 +408,6 @@ HEADBLOC;
This is the body of the message
This email was sent using the CakePHP Framework, http://cakephp.org.
TEXTBLOC;
$html = <<<HTMLBLOC
@ -417,7 +415,7 @@ TEXTBLOC;
<html>
<head>
<title>EmailTest</title>
<title>Email Test</title>
</head>
<body>
@ -425,7 +423,6 @@ TEXTBLOC;
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
</body>
</html>
HTMLBLOC;
$this->Controller->EmailTest->sendAs = 'text';
@ -452,7 +449,7 @@ HTMLBLOC;
<html>
<head>
<title>EmailTest</title>
<title>Email Test</title>
</head>
<body>
@ -477,8 +474,6 @@ standards.
This is the body of the message
This email was sent using the CakePHP Framework, http://cakephp.org.
TEXTBLOC;
$this->Controller->EmailTest->sendAs = 'text';

View file

@ -561,7 +561,9 @@ class RequestHandlerComponentTest extends CakeTestCase {
function testAjaxRedirectAsRequestAction() {
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$this->_init();
App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)));
App::build(array(
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
), true);
$this->Controller->RequestHandler = new NoStopRequestHandler($this);
$this->Controller->RequestHandler->expectOnce('_stop');
@ -574,6 +576,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
$this->assertPattern('/posts index/', $result, 'RequestAction redirect failed.');
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
App::build();
}
}
?>

View file

@ -222,6 +222,7 @@ class SecurityComponentTest extends CakeTestCase {
* @return void
*/
function testRequireSecureFail() {
$_SERVER['HTTPS'] = 'off';
$_SERVER['REQUEST_METHOD'] = 'POST';
$this->Controller->action = 'posted';
$this->Controller->Security->requireSecure('posted');

View file

@ -772,7 +772,9 @@ class ControllerTest extends CakeTestCase {
* @return void
*/
function testRender() {
App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)));
App::build(array(
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
), true);
$Controller =& new Controller();
$Controller->viewPath = 'posts';
@ -797,6 +799,7 @@ class ControllerTest extends CakeTestCase {
$Controller->ControllerComment->validationErrors = array();
ClassRegistry::flush();
App::build();
}
/**

View file

@ -131,7 +131,14 @@ class MergePostsController extends MergeVarPluginAppController {
* @package cake.tests.cases.libs.controller
**/
class ControllerMergeVarsTestCase extends CakeTestCase {
/**
* Skips the case if APP_CONTROLLER_EXISTS is defined
*
* @return void
**/
function skip() {
$this->skipIf(defined('APP_CONTROLLER_EXISTS'), 'APP_CONTROLLER_EXISTS cannot run. %s');
}
/**
* end test
*

View file

@ -286,6 +286,7 @@ class DebuggerTest extends CakeTestCase {
Debugger::log(array('whatever', 'here'));
$result = file_get_contents(TMP . 'logs' . DS . 'debug.log');
$this->assertPattern('/DebuggerTest\:\:testLog/', $result);
$this->assertPattern('/\[main\]/', $result);
$this->assertPattern('/array/', $result);
$this->assertPattern('/"whatever",/', $result);
$this->assertPattern('/"here"/', $result);

View file

@ -219,6 +219,18 @@ class FolderTest extends CakeTestCase {
$this->assertTrue($result);
}
/**
* test Adding path elements to a path
*
* @return void
**/
function testAddPathElement() {
$result = Folder::addPathElement(DS . 'some' . DS . 'dir', 'another_path');
$this->assertEqual($result, DS . 'some' . DS . 'dir' . DS . 'another_path');
$result = Folder::addPathElement(DS . 'some' . DS . 'dir' . DS, 'another_path');
$this->assertEqual($result, DS . 'some' . DS . 'dir' . DS . 'another_path');
}
/**
* testFolderRead method
*

View file

@ -1026,6 +1026,28 @@ class HttpSocketTest extends CakeTestCase {
'host' => 'www.google.com',
'port' => 8080,
));
$uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1&param2=value2%3Dvalue3');
$this->assertIdentical($uri, array(
'scheme' => 'http',
'host' => 'www.cakephp.org',
'path' => '/',
'query' => array(
'param1' => 'value1',
'param2' => 'value2=value3'
)
));
$uri = $this->Socket->parseUri('http://www.cakephp.org/?param1=value1&param2=value2=value3');
$this->assertIdentical($uri, array(
'scheme' => 'http',
'host' => 'www.cakephp.org',
'path' => '/',
'query' => array(
'param1' => 'value1',
'param2' => 'value2=value3'
)
));
}
/**

View file

@ -2603,7 +2603,7 @@ class I18nTest extends CakeTestCase {
* @access private
* @return void
*/
function __domainCategorySingular($domain = 'test_plugin', $category = LC_MONETARY) {
function __domainCategorySingular($domain = 'test_plugin', $category = 3) {
$singular = __dc($domain, 'Plural Rule 1', $category, true);
return $singular;
}
@ -2614,7 +2614,7 @@ class I18nTest extends CakeTestCase {
* @access private
* @return void
*/
function __domainCategoryPlural($domain = 'test_plugin', $category = LC_MONETARY) {
function __domainCategoryPlural($domain = 'test_plugin', $category = 3) {
$plurals = array();
for ($number = 0; $number <= 25; $number++) {
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category, true), (float)$number);
@ -2653,7 +2653,7 @@ class I18nTest extends CakeTestCase {
* @access private
* @return void
*/
function __category($category = LC_MONETARY) {
function __category($category = 3) {
$singular = __c('Plural Rule 1', $category, true);
return $singular;
}

View file

@ -1220,6 +1220,25 @@ class NumberTreeTest extends CakeTestCase {
$this->assertIdentical($nodes, $sortedNodes);
}
/**
* test reordering large-ish trees with cacheQueries = true.
* This caused infinite loops when moving down elements as stale data is returned
* from the memory cache
*
* @access public
* @return void
*/
function testReorderBigTreeWithQueryCaching() {
extract($this->settings);
$this->Tree =& new $modelClass();
$this->Tree->initialize(2, 10);
$original = $this->Tree->cacheQueries;
$this->Tree->cacheQueries = true;
$this->Tree->reorder(array('field' => 'name', 'direction' => 'DESC'));
$this->assertTrue($this->Tree->cacheQueries, 'cacheQueries was not restored after reorder(). %s');
$this->Tree->cacheQueries = $original;
}
/**
* testGenerateTreeListWithSelfJoin method
*

View file

@ -161,7 +161,7 @@ class MysqlTestModel extends Model {
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMysqlTest extends CakeTestCase {
var $fixtures = array('core.binary_test');
/**
* The Dbo instance to be tested
*
@ -187,7 +187,6 @@ class DboMysqlTest extends CakeTestCase {
*/
function startTest() {
$db = ConnectionManager::getDataSource('test_suite');
$this->db = new DboMysqlTestDb($db->config);
$this->model = new MysqlTestModel();
}
@ -196,8 +195,9 @@ class DboMysqlTest extends CakeTestCase {
*
* @access public
*/
function endTest() {
unset($this->db);
function tearDown() {
unset($this->model);
ClassRegistry::flush();
}
/**
@ -285,11 +285,11 @@ class DboMysqlTest extends CakeTestCase {
* @return void
*/
function testTinyintCasting() {
$this->db->cacheSources = $this->db->testing = false;
$this->db->cacheSources = false;
$this->db->query('CREATE TABLE ' . $this->db->fullTableName('tinyint') . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$this->model = new CakeTestModel(array(
'name' => 'Tinyint', 'table' => $this->db->fullTableName('tinyint', false)
'name' => 'Tinyint', 'table' => 'tinyint', 'ds' => 'test_suite'
));
$result = $this->model->schema();
@ -324,12 +324,12 @@ class DboMysqlTest extends CakeTestCase {
* @access public
*/
function testIndexDetection() {
$this->db->cacheSources = $this->db->testing = false;
$this->db->cacheSources = false;
$name = $this->db->fullTableName('simple');
$this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
$expected = array('PRIMARY' => array('column' => 'id', 'unique' => 1));
$result = $this->db->index($name, false);
$result = $this->db->index('simple', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@ -339,7 +339,7 @@ class DboMysqlTest extends CakeTestCase {
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
);
$result = $this->db->index($name, false);
$result = $this->db->index('with_a_key', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@ -350,7 +350,7 @@ class DboMysqlTest extends CakeTestCase {
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
);
$result = $this->db->index($name, false);
$result = $this->db->index('with_two_keys', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@ -362,7 +362,7 @@ class DboMysqlTest extends CakeTestCase {
'pointless_small_int' => array('column' => 'small_int', 'unique' => 0),
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
);
$result = $this->db->index($name, false);
$result = $this->db->index('with_compound_keys', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
@ -375,7 +375,7 @@ class DboMysqlTest extends CakeTestCase {
'one_way' => array('column' => array('bool', 'small_int'), 'unique' => 0),
'other_way' => array('column' => array('small_int', 'bool'), 'unique' => 0),
);
$result = $this->db->index($name, false);
$result = $this->db->index('with_multiple_compound_keys', false);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
}
@ -628,6 +628,24 @@ class DboMysqlTest extends CakeTestCase {
$this->db->query($this->db->dropSchema($schema1));
}
/**
* test saving and retrieval of blobs
*
* @return void
**/
function testBlobSaving() {
$this->db->cacheSources = false;
$data = "GIF87ab
Ò4A¿¿¿ˇˇˇ,b
¢îè©ÀÌ#¥⁄ã≥fi:¯Üá¶jV∂ÓúÎL≥çÀóËıÎ…>ï vFE%ÒâLFI<†µw˝±≈£7˘ç^H“≤« >Éâ*∑ÇnÖA•Ù|flêèj£:=ÿ6óUàµ5'∂®àA¬ñ∆ˆGE(gt≈àÚyÁó«7 VìöÇ√˙Ç™
k”:;kÀAõ{*¡€Î˚˚[;;";
$model =& new AppModel(array('name' => 'BinaryTest', 'ds' => 'test_suite'));
$model->save(compact('data'));
$result = $model->find('first');
$this->assertEqual($result['BinaryTest']['data'], $data);
}
/**
* test altering the table settings with schema.

View file

@ -139,7 +139,7 @@ class MysqliTestModel extends Model {
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMysqliTest extends CakeTestCase {
var $fixtures = array('core.datatype');
/**
* The Dbo instance to be tested
*
@ -164,8 +164,6 @@ class DboMysqliTest extends CakeTestCase {
* @access public
*/
function setUp() {
$db = ConnectionManager::getDataSource('test_suite');
$this->db = new DboMysqliTestDb($db->config);
$this->model = new MysqliTestModel();
}
@ -175,7 +173,8 @@ class DboMysqliTest extends CakeTestCase {
* @access public
*/
function tearDown() {
unset($this->db);
unset($this->model);
ClassRegistry::flush();
}
/**
@ -185,7 +184,7 @@ class DboMysqliTest extends CakeTestCase {
* @access public
*/
function testIndexDetection() {
$this->db->cacheSources = $this->db->testing = false;
$this->db->cacheSources = false;
$name = $this->db->fullTableName('simple');
$this->db->query('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id));');
@ -306,6 +305,16 @@ class DboMysqliTest extends CakeTestCase {
$result = $this->db->commit($this->model);
$this->assertTrue($result);
}
/**
* test that float values are correctly identified
*
* @return void
**/
function testFloatParsing() {
$model =& new Model(array('ds' => 'test_suite', 'table' => 'datatypes', 'name' => 'Datatype'));
$result = $this->db->describe($model);
$this->assertEqual((string)$result['float_field']['length'], '5,2');
}
/**
* test that tableParameters like collation, charset and engine are functioning.

View file

@ -315,11 +315,11 @@ class DboPostgresTest extends CakeTestCase {
}
/**
* test that date columns do not generate errors with null and nullish values.
* test that date and time columns do not generate errors with null and nullish values.
*
* @return void
**/
function testDateAsNull() {
function testDateAndTimeAsNull() {
$this->assertEqual($this->db2->value(null, 'date'), 'NULL');
$this->assertEqual($this->db2->value('', 'date'), 'NULL');
@ -328,6 +328,9 @@ class DboPostgresTest extends CakeTestCase {
$this->assertEqual($this->db2->value('', 'timestamp'), 'NULL');
$this->assertEqual($this->db2->value(null, 'timestamp'), 'NULL');
$this->assertEqual($this->db2->value('', 'time'), 'NULL');
$this->assertEqual($this->db2->value(null, 'time'), 'NULL');
}
/**

View file

@ -7151,5 +7151,18 @@ class ModelReadTest extends BaseModelTest {
);
$this->assertEqual($result, $expected);
}
/**
* Testing availability of $this->findQueryType in Model callbacks
*
* @return void
*/
function testFindQueryTypeInCallbacks() {
$this->loadFixtures('Comment');
$Comment =& new AgainModifiedComment();
$comments = $Comment->find('all');
$this->assertEqual($comments[0]['Comment']['querytype'], 'all');
$comments = $Comment->find('first');
$this->assertEqual($comments['Comment']['querytype'], 'first');
}
}
?>

View file

@ -557,6 +557,51 @@ class ModifiedComment extends CakeTestModel {
}
}
/**
* Modified Comment Class has afterFind Callback
*
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class AgainModifiedComment extends CakeTestModel {
/**
* name property
*
* @var string 'Comment'
* @access public
*/
var $name = 'Comment';
/**
* useTable property
*
* @var string 'comments'
* @access public
*/
var $useTable = 'comments';
/**
* belongsTo property
*
* @var array
* @access public
*/
var $belongsTo = array('Article');
/**
* afterFind callback
*
* @return void
**/
function afterFind($results) {
if (isset($results[0])) {
$results[0]['Comment']['querytype'] = $this->findQueryType;
}
return $results;
}
}
/**
* MergeVarPluginAppModel class
*

View file

@ -4805,6 +4805,10 @@ class MultibyteTest extends CakeTestCase {
* @return void
*/
function testUsingMbStrrpos() {
$skip = extension_loaded('mbstring') && version_compare(PHP_VERSION, '5.2.0', '<');
if ($this->skipIf($skip, '%s PHP version does not support $offset parameter in mb_strrpos().')) {
return;
}
$string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$find = 'F';
$result = mb_strrpos($string, $find);

View file

@ -71,6 +71,11 @@ class StringTest extends CakeTestCase {
* @return void
*/
function testInsert() {
$string = 'some string';
$expected = 'some string';
$result = String::insert($string, array());
$this->assertEqual($result, $expected);
$string = '2 + 2 = :sum. Cake is :adjective.';
$expected = '2 + 2 = 4. Cake is yummy.';
$result = String::insert($string, array('sum' => '4', 'adjective' => 'yummy'));

View file

@ -1641,6 +1641,10 @@ class ValidationTest extends CakeTestCase {
* @return void
*/
function testEmailDeep() {
$found = gethostbynamel('example.abcd');
if ($this->skipIf($found, 'Your DNS service responds for non-existant domains, skipping deep email checks. %s')) {
return;
}
$this->assertTrue(Validation::email('abc.efg@cakephp.org', true));
$this->assertFalse(Validation::email('abc.efg@caphpkeinvalid.com', true));
$this->assertFalse(Validation::email('abc@example.abcd', true));

View file

@ -538,11 +538,11 @@ class HelperTest extends CakeTestCase {
*/
function testMulitDimensionValue() {
$this->Helper->data = array();
for($i = 0; $i < 2; $i++) {
for ($i = 0; $i < 2; $i++) {
$this->Helper->data['Model'][$i] = 'what';
$result[] = $this->Helper->value("Model.{$i}");
$this->Helper->data['Model'][$i] = array();
for($j = 0; $j < 2; $j++) {
for ($j = 0; $j < 2; $j++) {
$this->Helper->data['Model'][$i][$j] = 'how';
$result[] = $this->Helper->value("Model.{$i}.{$j}");
}

View file

@ -165,6 +165,12 @@ class AjaxHelperTest extends CakeTestCase {
$view =& new View(new AjaxTestController());
ClassRegistry::addObject('view', $view);
ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest());
$this->Ajax->Form->params = array(
'plugin' => null,
'action' => 'view',
'controller' => 'users'
);
}
/**
* tearDown method

View file

@ -1591,50 +1591,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$result = $this->Form->input('email', array(
'options' => array('è' => 'Firést', 'é' => 'Secoènd'), 'empty' => true)
);
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'email'),
'Email',
'/label',
array('select' => array('name' => 'data[email]', 'id' => 'email')),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => 'è')),
'Firést',
'/option',
array('option' => array('value' => 'é')),
'Secoènd',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('email', array(
'options' => array('First', 'Second'), 'empty' => true)
);
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'email'),
'Email',
'/label',
array('select' => array('name' => 'data[email]', 'id' => 'email')),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => '0')),
'First',
'/option',
array('option' => array('value' => '1')),
'Second',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.email', array(
'type' => 'file', 'class' => 'textbox'
));
@ -1651,84 +1607,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Model.field', array(
'type' => 'time', 'timeFormat' => 24, 'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$result = $this->Form->input('Model.field', array(
'type' => 'time', 'timeFormat' => 12, 'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$result = $this->Form->input('prueba', array(
'type' => 'time', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
'maxYear' => date('Y') + 1 ,'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$this->assertPattern('#<option value="30"[^>]*>30</option>#', $result[1]);
$result = $this->Form->input('prueba', array(
'type' => 'datetime', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
'maxYear' => date('Y') + 1 ,'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$this->assertPattern('#<option value="30"[^>]*>30</option>#', $result[1]);
//related to ticket #5013
$result = $this->Form->input('Contact.date', array(
'type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'
));
$this->assertPattern('/class="customClass"/', $result);
$this->assertPattern('/onChange="function\(\)\{\}"/', $result);
$result = $this->Form->input('Contact.date', array(
'type' => 'date', 'id' => 'customId', 'onChange' => 'function(){}'
));
$this->assertPattern('/id="customIdDay"/', $result);
$this->assertPattern('/id="customIdMonth"/', $result);
$this->assertPattern('/onChange="function\(\)\{\}"/', $result);
$result = $this->Form->input('Model.field', array(
'type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'
));
$this->assertPattern('/id="customIDDay"/', $result);
$this->assertPattern('/id="customIDHour"/', $result);
$result = explode('</select><select', $result);
$result = explode(':', $result[1]);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Model.field', array(
'type' => 'datetime', 'timeFormat' => 12
));
$result = explode('</select><select', $result);
$result = explode(':', $result[1]);
$this->assertPattern('/option value="12"/', $result[0]);
$this->assertNoPattern('/option value="13"/', $result[0]);
$this->Form->data = array('Contact' => array('phone' => 'Hello & World > weird chars'));
$result = $this->Form->input('Contact.phone');
$expected = array(
@ -1745,7 +1623,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Form->data['Model']['0']['OtherModel']['field'] = 'My value';
$result = $this->Form->input('Model.0.OtherModel.field', array('id' => 'myId'));
$expected = array(
@ -1862,6 +1739,207 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Form->validationErrors['Model']['field'] = 'minLength';
$result = $this->Form->input('Model.field', array('error' => array('minLength' => __('Le login doit contenir au moins 2 caractères', true))));
$expected = array(
'div' => array('class' => 'input text error'),
'label' => array('for' => 'ModelField'),
'Field',
'/label',
'input' => array('type' => 'text', 'name' => 'data[Model][field]', 'value' => '', 'id' => 'ModelField', 'class' => 'form-error'),
array('div' => array('class' => 'error-message')),
'Le login doit contenir au moins 2 caractères',
'/div',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* test form->input() with datetime, date and time types
*
* @return void
**/
function testInputDatetime() {
extract($this->dateRegex);
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Contact.created', array('type' => 'time', 'timeFormat' => 24));
$result = explode(':', $result);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Model.field', array(
'type' => 'time', 'timeFormat' => 24, 'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$result = $this->Form->input('Model.field', array(
'type' => 'time', 'timeFormat' => 12, 'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$result = $this->Form->input('prueba', array(
'type' => 'time', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
'maxYear' => date('Y') + 1 ,'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$this->assertPattern('#<option value="30"[^>]*>30</option>#', $result[1]);
$result = $this->Form->input('prueba', array(
'type' => 'datetime', 'timeFormat'=> 24 , 'dateFormat'=>'DMY' , 'minYear' => 2008,
'maxYear' => date('Y') + 1 ,'interval' => 15
));
$result = explode(':', $result);
$this->assertNoPattern('#<option value="12"[^>]*>12</option>#', $result[1]);
$this->assertNoPattern('#<option value="50"[^>]*>50</option>#', $result[1]);
$this->assertPattern('#<option value="15"[^>]*>15</option>#', $result[1]);
$this->assertPattern('#<option value="30"[^>]*>30</option>#', $result[1]);
//related to ticket #5013
$result = $this->Form->input('Contact.date', array(
'type' => 'date', 'class' => 'customClass', 'onChange' => 'function(){}'
));
$this->assertPattern('/class="customClass"/', $result);
$this->assertPattern('/onChange="function\(\)\{\}"/', $result);
$result = $this->Form->input('Contact.date', array(
'type' => 'date', 'id' => 'customId', 'onChange' => 'function(){}'
));
$this->assertPattern('/id="customIdDay"/', $result);
$this->assertPattern('/id="customIdMonth"/', $result);
$this->assertPattern('/onChange="function\(\)\{\}"/', $result);
$result = $this->Form->input('Model.field', array(
'type' => 'datetime', 'timeFormat' => 24, 'id' => 'customID'
));
$this->assertPattern('/id="customIDDay"/', $result);
$this->assertPattern('/id="customIDHour"/', $result);
$result = explode('</select><select', $result);
$result = explode(':', $result[1]);
$this->assertPattern('/option value="23"/', $result[0]);
$this->assertNoPattern('/option value="24"/', $result[0]);
$result = $this->Form->input('Model.field', array(
'type' => 'datetime', 'timeFormat' => 12
));
$result = explode('</select><select', $result);
$result = explode(':', $result[1]);
$this->assertPattern('/option value="12"/', $result[0]);
$this->assertNoPattern('/option value="13"/', $result[0]);
$this->Form->data = array('Contact' => array('created' => null));
$result = $this->Form->input('Contact.created', array('empty' => 'Date Unknown'));
$expected = array(
'div' => array('class' => 'input date'),
'label' => array('for' => 'ContactCreatedMonth'),
'Created',
'/label',
array('select' => array('name' => 'data[Contact][created][month]', 'id' => 'ContactCreatedMonth')),
array('option' => array('value' => '')), 'Date Unknown', '/option',
$monthsRegex,
'/select', '-',
array('select' => array('name' => 'data[Contact][created][day]', 'id' => 'ContactCreatedDay')),
array('option' => array('value' => '')), 'Date Unknown', '/option',
$daysRegex,
'/select', '-',
array('select' => array('name' => 'data[Contact][created][year]', 'id' => 'ContactCreatedYear')),
array('option' => array('value' => '')), 'Date Unknown', '/option',
$yearsRegex,
'/select',
'/div'
);
$this->assertTags($result, $expected);
$this->Form->data = array('Contact' => array('created' => null));
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'dateFormat' => 'NONE'));
$this->assertPattern('/for\="ContactCreatedHour"/', $result);
$this->Form->data = array('Contact' => array('created' => null));
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'timeFormat' => 'NONE'));
$this->assertPattern('/for\="ContactCreatedMonth"/', $result);
}
/**
* Test generating checkboxes in a loop.
*
* @return void
**/
function testInputCheckboxesInLoop() {
for ($i = 1; $i < 5; $i++) {
$result = $this->Form->input("Contact.{$i}.email", array('type' => 'checkbox', 'value' => $i));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => "data[Contact][{$i}][email]", 'value' => '0', 'id' => "Contact{$i}Email_"),
array('input' => array('type' => 'checkbox', 'name' => "data[Contact][{$i}][email]", 'value' => $i, 'id' => "Contact{$i}Email")),
'label' => array('for' => "Contact{$i}Email"),
'Email',
'/label',
'/div'
);
$this->assertTags($result, $expected);
}
}
/**
* test form->input() with select type inputs.
*
* @return void
**/
function testInputSelectType() {
$result = $this->Form->input('email', array(
'options' => array('è' => 'Firést', 'é' => 'Secoènd'), 'empty' => true)
);
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'email'),
'Email',
'/label',
array('select' => array('name' => 'data[email]', 'id' => 'email')),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => 'è')),
'Firést',
'/option',
array('option' => array('value' => 'é')),
'Secoènd',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$result = $this->Form->input('email', array(
'options' => array('First', 'Second'), 'empty' => true)
);
$expected = array(
'div' => array('class' => 'input select'),
'label' => array('for' => 'email'),
'Email',
'/label',
array('select' => array('name' => 'data[email]', 'id' => 'email')),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => '0')),
'First',
'/option',
array('option' => array('value' => '1')),
'Second',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$this->Form->data = array('Model' => array('user_id' => 'value'));
$view =& ClassRegistry::getObject('view');
$view->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
@ -1933,33 +2011,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
extract($this->dateRegex);
$this->Form->data = array('Contact' => array('created' => null));
$view =& ClassRegistry::getObject('view');
$view->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$result = $this->Form->input('Contact.created', array('empty' => 'Date Unknown'));
$expected = array(
'div' => array('class' => 'input date'),
'label' => array('for' => 'ContactCreatedMonth'),
'Created',
'/label',
array('select' => array('name' => 'data[Contact][created][month]', 'id' => 'ContactCreatedMonth')),
array('option' => array('value' => '')), 'Date Unknown', '/option',
$monthsRegex,
'/select', '-',
array('select' => array('name' => 'data[Contact][created][day]', 'id' => 'ContactCreatedDay')),
array('option' => array('value' => '')), 'Date Unknown', '/option',
$daysRegex,
'/select', '-',
array('select' => array('name' => 'data[Contact][created][year]', 'id' => 'ContactCreatedYear')),
array('option' => array('value' => '')), 'Date Unknown', '/option',
$yearsRegex,
'/select',
'/div'
);
$this->assertTags($result, $expected);
$this->Form->data = array('User' => array('User' => array('value')));
$view =& ClassRegistry::getObject('view');
$view->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
@ -1983,35 +2034,6 @@ class FormHelperTest extends CakeTestCase {
'/div'
);
$this->assertTags($result, $expected);
$this->Form->validationErrors['Model']['field'] = 'minLength';
$result = $this->Form->input('Model.field', array('error' => array('minLength' => __('Le login doit contenir au moins 2 caractères', true))));
$expected = array(
'div' => array('class' => 'input text error'),
'label' => array('for' => 'ModelField'),
'Field',
'/label',
'input' => array('type' => 'text', 'name' => 'data[Model][field]', 'value' => '', 'id' => 'ModelField', 'class' => 'form-error'),
array('div' => array('class' => 'error-message')),
'Le login doit contenir au moins 2 caractères',
'/div',
'/div'
);
$this->assertTags($result, $expected);
for ($i = 1; $i < 5; $i++) {
$result = $this->Form->input("Contact.{$i}.email", array('type' => 'checkbox', 'value' => $i));
$expected = array(
'div' => array('class' => 'input checkbox'),
'input' => array('type' => 'hidden', 'name' => "data[Contact][{$i}][email]", 'value' => '0', 'id' => "Contact{$i}Email_"),
array('input' => array('type' => 'checkbox', 'name' => "data[Contact][{$i}][email]", 'value' => $i, 'id' => "Contact{$i}Email")),
'label' => array('for' => "Contact{$i}Email"),
'Email',
'/label',
'/div'
);
$this->assertTags($result, $expected);
}
}
/**
@ -2831,6 +2853,23 @@ class FormHelperTest extends CakeTestCase {
'/select'
);
$this->assertTags($result, $expected);
$this->Form->data = array('Model' => array('contact_id' => 228));
$result = $this->Form->select(
'Model.contact_id',
array('228' => '228 value', '228-1' => '228-1 value', '228-2' => '228-2 value'),
null, array('escape' => false, 'empty' => 'pick something')
);
$expected = array(
'select' => array('name' => 'data[Model][contact_id]', 'id' => 'ModelContactId'),
array('option' => array('value' => '')), 'pick something', '/option',
array('option' => array('value' => '228', 'selected' => 'selected')), '228 value', '/option',
array('option' => array('value' => '228-1')), '228-1 value', '/option',
array('option' => array('value' => '228-2')), '228-2 value', '/option',
'/select'
);
$this->assertTags($result, $expected);
}
/**
@ -3000,6 +3039,55 @@ class FormHelperTest extends CakeTestCase {
$this->assertTags($result, $expected);
}
/**
* test generation of habtm select boxes.
*
* @return void
**/
function testHabtmSelectBox() {
$view =& ClassRegistry::getObject('view');
$view->viewVars['contactTags'] = array(
1 => 'blue',
2 => 'red',
3 => 'green'
);
$this->Form->data = array(
'Contact' => array(),
'ContactTag' => array(
array(
'id' => 1,
'name' => 'blue'
),
array(
'id' => 3,
'name' => 'green'
)
)
);
$this->Form->create('Contact');
$result = $this->Form->input('ContactTag', array('div' => false, 'label' => false));
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[ContactTag][ContactTag]', 'value' => ''
),
'select' => array(
'name' => 'data[ContactTag][ContactTag][]', 'id' => 'ContactTagContactTag',
'multiple' => 'multiple'
),
array('option' => array('value' => '1', 'selected' => 'selected')),
'blue',
'/option',
array('option' => array('value' => '2')),
'red',
'/option',
array('option' => array('value' => '3', 'selected' => 'selected')),
'green',
'/option',
'/select'
);
$this->assertTags($result, $expected);
}
/**
* test generation of multi select elements in checkbox format
*

View file

@ -235,7 +235,7 @@ class JavascriptTest extends CakeTestCase {
* @return void
*/
function testFilteringAndTimestamping() {
if($this->skipIf(!is_writable(JS), "%s JavaScript directory not writable, skipping JS asset timestamp tests.")) {
if ($this->skipIf(!is_writable(JS), 'JavaScript directory not writable, skipping JS asset timestamp tests. %s')) {
return;
}

View file

@ -488,57 +488,19 @@ class TimeHelperTest extends CakeTestCase {
* @return void
*/
function testIsThisWeek() {
switch (date('D')) {
case 'Mon' :
for ($i = 0; $i < 6; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+7 days"));
$this->assertFalse($this->Time->isThisWeek("-1 days"));
break;
case 'Tue' :
for ($i = -1; $i < 5; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+6 days"));
$this->assertFalse($this->Time->isThisWeek("-2 days"));
break;
case 'Wed' :
for ($i = -2; $i < 5; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+5 days"));
$this->assertFalse($this->Time->isThisWeek("-3 days"));
break;
case 'Thu' :
for ($i = -3; $i < 4; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+4 days"));
$this->assertFalse($this->Time->isThisWeek("-4 days"));
break;
case 'Fri' :
for ($i = -4; $i < 3; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+3 days"));
$this->assertFalse($this->Time->isThisWeek("-5 days"));
break;
case 'Sat' :
for ($i = -5; $i < 2; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+2 days"));
$this->assertFalse($this->Time->isThisWeek("-6 days"));
break;
case 'Sun' :
for ($i = -6; $i < 1; $i++) {
$this->assertTrue($this->Time->isThisWeek("+$i days"));
}
$this->assertFalse($this->Time->isThisWeek("+1 days"));
$this->assertFalse($this->Time->isThisWeek("-7 days"));
break;
// A map of days which goes from -1 day of week to +1 day of week
$map = array(
'Mon' => array(-1, 7), 'Tue' => array(-2, 6), 'Wed' => array(-3, 5),
'Thu' => array(-4, 4), 'Fri' => array(-5, 3), 'Sat' => array(-6, 2),
'Sun' => array(-7, 1)
);
$days = $map[date('D')];
for ($day = $days[0] + 1; $day < $days[1]; $day++) {
$this->assertTrue($this->Time->isThisWeek(($day > 0 ? '+' : '') . $day . ' days'));
}
$this->assertFalse($this->Time->isThisWeek($days[0] . ' days'));
$this->assertFalse($this->Time->isThisWeek('+' . $days[1] . ' days'));
}
/**
@ -660,6 +622,11 @@ class TimeHelperTest extends CakeTestCase {
* @return void
*/
function testUserOffset() {
if ($this->skipIf(!class_exists('DateTimeZone'), '%s DateTimeZone class not available.')) {
return;
}
$timezoneServer = new DateTimeZone(date_default_timezone_get());
$timeServer = new DateTime('now', $timezoneServer);
$yourTimezone = $timezoneServer->getOffset($timeServer) / HOUR;

View file

@ -46,7 +46,24 @@ class ConsoleGroupTest extends TestSuite {
* @return void
*/
function ConsoleGroupTest() {
TestManager::addTestCasesFromDirectory($this, CORE_TEST_CASES . DS . 'console');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'cake');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'acl');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'api');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'bake');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'schema');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'shell');
$path = CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS . 'tasks' . DS;
TestManager::addTestFile($this, $path . 'controller');
TestManager::addTestFile($this, $path . 'model');
TestManager::addTestFile($this, $path . 'view');
TestManager::addTestFile($this, $path . 'fixture');
TestManager::addTestFile($this, $path . 'test');
TestManager::addTestFile($this, $path . 'db_config');
TestManager::addTestFile($this, $path . 'plugin');
TestManager::addTestFile($this, $path . 'project');
}
}
?>

View file

@ -35,8 +35,7 @@ class ControllerGroupTest extends TestSuite {
* @var string 'All cake/libs/controller/* (Not yet implemented)'
* @access public
*/
var $label = 'All Controllers and Components';
var $label = 'Component, Controllers, Scaffold test cases.';
/**
* LibControllerGroupTest method
*
@ -44,7 +43,11 @@ class ControllerGroupTest extends TestSuite {
* @return void
*/
function ControllerGroupTest() {
TestManager::addTestCasesFromDirectory($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'controller');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'scaffold');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'pages_controller');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'component');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'controller_merge_vars');
}
}
?>

View file

@ -46,9 +46,9 @@ class LibGroupTest extends TestSuite {
* @return void
*/
function LibGroupTest() {
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'inflector');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'cake_log');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'class_registry');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'inflector');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'overloadable');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'sanitize');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'security');

View file

@ -1,58 +0,0 @@
<?php
/**
* NoDatabaseGroupTest file
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
*
* Licensed under The Open Group Test Suite License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.groups
* @since CakePHP(tm) v 1.2.0.4206
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
/**
* NoDatabaseGroupTest class
*
* This test group will run all test in the cases/libs directory.
*
* @package cake
* @subpackage cake.tests.groups
*/
class NoDatabaseGroupTest extends TestSuite {
/**
* label property
*
* @var string 'All tests without a database connection'
* @access public
*/
var $label = 'All Libs not requiring a database connection';
/**
* NoDatabaseGroupTest method
*
* @access public
* @return void
*/
function NoDatabaseGroupTest() {
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'dispatcher');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'router');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'inflector');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'validation');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'cake_session');
TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'cake_socket');
TestManager::addTestCasesFromDirectory($this, CORE_TEST_CASES . DS . 'libs' . DS . 'view');
}
}
?>