mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Merge branch '1.3-timestamp' into 1.3-misc
This commit is contained in:
commit
bf3fe1f4f6
34 changed files with 677 additions and 243 deletions
0
app/views/pages/empty
Normal file
0
app/views/pages/empty
Normal file
0
app/webroot/files/empty
Normal file
0
app/webroot/files/empty
Normal file
|
@ -490,7 +490,7 @@ if (!function_exists('file_put_contents')) {
|
|||
$expires = strtotime($expires, $now);
|
||||
}
|
||||
|
||||
switch (low($target)) {
|
||||
switch (strtolower($target)) {
|
||||
case 'cache':
|
||||
$filename = CACHE . $path;
|
||||
break;
|
||||
|
|
|
@ -173,8 +173,8 @@ class ApiShell extends Shell {
|
|||
foreach ($commands as $cmd) {
|
||||
$this->out("{$cmd}\n\n");
|
||||
}
|
||||
} elseif (isset($commands[low($this->args[1])])) {
|
||||
$this->out($commands[low($this->args[1])] . "\n\n");
|
||||
} elseif (isset($commands[strtolower($this->args[1])])) {
|
||||
$this->out($commands[strtolower($this->args[1])] . "\n\n");
|
||||
} else {
|
||||
$this->out("Command '" . $this->args[1] . "' not found");
|
||||
}
|
||||
|
|
|
@ -58,18 +58,12 @@ class SchemaShell extends Shell {
|
|||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
$name = null;
|
||||
$name = $file = $path = $connection = null;
|
||||
if (!empty($this->params['name'])) {
|
||||
$name = $this->params['name'];
|
||||
$this->params['file'] = Inflector::underscore($name);
|
||||
}
|
||||
|
||||
$path = null;
|
||||
if (!empty($this->params['path'])) {
|
||||
$path = $this->params['path'];
|
||||
}
|
||||
|
||||
$file = null;
|
||||
$path = $this->_getPath();
|
||||
if (empty($this->params['file'])) {
|
||||
$this->params['file'] = 'schema.php';
|
||||
}
|
||||
|
@ -78,7 +72,6 @@ class SchemaShell extends Shell {
|
|||
}
|
||||
$file = $this->params['file'];
|
||||
|
||||
$connection = null;
|
||||
if (!empty($this->params['connection'])) {
|
||||
$connection = $this->params['connection'];
|
||||
}
|
||||
|
@ -86,6 +79,23 @@ class SchemaShell extends Shell {
|
|||
$this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct path for the params. Uses path, and plugin to find the correct path.
|
||||
* path param takes precedence over any plugins specified.
|
||||
*
|
||||
* @return mixed string to correct path or null.
|
||||
**/
|
||||
function _getPath() {
|
||||
if (!empty($this->params['path'])) {
|
||||
return $this->params['path'];
|
||||
}
|
||||
if (!empty($this->params['plugin'])) {
|
||||
$pluginPath = $this->_pluginPath($this->params['plugin']);
|
||||
return $pluginPath . 'config' . DS . 'schema' . DS;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override main
|
||||
*
|
||||
|
@ -107,7 +117,8 @@ class SchemaShell extends Shell {
|
|||
$this->out($File->read());
|
||||
$this->_stop();
|
||||
} else {
|
||||
$this->err(__('Schema could not be found', true));
|
||||
$file = $this->Schema->path . DS . $this->params['file'];
|
||||
$this->err(sprintf(__('Schema file (%s) could not be found.', true), $file));
|
||||
$this->_stop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class ControllerTask extends Shell {
|
|||
$actions= $this->bakeActions($controller, $admin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($this->args[2]) && $this->args[2] == 'admin') {
|
||||
$admin = $this->Project->getAdmin();
|
||||
if ($admin) {
|
||||
|
@ -294,8 +294,8 @@ class ControllerTask extends Shell {
|
|||
$controllerPath = $this->_controllerPath($controllerName);
|
||||
$pluralName = $this->_pluralName($currentModelName);
|
||||
$singularName = Inflector::variable($currentModelName);
|
||||
$singularHumanName = Inflector::humanize($currentModelName);
|
||||
$pluralHumanName = Inflector::humanize($controllerName);
|
||||
$singularHumanName = $this->_singularHumanName($currentModelName);
|
||||
$pluralHumanName = $this->_pluralName($controllerName);
|
||||
|
||||
$this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName',
|
||||
'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName'));
|
||||
|
|
|
@ -108,7 +108,7 @@ class DbConfigTask extends Shell {
|
|||
$driver = $this->in('Driver:', array('db2', 'firebird', 'mssql', 'mysql', 'mysqli', 'odbc', 'oracle', 'postgres', 'sqlite', 'sybase'), 'mysql');
|
||||
|
||||
$persistent = $this->in('Persistent Connection?', array('y', 'n'), 'n');
|
||||
if (low($persistent) == 'n') {
|
||||
if (strtolower($persistent) == 'n') {
|
||||
$persistent = 'false';
|
||||
} else {
|
||||
$persistent = 'true';
|
||||
|
@ -124,7 +124,7 @@ class DbConfigTask extends Shell {
|
|||
$port = $this->in('Port?', null, 'n');
|
||||
}
|
||||
|
||||
if (low($port) == 'n') {
|
||||
if (strtolower($port) == 'n') {
|
||||
$port = null;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ class DbConfigTask extends Shell {
|
|||
while ($prefix == '') {
|
||||
$prefix = $this->in('Table Prefix?', null, 'n');
|
||||
}
|
||||
if (low($prefix) == 'n') {
|
||||
if (strtolower($prefix) == 'n') {
|
||||
$prefix = null;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ class DbConfigTask extends Shell {
|
|||
while ($encoding == '') {
|
||||
$encoding = $this->in('Table encoding?', null, 'n');
|
||||
}
|
||||
if (low($encoding) == 'n') {
|
||||
if (strtolower($encoding) == 'n') {
|
||||
$encoding = null;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ class DbConfigTask extends Shell {
|
|||
$schema = $this->in('Table schema?', null, 'n');
|
||||
}
|
||||
}
|
||||
if (low($schema) == 'n') {
|
||||
if (strtolower($schema) == 'n') {
|
||||
$schema = null;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ class DbConfigTask extends Shell {
|
|||
$dbConfigs[] = $config;
|
||||
$doneYet = $this->in('Do you wish to add another database configuration?', null, 'n');
|
||||
|
||||
if (low($doneYet == 'n')) {
|
||||
if (strtolower($doneYet == 'n')) {
|
||||
$done = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ class FixtureTask extends Shell {
|
|||
$this->out('Parameters:');
|
||||
$this->out("\t-count When using generated data, the number of records to include in the fixture(s).");
|
||||
$this->out("\t-connection Which database configuration to use for baking.");
|
||||
$this->out("\t-plugin lowercased_underscored name of plugin to bake fixtures for.");
|
||||
$this->out("\t-plugin CamelCased name of plugin to bake fixtures for.");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ class ModelTask extends Shell {
|
|||
$guess = $methods['numeric'];
|
||||
} elseif ($metaData['type'] == 'boolean') {
|
||||
$guess = $methods['boolean'];
|
||||
} elseif ($metaData['type'] == 'datetime' || $metaData['type'] == 'date') {
|
||||
} elseif ($metaData['type'] == 'date') {
|
||||
$guess = $methods['date'];
|
||||
} elseif ($metaData['type'] == 'time') {
|
||||
$guess = $methods['time'];
|
||||
|
@ -614,7 +614,7 @@ class ModelTask extends Shell {
|
|||
$prompt = "{$model->name} {$type} {$associations[$type][$i]['alias']}";
|
||||
$response = $this->in("{$prompt}?", array('y','n'), 'y');
|
||||
|
||||
if ('n' == low($response)) {
|
||||
if ('n' == strtolower($response)) {
|
||||
unset($associations[$type][$i]);
|
||||
} elseif ($type == 'hasMany') {
|
||||
unset($associations['hasOne'][$i]);
|
||||
|
@ -637,7 +637,7 @@ class ModelTask extends Shell {
|
|||
$prompt = __('Would you like to define some additional model associations?', true);
|
||||
$wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n');
|
||||
$possibleKeys = $this->_generatePossibleKeys();
|
||||
while (low($wannaDoMoreAssoc) == 'y') {
|
||||
while (strtolower($wannaDoMoreAssoc) == 'y') {
|
||||
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||
$this->out(__('What is the association type?', true));
|
||||
$assocType = intval($this->inOptions($assocs, __('Enter a number',true)));
|
||||
|
|
|
@ -184,7 +184,7 @@ class ProjectTask extends Shell {
|
|||
function createHome($dir) {
|
||||
$app = basename($dir);
|
||||
$path = $dir . 'views' . DS . 'pages' . DS;
|
||||
$source = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS . 'templates' . DS .'default' . DS . 'views' . DS . 'home.ctp';
|
||||
$source = CAKE . 'console' . DS . 'templates' . DS .'default' . DS . 'views' . DS . 'home.ctp';
|
||||
include($source);
|
||||
return $this->createFile($path.'home.ctp', $output);
|
||||
}
|
||||
|
|
|
@ -414,5 +414,30 @@ class TestTask extends Shell {
|
|||
}
|
||||
return $path . Inflector::underscore($className) . '.test.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Show help file.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: cake bake test <type> <class>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("");
|
||||
$this->out("test model post\n\tbakes a test case for the post model.");
|
||||
$this->out("");
|
||||
$this->out("test controller comments\n\tbakes a test case for the comments controller.");
|
||||
$this->out("");
|
||||
$this->out('Arguments:');
|
||||
$this->out("\t<type> Can be any of the following 'controller', 'model', 'helper',\n\t'component', 'behavior'.");
|
||||
$this->out("\t<class> Any existing class for the chosen type.");
|
||||
$this->out("");
|
||||
$this->out("Parameters:");
|
||||
$this->out("\t-plugin CamelCased name of plugin to bake tests for.");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -284,9 +284,7 @@ class ViewTask extends Shell {
|
|||
$primaryKey = $modelObj->primaryKey;
|
||||
$displayField = $modelObj->displayField;
|
||||
$singularVar = Inflector::variable($modelClass);
|
||||
$pluralVar = Inflector::variable($this->controllerName);
|
||||
$singularHumanName = Inflector::humanize($modelClass);
|
||||
$pluralHumanName = Inflector::humanize($this->controllerName);
|
||||
$singularHumanName = $this->_singularHumanName($modelClass);
|
||||
$schema = $modelObj->schema();
|
||||
$fields = array_keys($schema);
|
||||
$associations = $this->__associations($modelObj);
|
||||
|
@ -294,13 +292,13 @@ class ViewTask extends Shell {
|
|||
$primaryKey = null;
|
||||
$displayField = null;
|
||||
$singularVar = Inflector::variable(Inflector::singularize($this->controllerName));
|
||||
$pluralVar = Inflector::variable($this->controllerName);
|
||||
$singularHumanName = Inflector::humanize(Inflector::singularize($this->controllerName));
|
||||
$pluralHumanName = Inflector::humanize($this->controllerName);
|
||||
$singularHumanName = $this->_singularHumanName($this->controllerName);
|
||||
$fields = array();
|
||||
$schema = array();
|
||||
$associations = array();
|
||||
}
|
||||
$pluralVar = Inflector::variable($this->controllerName);
|
||||
$pluralHumanName = $this->_pluralHumanName($this->controllerName);
|
||||
|
||||
return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
|
||||
'singularHumanName', 'pluralHumanName', 'fields','associations');
|
||||
|
@ -372,28 +370,12 @@ class ViewTask extends Shell {
|
|||
/**
|
||||
* Builds content from template and variables
|
||||
*
|
||||
* @param string $template file to use
|
||||
* @param string $action name to generate content to
|
||||
* @param array $vars passed for use in templates
|
||||
* @return string content from template
|
||||
* @access public
|
||||
*/
|
||||
function getContent($template = null, $vars = null) {
|
||||
if (!$template) {
|
||||
$template = $this->template;
|
||||
}
|
||||
$action = $template;
|
||||
|
||||
$adminRoute = Configure::read('Routing.admin');
|
||||
if (!empty($adminRoute) && strpos($template, $adminRoute) !== false) {
|
||||
$template = str_replace($adminRoute . '_', '', $template);
|
||||
}
|
||||
if (in_array($template, array('add', 'edit'))) {
|
||||
$action = $template;
|
||||
$template = 'form';
|
||||
} elseif (preg_match('@(_add|_edit)$@', $template)) {
|
||||
$action = $template;
|
||||
$template = str_replace(array('_add', '_edit'), '_form', $template);
|
||||
}
|
||||
function getContent($action, $vars = null) {
|
||||
if (!$vars) {
|
||||
$vars = $this->__loadController();
|
||||
}
|
||||
|
@ -401,7 +383,7 @@ class ViewTask extends Shell {
|
|||
$this->Template->set('action', $action);
|
||||
$this->Template->set('plugin', $this->plugin);
|
||||
$this->Template->set($vars);
|
||||
$output = $this->Template->generate('views', $template);
|
||||
$output = $this->Template->generate('views', $this->getTemplate($action));
|
||||
|
||||
if (!empty($output)) {
|
||||
return $output;
|
||||
|
@ -409,6 +391,30 @@ class ViewTask extends Shell {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the template name based on the action name
|
||||
*
|
||||
* @param string $action name
|
||||
* @return string template name
|
||||
* @access public
|
||||
*/
|
||||
function getTemplate($action) {
|
||||
if (!empty($this->template) && $action != $this->template) {
|
||||
return $this->template;
|
||||
}
|
||||
$template = $action;
|
||||
$adminRoute = Configure::read('Routing.admin');
|
||||
if (!empty($adminRoute) && strpos($template, $adminRoute) !== false) {
|
||||
$template = str_replace($adminRoute . '_', '', $template);
|
||||
}
|
||||
if (in_array($template, array('add', 'edit'))) {
|
||||
$template = 'form';
|
||||
} elseif (preg_match('@(_add|_edit)$@', $template)) {
|
||||
$template = str_replace(array('_add', '_edit'), '_form', $template);
|
||||
}
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
function <?php echo $admin ?>view($id = null) {
|
||||
if (!$id) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('Invalid <?php echo $singularHumanName ?>', true));
|
||||
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName) ?>', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('Invalid <?php echo $singularHumanName; ?>', true), array('action' => 'index'));
|
||||
$this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
$this->set('<?php echo $singularName; ?>', $this-><?php echo $currentModelName; ?>->read(null, $id));
|
||||
|
@ -42,14 +42,14 @@
|
|||
$this-><?php echo $currentModelName; ?>->create();
|
||||
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo $singularHumanName; ?> has been saved', true));
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('<?php echo $currentModelName; ?> saved.', true), array('action' => 'index'));
|
||||
$this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
} else {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo $singularHumanName; ?> could not be saved. Please, try again.', true));
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
|
||||
<?php endif; ?>
|
||||
}
|
||||
}
|
||||
|
@ -74,23 +74,23 @@
|
|||
function <?php echo $admin; ?>edit($id = null) {
|
||||
if (!$id && empty($this->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('Invalid <?php echo $singularHumanName; ?>', true));
|
||||
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('Invalid <?php echo $singularHumanName; ?>', true), array('action' => 'index'));
|
||||
$this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
if (!empty($this->data)) {
|
||||
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo $singularHumanName; ?> has been saved', true));
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('The <?php echo $singularHumanName; ?> has been saved.', true), array('action' => 'index'));
|
||||
$this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
} else {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo $singularHumanName; ?> could not be saved. Please, try again.', true));
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
|
||||
<?php endif; ?>
|
||||
}
|
||||
}
|
||||
|
@ -117,24 +117,24 @@
|
|||
function <?php echo $admin; ?>delete($id = null) {
|
||||
if (!$id) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('Invalid id for <?php echo $singularHumanName; ?>', true));
|
||||
$this->Session->setFlash(__('Invalid id for <?php echo strtolower($singularHumanName); ?>', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('Invalid <?php echo $singularHumanName; ?>', true), array('action' => 'index'));
|
||||
$this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
if ($this-><?php echo $currentModelName; ?>->delete($id)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('<?php echo $singularHumanName; ?> deleted', true));
|
||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('<?php echo $singularHumanName; ?> deleted', true), array('action' => 'index'));
|
||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('<?php echo $singularHumanName; ?> was not deleted', true));
|
||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true));
|
||||
<?php else: ?>
|
||||
$this->flash(__('<?php echo $singularHumanName; ?> was not deleted', true), array('action' => 'index'));
|
||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
$this->redirect(array('action' => 'index'));
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
|
||||
/**
|
||||
* Authentication component
|
||||
*
|
||||
|
@ -9,24 +7,21 @@
|
|||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.controller.components
|
||||
* @since CakePHP(tm) v 0.10.0.1076
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
App::import(array('Router', 'Security'));
|
||||
App::import('Core', array('Router', 'Security'), false);
|
||||
|
||||
/**
|
||||
* Authentication control component class
|
||||
|
@ -84,6 +79,14 @@ class AuthComponent extends Object {
|
|||
*/
|
||||
var $ajaxLogin = null;
|
||||
|
||||
/**
|
||||
* The name of the layout element used on Session::setFlash
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $flashLayout = 'default';
|
||||
|
||||
/**
|
||||
* The name of the model that represents users which will be authenticated. Defaults to 'User'.
|
||||
*
|
||||
|
@ -330,23 +333,24 @@ class AuthComponent extends Object {
|
|||
}
|
||||
|
||||
if ($loginAction == $url) {
|
||||
if (empty($controller->data) || !isset($controller->data[$this->userModel])) {
|
||||
$model =& $this->getModel();
|
||||
if (empty($controller->data) || !isset($controller->data[$model->alias])) {
|
||||
if (!$this->Session->check('Auth.redirect') && env('HTTP_REFERER')) {
|
||||
$this->Session->write('Auth.redirect', $controller->referer(null, true));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$isValid = !empty($controller->data[$this->userModel][$this->fields['username']]) &&
|
||||
!empty($controller->data[$this->userModel][$this->fields['password']]);
|
||||
$isValid = !empty($controller->data[$model->alias][$this->fields['username']]) &&
|
||||
!empty($controller->data[$model->alias][$this->fields['password']]);
|
||||
|
||||
if ($isValid) {
|
||||
$username = $controller->data[$this->userModel][$this->fields['username']];
|
||||
$password = $controller->data[$this->userModel][$this->fields['password']];
|
||||
$username = $controller->data[$model->alias][$this->fields['username']];
|
||||
$password = $controller->data[$model->alias][$this->fields['password']];
|
||||
|
||||
$data = array(
|
||||
$this->userModel . '.' . $this->fields['username'] => $username,
|
||||
$this->userModel . '.' . $this->fields['password'] => $password
|
||||
$model->alias . '.' . $this->fields['username'] => $username,
|
||||
$model->alias . '.' . $this->fields['password'] => $password
|
||||
);
|
||||
|
||||
if ($this->login($data)) {
|
||||
|
@ -357,13 +361,13 @@ class AuthComponent extends Object {
|
|||
}
|
||||
}
|
||||
|
||||
$this->Session->setFlash($this->loginError, 'default', array(), 'auth');
|
||||
$controller->data[$this->userModel][$this->fields['password']] = null;
|
||||
$this->Session->setFlash($this->loginError, $this->flashLayout, array(), 'auth');
|
||||
$controller->data[$model->alias][$this->fields['password']] = null;
|
||||
return false;
|
||||
} else {
|
||||
if (!$this->user()) {
|
||||
if (!$this->RequestHandler->isAjax()) {
|
||||
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
|
||||
$this->Session->setFlash($this->authError, $this->flashLayout, array(), 'auth');
|
||||
if (!empty($controller->params['url']) && count($controller->params['url']) >= 2) {
|
||||
$query = $controller->params['url'];
|
||||
unset($query['url'], $query['ext']);
|
||||
|
@ -427,7 +431,7 @@ class AuthComponent extends Object {
|
|||
return true;
|
||||
}
|
||||
|
||||
$this->Session->setFlash($this->authError, 'default', array(), 'auth');
|
||||
$this->Session->setFlash($this->authError, $this->flashLayout, array(), 'auth');
|
||||
$controller->redirect($controller->referer(), null, true);
|
||||
return false;
|
||||
}
|
||||
|
@ -582,7 +586,7 @@ class AuthComponent extends Object {
|
|||
* Takes a list of actions in the current controller for which authentication is not required, or
|
||||
* no parameters to allow all actions.
|
||||
*
|
||||
* @param string $action Controller action name
|
||||
* @param mixed $action Controller action name or array of actions
|
||||
* @param string $action Controller action name
|
||||
* @param string ... etc.
|
||||
* @return void
|
||||
|
@ -596,14 +600,14 @@ class AuthComponent extends Object {
|
|||
if (isset($args[0]) && is_array($args[0])) {
|
||||
$args = $args[0];
|
||||
}
|
||||
$this->allowedActions = array_merge($this->allowedActions, $args);
|
||||
$this->allowedActions = array_merge($this->allowedActions, array_map('strtolower', $args));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes items from the list of allowed actions.
|
||||
*
|
||||
* @param string $action Controller action name
|
||||
* @param mixed $action Controller action name or array of actions
|
||||
* @param string $action Controller action name
|
||||
* @param string ... etc.
|
||||
* @return void
|
||||
|
@ -612,8 +616,11 @@ class AuthComponent extends Object {
|
|||
*/
|
||||
function deny() {
|
||||
$args = func_get_args();
|
||||
if (isset($args[0]) && is_array($args[0])) {
|
||||
$args = $args[0];
|
||||
}
|
||||
foreach ($args as $arg) {
|
||||
$i = array_search($arg, $this->allowedActions);
|
||||
$i = array_search(strtolower($arg), $this->allowedActions);
|
||||
if (is_int($i)) {
|
||||
unset($this->allowedActions[$i]);
|
||||
}
|
||||
|
@ -698,7 +705,8 @@ class AuthComponent extends Object {
|
|||
}
|
||||
|
||||
if ($key == null) {
|
||||
return array($this->userModel => $this->Session->read($this->sessionKey));
|
||||
$model =& $this->getModel();
|
||||
return array($model->alias => $this->Session->read($this->sessionKey));
|
||||
} else {
|
||||
$user = $this->Session->read($this->sessionKey);
|
||||
if (isset($user[$key])) {
|
||||
|
@ -764,10 +772,11 @@ class AuthComponent extends Object {
|
|||
* @return boolean ACO node path
|
||||
* @access public
|
||||
*/
|
||||
function action($action = ':controller/:action') {
|
||||
function action($action = ':plugin/:controller/:action') {
|
||||
$plugin = empty($this->params['plugin']) ? null : Inflector::camelize($this->params['plugin']) . '/';
|
||||
return str_replace(
|
||||
array(':controller', ':action'),
|
||||
array(Inflector::camelize($this->params['controller']), $this->params['action']),
|
||||
array(':controller', ':action', ':plugin/'),
|
||||
array(Inflector::camelize($this->params['controller']), $this->params['action'], $plugin),
|
||||
$this->actionPath . $action
|
||||
);
|
||||
}
|
||||
|
@ -817,6 +826,7 @@ class AuthComponent extends Object {
|
|||
} else {
|
||||
$conditions = $this->userScope;
|
||||
}
|
||||
$model =& $this->getModel();
|
||||
if (empty($user)) {
|
||||
$user = $this->user();
|
||||
if (empty($user)) {
|
||||
|
@ -827,51 +837,47 @@ class AuthComponent extends Object {
|
|||
return null;
|
||||
}
|
||||
$user = $user->read();
|
||||
$user = $user[$this->userModel];
|
||||
} elseif (is_array($user) && isset($user[$this->userModel])) {
|
||||
$user = $user[$this->userModel];
|
||||
$user = $user[$model->alias];
|
||||
} elseif (is_array($user) && isset($user[$model->alias])) {
|
||||
$user = $user[$model->alias];
|
||||
}
|
||||
|
||||
if (is_array($user) && (isset($user[$this->fields['username']]) || isset($user[$this->userModel . '.' . $this->fields['username']]))) {
|
||||
|
||||
if (is_array($user) && (isset($user[$this->fields['username']]) || isset($user[$model->alias . '.' . $this->fields['username']]))) {
|
||||
if (isset($user[$this->fields['username']]) && !empty($user[$this->fields['username']]) && !empty($user[$this->fields['password']])) {
|
||||
if (trim($user[$this->fields['username']]) == '=' || trim($user[$this->fields['password']]) == '=') {
|
||||
return false;
|
||||
}
|
||||
$find = array(
|
||||
$this->userModel.'.'.$this->fields['username'] => $user[$this->fields['username']],
|
||||
$this->userModel.'.'.$this->fields['password'] => $user[$this->fields['password']]
|
||||
$model->alias.'.'.$this->fields['username'] => $user[$this->fields['username']],
|
||||
$model->alias.'.'.$this->fields['password'] => $user[$this->fields['password']]
|
||||
);
|
||||
} elseif (isset($user[$this->userModel . '.' . $this->fields['username']]) && !empty($user[$this->userModel . '.' . $this->fields['username']])) {
|
||||
if (trim($user[$this->userModel . '.' . $this->fields['username']]) == '=' || trim($user[$this->userModel . '.' . $this->fields['password']]) == '=') {
|
||||
} elseif (isset($user[$model->alias . '.' . $this->fields['username']]) && !empty($user[$model->alias . '.' . $this->fields['username']])) {
|
||||
if (trim($user[$model->alias . '.' . $this->fields['username']]) == '=' || trim($user[$model->alias . '.' . $this->fields['password']]) == '=') {
|
||||
return false;
|
||||
}
|
||||
$find = array(
|
||||
$this->userModel.'.'.$this->fields['username'] => $user[$this->userModel . '.' . $this->fields['username']],
|
||||
$this->userModel.'.'.$this->fields['password'] => $user[$this->userModel . '.' . $this->fields['password']]
|
||||
$model->alias.'.'.$this->fields['username'] => $user[$model->alias . '.' . $this->fields['username']],
|
||||
$model->alias.'.'.$this->fields['password'] => $user[$model->alias . '.' . $this->fields['password']]
|
||||
);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$model =& $this->getModel();
|
||||
$data = $model->find(array_merge($find, $conditions), null, null, 0);
|
||||
if (empty($data) || empty($data[$this->userModel])) {
|
||||
if (empty($data) || empty($data[$model->alias])) {
|
||||
return null;
|
||||
}
|
||||
} elseif (!empty($user) && is_string($user)) {
|
||||
$model =& $this->getModel();
|
||||
$data = $model->find(array_merge(array($model->escapeField() => $user), $conditions));
|
||||
|
||||
if (empty($data) || empty($data[$this->userModel])) {
|
||||
if (empty($data) || empty($data[$model->alias])) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
if (!empty($data[$this->userModel][$this->fields['password']])) {
|
||||
unset($data[$this->userModel][$this->fields['password']]);
|
||||
if (!empty($data[$model->alias][$this->fields['password']])) {
|
||||
unset($data[$model->alias][$this->fields['password']]);
|
||||
}
|
||||
return $data[$this->userModel];
|
||||
return $data[$model->alias];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -888,9 +894,10 @@ class AuthComponent extends Object {
|
|||
return $this->authenticate->hashPasswords($data);
|
||||
}
|
||||
|
||||
if (is_array($data) && isset($data[$this->userModel])) {
|
||||
if (isset($data[$this->userModel][$this->fields['username']]) && isset($data[$this->userModel][$this->fields['password']])) {
|
||||
$data[$this->userModel][$this->fields['password']] = $this->password($data[$this->userModel][$this->fields['password']]);
|
||||
$model =& $this->getModel();
|
||||
if (is_array($data) && isset($data[$model->alias])) {
|
||||
if (isset($data[$model->alias][$this->fields['username']]) && isset($data[$model->alias][$this->fields['password']])) {
|
||||
$data[$model->alias][$this->fields['password']] = $this->password($data[$model->alias][$this->fields['password']]);
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
|
|
|
@ -90,7 +90,11 @@ class CakeSchema extends Object {
|
|||
}
|
||||
|
||||
if (empty($options['path'])) {
|
||||
$this->path = CONFIGS . 'schema';
|
||||
if (is_dir(CONFIGS . 'schema')) {
|
||||
$this->path = CONFIGS . 'schema';
|
||||
} else {
|
||||
$this->path = CONFIGS . 'sql';
|
||||
}
|
||||
}
|
||||
|
||||
$options = array_merge(get_object_vars($this), $options);
|
||||
|
@ -239,8 +243,6 @@ class CakeSchema extends Object {
|
|||
foreach ($Object->hasAndBelongsToMany as $Assoc => $assocData) {
|
||||
if (isset($assocData['with'])) {
|
||||
$class = $assocData['with'];
|
||||
} elseif ($assocData['_with']) {
|
||||
$class = $assocData['_with'];
|
||||
}
|
||||
if (is_object($Object->$class)) {
|
||||
$table = $db->fullTableName($Object->$class, false);
|
||||
|
|
|
@ -224,6 +224,25 @@ class Helper extends Overloadable {
|
|||
return $webPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a timestamp to a file based resource based on the value of `Asset.timestamp` in
|
||||
* Configure. If Asset.timestamp is true and debug > 0, or Asset.timestamp == 'force'
|
||||
* a timestamp will be added.
|
||||
*
|
||||
* @param string $path The file path to timestamp, the path must be inside WWW_ROOT
|
||||
* @return string Path with a timestamp added, or not.
|
||||
**/
|
||||
function assetTimestamp($path) {
|
||||
$timestampEnabled = (
|
||||
(Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
|
||||
Configure::read('Asset.timestamp') === 'force'
|
||||
);
|
||||
if (strpos($path, '?') === false && $timestampEnabled) {
|
||||
$path .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path));
|
||||
}
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to remove harmful tags from content
|
||||
*
|
||||
|
|
|
@ -373,17 +373,7 @@ class HtmlHelper extends AppHelper {
|
|||
$path .= '.css';
|
||||
}
|
||||
}
|
||||
|
||||
$path = $this->webroot($path);
|
||||
|
||||
$url = $path;
|
||||
$timestampEnabled = (
|
||||
(Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
|
||||
Configure::read('Asset.timestamp') === 'force'
|
||||
);
|
||||
if (strpos($path, '?') === false && $timestampEnabled) {
|
||||
$url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path));
|
||||
}
|
||||
$url = $this->webroot($this->assetTimestamp($path));
|
||||
|
||||
if (Configure::read('Asset.filter.css')) {
|
||||
$url = str_replace(CSS_URL, 'ccss/', $url);
|
||||
|
@ -452,21 +442,10 @@ class HtmlHelper extends AppHelper {
|
|||
if ($url[0] !== '/') {
|
||||
$url = JS_URL . $url;
|
||||
}
|
||||
$url = $this->webroot($url);
|
||||
if (strpos($url, '?') === false) {
|
||||
if (strpos($url, '.js') === false) {
|
||||
$url .= '.js';
|
||||
}
|
||||
}
|
||||
|
||||
$timestampEnabled = (
|
||||
(Configure::read('Asset.timestamp') === true && Configure::read('debug') > 0) ||
|
||||
Configure::read('Asset.timestamp') === 'force'
|
||||
);
|
||||
|
||||
if (strpos($url, '?') === false && $timestampEnabled) {
|
||||
$url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $url));
|
||||
if (strpos($url, '?') === false && strpos($url, '.js') === false) {
|
||||
$url .= '.js';
|
||||
}
|
||||
$url = $this->webroot($this->assetTimestamp($url));
|
||||
|
||||
if (Configure::read('Asset.filter.js')) {
|
||||
$url = str_replace(JS_URL, 'cjs/', $url);
|
||||
|
@ -607,13 +586,11 @@ class HtmlHelper extends AppHelper {
|
|||
function image($path, $options = array()) {
|
||||
if (is_array($path)) {
|
||||
$path = $this->url($path);
|
||||
} elseif ($path[0] === '/') {
|
||||
$path = $this->webroot($path);
|
||||
} elseif (strpos($path, '://') === false) {
|
||||
$path = $this->webroot(IMAGES_URL . $path);
|
||||
if ((Configure::read('Asset.timestamp') == true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') {
|
||||
$path .= '?' . @filemtime(str_replace('/', DS, WWW_ROOT . $path));
|
||||
if ($path[0] !== '/') {
|
||||
$path = IMAGES_URL . $path;
|
||||
}
|
||||
$path = $this->webroot($this->assetTimestamp($path));
|
||||
}
|
||||
|
||||
if (!isset($options['alt'])) {
|
||||
|
|
|
@ -270,16 +270,7 @@ class JavascriptHelper extends AppHelper {
|
|||
$url .= '.js';
|
||||
}
|
||||
}
|
||||
|
||||
$url = $this->webroot($url);
|
||||
$timestampEnabled = (
|
||||
(Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
|
||||
Configure::read('Asset.timestamp') === 'force'
|
||||
);
|
||||
|
||||
if (strpos($url, '?') === false && $timestampEnabled) {
|
||||
$url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $url));
|
||||
}
|
||||
$url = $this->webroot($this->assetTimestamp($url));
|
||||
|
||||
if (Configure::read('Asset.filter.js')) {
|
||||
$url = str_replace(JS_URL, 'cjs/', $url);
|
||||
|
|
|
@ -160,7 +160,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
function event($type, $callback, $options = array()) {
|
||||
$defaults = array('wrap' => true, 'stop' => true);
|
||||
$options = array_merge($defaults, $options);
|
||||
|
||||
|
||||
$function = 'function (event) {%s}';
|
||||
if ($options['wrap'] && $options['stop']) {
|
||||
$callback .= "\nreturn false;";
|
||||
|
@ -240,7 +240,13 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
}
|
||||
$options['url'] = $url;
|
||||
if (isset($options['update'])) {
|
||||
$options['success'] = 'function (msg, status) {$("' . $options['update'] . '").html(msg);}';
|
||||
$wrapCallbacks = isset($options['wrapCallbacks']) ? $options['wrapCallbacks'] : true;
|
||||
if ($wrapCallbacks) {
|
||||
$success = '$("' . $options['update'] . '").html(data);';
|
||||
} else {
|
||||
$success = 'function (data, textStatus) {$("' . $options['update'] . '").html(data);}';
|
||||
}
|
||||
$options['success'] = $success;
|
||||
unset($options['update']);
|
||||
}
|
||||
$callbacks = array('success', 'error', 'beforeSend', 'complete');
|
||||
|
@ -269,7 +275,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
|
||||
/**
|
||||
* Create a Draggable element
|
||||
*
|
||||
*
|
||||
* Requires both Ui.Core and Ui.Draggable to be loaded.
|
||||
*
|
||||
* @param array $options Array of options for the draggable element.
|
||||
|
@ -283,7 +289,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
|
||||
/**
|
||||
* Create a Droppable element
|
||||
*
|
||||
*
|
||||
* Requires both Ui.Core and Ui.Droppable to be loaded.
|
||||
*
|
||||
* @param array $options Array of options for the droppable element.
|
||||
|
@ -297,7 +303,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
|
||||
/**
|
||||
* Create a Slider element
|
||||
*
|
||||
*
|
||||
* Requires both Ui.Core and Ui.Slider to be loaded.
|
||||
*
|
||||
* @param array $options Array of options for the droppable element.
|
||||
|
@ -311,9 +317,9 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Serialize a form attached to $selector. If the current selection is not an input or
|
||||
* Serialize a form attached to $selector. If the current selection is not an input or
|
||||
* form, errors will be created in the Javascript.
|
||||
*
|
||||
*
|
||||
* @param array $options Options for the serialization
|
||||
* @return string completed form serialization script
|
||||
* @see JsHelper::serializeForm() for option list.
|
||||
|
|
|
@ -115,7 +115,7 @@ class JsHelper extends AppHelper {
|
|||
* @param string $method Method to be called
|
||||
* @param array $params Parameters for the method being called.
|
||||
* @access public
|
||||
* @return mixed
|
||||
* @return mixed Depends on the return of the dispatched method, or it could be an instance of the EngineHelper
|
||||
**/
|
||||
function call__($method, $params) {
|
||||
if (isset($this->{$this->__engineName}) && method_exists($this->{$this->__engineName}, $method)) {
|
||||
|
@ -150,6 +150,20 @@ class JsHelper extends AppHelper {
|
|||
trigger_error(sprintf(__('JsHelper:: Missing Method %s is undefined', true), $method), E_USER_WARNING);
|
||||
}
|
||||
|
||||
/**
|
||||
* Workaround for Object::Object() existing. Since Object::object exists, it does not
|
||||
* fall into call__ and is not passed onto the engine helper. See JsBaseEngineHelper::object() for
|
||||
* more information on this method.
|
||||
*
|
||||
* @param mixed $data Data to convert into JSON
|
||||
* @param array $options Options to use for encoding JSON. See JsBaseEngineHelper::object() for more details.
|
||||
* @return string encoded JSON
|
||||
* @deprecated Remove when support for PHP4 and Object::object are removed.
|
||||
**/
|
||||
function object($data = array(), $options = array()) {
|
||||
return $this->{$this->__engineName}->object($data, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes all Javascript generated so far to a code block or
|
||||
* caches them to a file and returns a linked script.
|
||||
|
@ -203,7 +217,7 @@ class JsHelper extends AppHelper {
|
|||
/**
|
||||
* Get all the cached scripts
|
||||
*
|
||||
* @param boolean $clear Whether or not to clear the script caches
|
||||
* @param boolean $clear Whether or not to clear the script caches (default true)
|
||||
* @return array Array of scripts added to the request.
|
||||
**/
|
||||
function getBuffer($clear = true) {
|
||||
|
@ -919,10 +933,10 @@ class JsBaseEngineHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Prepare callbacks and wrap them with function ([args]) { } as defined in
|
||||
* Prepare callbacks and wrap them with function ([args]) { } as defined in
|
||||
* _callbackArgs array.
|
||||
*
|
||||
* @param string $method Name of the method you are preparing callbacks for.
|
||||
* @param string $method Name of the method you are preparing callbacks for.
|
||||
* @param array $options Array of options being parsed
|
||||
* @param string $callbacks Additional Keys that contain callbacks
|
||||
* @access protected
|
||||
|
|
|
@ -33,7 +33,7 @@ class PaginatorHelper extends AppHelper {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
var $helpers = array('Html', 'Ajax');
|
||||
var $helpers = array('Html');
|
||||
|
||||
/**
|
||||
* Holds the default model for paged recordsets
|
||||
|
@ -42,6 +42,13 @@ class PaginatorHelper extends AppHelper {
|
|||
*/
|
||||
var $__defaultModel = null;
|
||||
|
||||
/**
|
||||
* The class used for 'Ajax' pagination links.
|
||||
*
|
||||
* @var string
|
||||
**/
|
||||
var $_ajaxHelperClass = 'Js';
|
||||
|
||||
/**
|
||||
* Holds the default options for pagination links
|
||||
*
|
||||
|
@ -66,6 +73,33 @@ class PaginatorHelper extends AppHelper {
|
|||
*/
|
||||
var $options = array();
|
||||
|
||||
/**
|
||||
* Constructor for the helper. Sets up the helper that is used for creating 'AJAX' links.
|
||||
*
|
||||
* Use `var $helpers = array('Paginator' => array('ajax' => 'CustomHelper'));` to set a custom Helper
|
||||
* or choose a non JsHelper Helper. If you want to use a specific library with JsHelper declare JsHelper and its
|
||||
* adapter before including PaginatorHelper in your helpers array.
|
||||
*
|
||||
* The chosen custom helper must implement a `link()` method.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function __construct($config = array()) {
|
||||
$ajaxProvider = isset($config['ajax']) ? $config['ajax'] : 'Js';
|
||||
$this->helpers[] = $ajaxProvider;
|
||||
$this->_ajaxHelperClass = $ajaxProvider;
|
||||
|
||||
App::import('Helper', $ajaxProvider);
|
||||
$classname = $ajaxProvider . 'Helper';
|
||||
if (!method_exists($classname, 'link')) {
|
||||
$message = sprintf(
|
||||
__('%s does not implement a link() method, it is incompatible with PaginatorHelper', true),
|
||||
$classname
|
||||
);
|
||||
trigger_error($message, E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current paging parameters from the resultset for the given model
|
||||
*
|
||||
|
@ -280,7 +314,7 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
$url = $this->url($url, true, $model);
|
||||
|
||||
$obj = isset($options['update']) ? 'Ajax' : 'Html';
|
||||
$obj = isset($options['update']) ? $this->_ajaxHelperClass : 'Html';
|
||||
$url = array_merge(array('page' => $this->current($model)), $url);
|
||||
$url = array_merge(Set::filter($url, true), array_intersect_key($url, array('plugin'=>true)));
|
||||
return $this->{$obj}->link($title, $url, $options);
|
||||
|
|
|
@ -148,7 +148,7 @@ class SchemaShellTest extends CakeTestCase {
|
|||
$this->Shell->startup();
|
||||
$this->assertTrue(isset($this->Shell->Schema));
|
||||
$this->assertTrue(is_a($this->Shell->Schema, 'CakeSchema'));
|
||||
$this->assertEqual(strtolower($this->Shell->Schema->name), APP_DIR);
|
||||
$this->assertEqual(strtolower($this->Shell->Schema->name), strtolower(APP_DIR));
|
||||
$this->assertEqual($this->Shell->Schema->file, 'schema.php');
|
||||
|
||||
unset($this->Shell->Schema);
|
||||
|
@ -168,7 +168,7 @@ class SchemaShellTest extends CakeTestCase {
|
|||
'path' => '/test/path'
|
||||
);
|
||||
$this->Shell->startup();
|
||||
$this->assertEqual(strtolower($this->Shell->Schema->name), APP_DIR);
|
||||
$this->assertEqual(strtolower($this->Shell->Schema->name), strtolower(APP_DIR));
|
||||
$this->assertEqual($this->Shell->Schema->file, 'other_file.php');
|
||||
$this->assertEqual($this->Shell->Schema->connection, 'test_suite');
|
||||
$this->assertEqual($this->Shell->Schema->path, '/test/path');
|
||||
|
@ -354,5 +354,33 @@ class SchemaShellTest extends CakeTestCase {
|
|||
$this->_fixtures['core.article']->create($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that the plugin param creates the correct path in the schema object.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testPluginParam() {
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
|
||||
));
|
||||
$this->Shell->params = array(
|
||||
'plugin' => 'TestPlugin',
|
||||
'connection' => 'test_suite'
|
||||
);
|
||||
$this->Shell->startup();
|
||||
$expected = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'config' . DS . 'schema' . DS;
|
||||
$this->assertEqual($this->Shell->Schema->path, $expected);
|
||||
|
||||
unset($this->Shell->Schema);
|
||||
$this->Shell->params = array(
|
||||
'plugin' => 'TestPlugin',
|
||||
'connection' => 'test_suite',
|
||||
'path' => '/some/path'
|
||||
);
|
||||
$this->Shell->startup();
|
||||
$expected = '/some/path';
|
||||
$this->assertEqual($this->Shell->Schema->path, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -303,16 +303,16 @@ 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(__('Invalid Article', true))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('Invalid article', true))") !== 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(__('The Article has been saved', true))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article has been saved', true))") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The Article could not be saved. Please, try again.', true));") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Session->setFlash(__('The article could not be saved. Please, try again.', true));") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function delete($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, 'if ($this->Article->delete($id))') !== false);
|
||||
|
@ -346,13 +346,13 @@ 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(__('Invalid Article', true), array('action' => 'index'))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(__('Invalid article', true), 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(__('The Article has been saved.', true), array('action' => 'index'))") !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->flash(__('The article has been saved.', true), array('action' => 'index'))") !== false);
|
||||
|
||||
$this->assertTrue(strpos($result, 'function edit($id = null)') !== false);
|
||||
$this->assertTrue(strpos($result, "\$this->Article->Tag->find('list')") !== false);
|
||||
|
|
|
@ -33,13 +33,11 @@ if (!class_exists('ShellDispatcher')) {
|
|||
ob_end_clean();
|
||||
}
|
||||
|
||||
|
||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'view.php';
|
||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'controller.php';
|
||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php';
|
||||
require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'project.php';
|
||||
|
||||
|
||||
Mock::generatePartial(
|
||||
'ShellDispatcher', 'TestViewTaskMockShellDispatcher',
|
||||
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
|
||||
|
@ -120,6 +118,8 @@ class ViewTaskTest extends CakeTestCase {
|
|||
/**
|
||||
* startTest method
|
||||
*
|
||||
* Ensure that the default theme is used
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
|
@ -132,6 +132,7 @@ class ViewTaskTest extends CakeTestCase {
|
|||
$this->Task->Controller =& new ViewTaskMockControllerTask();
|
||||
$this->Task->Project =& new ViewTaskMockProjectTask();
|
||||
$this->Task->path = TMP;
|
||||
$this->Task->Template->params['theme'] = 'default';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -259,11 +260,11 @@ class ViewTaskTest extends CakeTestCase {
|
|||
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'view.ctp',
|
||||
new PatternExpectation('/ViewTaskComments/')
|
||||
new PatternExpectation('/View Task Comments/')
|
||||
));
|
||||
$this->Task->expectAt(1, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
||||
new PatternExpectation('/Edit ViewTaskComment/')
|
||||
new PatternExpectation('/Edit View Task Comment/')
|
||||
));
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'index.ctp',
|
||||
|
@ -388,16 +389,34 @@ class ViewTaskTest extends CakeTestCase {
|
|||
));
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'add.ctp',
|
||||
new PatternExpectation('/Add ViewTaskComment/')
|
||||
new PatternExpectation('/Add View Task Comment/')
|
||||
));
|
||||
$this->Task->expectAt(3, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'edit.ctp',
|
||||
new PatternExpectation('/Edit ViewTaskComment/')
|
||||
new PatternExpectation('/Edit View Task Comment/')
|
||||
));
|
||||
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* test `cake bake view posts index list`
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testExecuteWithAlternateTemplates() {
|
||||
$this->Task->connection = 'test_suite';
|
||||
$this->Task->args = array('ViewTaskComments', 'index', 'list');
|
||||
$this->Task->params = array();
|
||||
|
||||
$this->Task->expectCallCount('createFile', 1);
|
||||
$this->Task->expectAt(0, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'list.ctp',
|
||||
new PatternExpectation('/ViewTaskComment/')
|
||||
));
|
||||
$this->Task->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* test execute into interactive() with admin methods.
|
||||
*
|
||||
|
@ -425,11 +444,11 @@ class ViewTaskTest extends CakeTestCase {
|
|||
));
|
||||
$this->Task->expectAt(2, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'admin_add.ctp',
|
||||
new PatternExpectation('/Add ViewTaskComment/')
|
||||
new PatternExpectation('/Add View Task Comment/')
|
||||
));
|
||||
$this->Task->expectAt(3, 'createFile', array(
|
||||
TMP . 'view_task_comments' . DS . 'admin_edit.ctp',
|
||||
new PatternExpectation('/Edit ViewTaskComment/')
|
||||
new PatternExpectation('/Edit View Task Comment/')
|
||||
));
|
||||
|
||||
$this->Task->execute();
|
||||
|
|
|
@ -66,7 +66,7 @@ class CakeLogTest extends CakeTestCase {
|
|||
$result = file(LOGS . 'debug.log');
|
||||
$this->assertEqual(count($result), 1);
|
||||
$this->assertPattern(
|
||||
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} Debug: Notice \(8\): Undefined variable: out in \[.+ line \d{2}\]$/',
|
||||
'/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} Notice: Notice \(8\): Undefined variable: out in \[.+ line \d{2}\]$/',
|
||||
$result[0]
|
||||
);
|
||||
@unlink(LOGS . 'debug.log');
|
||||
|
|
|
@ -1,34 +1,31 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
|
||||
/**
|
||||
* AutComponentTest file
|
||||
* AuthComponentTest file
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* 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-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* @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.cake.tests.cases.libs.controller.components
|
||||
* @since CakePHP(tm) v 1.2.0.5347
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
App::import(array('controller' . DS . 'components' . DS .'auth', 'controller' . DS . 'components' . DS .'acl'));
|
||||
App::import(array('controller' . DS . 'components' . DS . 'acl', 'model' . DS . 'db_acl'));
|
||||
App::import('Component', array('Auth', 'Acl'));
|
||||
App::import('Model', 'DbAcl');
|
||||
App::import('Core', 'Xml');
|
||||
|
||||
Mock::generate('AclComponent', 'AuthTestMockAclComponent');
|
||||
|
||||
/**
|
||||
* TestAuthComponent class
|
||||
*
|
||||
|
@ -272,6 +269,7 @@ class AuthTestController extends Controller {
|
|||
* @return void
|
||||
*/
|
||||
function beforeFilter() {
|
||||
$this->Auth->userModel = 'AuthUser';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -495,11 +493,13 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$this->Controller =& new AuthTestController();
|
||||
$this->Controller->Component->init($this->Controller);
|
||||
$this->Controller->Component->initialize($this->Controller);
|
||||
$this->Controller->beforeFilter();
|
||||
|
||||
ClassRegistry::addObject('view', new View($this->Controller));
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->del('Message.auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$this->Controller->Session->delete('Message.auth');
|
||||
|
||||
Router::reload();
|
||||
|
||||
|
@ -517,8 +517,8 @@ class AuthTest extends CakeTestCase {
|
|||
$_ENV = $this->_env;
|
||||
Configure::write('Acl', $this->_acl);
|
||||
Configure::write('Security.salt', $this->_securitySalt);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->del('Message.auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$this->Controller->Session->delete('Message.auth');
|
||||
ClassRegistry::flush();
|
||||
unset($this->Controller, $this->AuthUser);
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ class AuthTest extends CakeTestCase {
|
|||
'id' => 1, 'username' => 'mariano', 'created' => '2007-03-17 01:16:23', 'updated' => date('Y-m-d H:i:s')
|
||||
));
|
||||
$this->assertEqual($user, $expected);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
|
||||
$this->Controller->data['AuthUser']['username'] = 'blah';
|
||||
$this->Controller->data['AuthUser']['password'] = '';
|
||||
|
@ -595,7 +595,7 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$user = $this->Controller->Auth->user();
|
||||
$this->assertFalse($user);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
|
||||
$this->Controller->data['AuthUser']['username'] = 'now() or 1=1 --';
|
||||
$this->Controller->data['AuthUser']['password'] = '';
|
||||
|
@ -604,7 +604,7 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$user = $this->Controller->Auth->user();
|
||||
$this->assertFalse($user);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
|
||||
$this->Controller->data['AuthUser']['username'] = 'now() or 1=1 # something';
|
||||
$this->Controller->data['AuthUser']['password'] = '';
|
||||
|
@ -613,7 +613,7 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$user = $this->Controller->Auth->user();
|
||||
$this->assertFalse($user);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
|
||||
$this->Controller->Auth->userModel = 'UuidUser';
|
||||
$this->Controller->Auth->login('47c36f9c-bc00-4d17-9626-4e183ca6822b');
|
||||
|
@ -623,7 +623,7 @@ class AuthTest extends CakeTestCase {
|
|||
'id' => '47c36f9c-bc00-4d17-9626-4e183ca6822b', 'title' => 'Unique record 1', 'count' => 2, 'created' => '2008-03-13 01:16:23', 'updated' => '2008-03-13 01:18:31'
|
||||
));
|
||||
$this->assertEqual($user, $expected);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -642,7 +642,7 @@ class AuthTest extends CakeTestCase {
|
|||
$result = $this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$result = $this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertFalse($result);
|
||||
$this->assertTrue($this->Controller->Session->check('Message.auth'));
|
||||
|
@ -673,7 +673,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertTrue($this->Controller->Session->check('Message.auth'));
|
||||
$this->assertFalse($result);
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -695,7 +695,7 @@ class AuthTest extends CakeTestCase {
|
|||
$result = $this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue($result);
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue($this->Controller->Session->check('Message.auth'));
|
||||
$result = $this->Controller->Auth->isAuthorized();
|
||||
|
@ -737,7 +737,7 @@ class AuthTest extends CakeTestCase {
|
|||
$result = $this->Controller->Acl->Aro->save();
|
||||
$this->assertTrue($result);
|
||||
|
||||
$this->Controller->Acl->Aco->create(array('alias'=>'Root'));
|
||||
$this->Controller->Acl->Aco->create(array('alias' => 'Root'));
|
||||
$result = $this->Controller->Acl->Aco->save();
|
||||
$this->assertTrue($result);
|
||||
|
||||
|
@ -759,11 +759,40 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue($this->Controller->Auth->isAuthorized());
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue($this->Controller->Session->check('Message.auth'));
|
||||
}
|
||||
|
||||
/**
|
||||
* test authorize = 'actions' setting.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testAuthorizeActions() {
|
||||
$this->AuthUser =& new AuthUser();
|
||||
$user = $this->AuthUser->find();
|
||||
$this->Controller->Session->write('Auth', $user);
|
||||
$this->Controller->params['controller'] = 'auth_test';
|
||||
$this->Controller->params['action'] = 'add';
|
||||
|
||||
$this->Controller->Acl =& new AuthTestMockAclComponent();
|
||||
$this->Controller->Acl->setReturnValue('check', true);
|
||||
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
|
||||
$this->Controller->Auth->userModel = 'AuthUser';
|
||||
$this->Controller->Auth->authorize = 'actions';
|
||||
$this->Controller->Auth->actionPath = 'Root/';
|
||||
|
||||
$this->Controller->Acl->expectAt(0, 'check', array(
|
||||
$user, 'Root/AuthTest/add'
|
||||
));
|
||||
|
||||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue($this->Controller->Auth->isAuthorized());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that deny always takes precedence over allow
|
||||
*
|
||||
|
@ -774,7 +803,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Controller->Auth->initialize($this->Controller);
|
||||
|
||||
$this->Controller->Auth->allow('*');
|
||||
$this->Controller->Auth->deny('add');
|
||||
$this->Controller->Auth->deny('add', 'camelcase');
|
||||
|
||||
$this->Controller->params['action'] = 'delete';
|
||||
$this->assertTrue($this->Controller->Auth->startup($this->Controller));
|
||||
|
@ -784,6 +813,61 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$this->Controller->params['action'] = 'Add';
|
||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||
|
||||
$this->Controller->params['action'] = 'camelCase';
|
||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||
|
||||
$this->Controller->Auth->allow('*');
|
||||
$this->Controller->Auth->deny(array('add', 'camelcase'));
|
||||
|
||||
$this->Controller->params['action'] = 'camelCase';
|
||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||
}
|
||||
|
||||
/**
|
||||
* test the action() method
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testActionMethod() {
|
||||
$this->Controller->params['controller'] = 'auth_test';
|
||||
$this->Controller->params['action'] = 'add';
|
||||
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
$this->Controller->Auth->actionPath = 'ROOT/';
|
||||
|
||||
$result = $this->Controller->Auth->action();
|
||||
$this->assertEqual($result, 'ROOT/AuthTest/add');
|
||||
|
||||
$result = $this->Controller->Auth->action(':controller');
|
||||
$this->assertEqual($result, 'ROOT/AuthTest');
|
||||
|
||||
$result = $this->Controller->Auth->action(':controller');
|
||||
$this->assertEqual($result, 'ROOT/AuthTest');
|
||||
|
||||
$this->Controller->params['plugin'] = 'test_plugin';
|
||||
$this->Controller->params['controller'] = 'auth_test';
|
||||
$this->Controller->params['action'] = 'add';
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
$result = $this->Controller->Auth->action();
|
||||
$this->assertEqual($result, 'ROOT/TestPlugin/AuthTest/add');
|
||||
}
|
||||
|
||||
/**
|
||||
* test that deny() converts camel case inputs to lowercase.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testDenyWithCamelCaseMethods() {
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
$this->Controller->Auth->allow('*');
|
||||
$this->Controller->Auth->deny('add', 'camelCase');
|
||||
|
||||
$url = '/auth_test/camelCase';
|
||||
$this->Controller->params = Router::parse($url);
|
||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||
|
||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -815,6 +899,17 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Controller->Auth->allowedActions = array('delete', 'add');
|
||||
$result = $this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertFalse($result, 'startup() should return false, as action is not allowed. %s');
|
||||
|
||||
}
|
||||
|
||||
function testAllowedActionsSetWithAllowMethod() {
|
||||
$url = '/auth_test/action_name';
|
||||
$this->Controller->params = Router::parse($url);
|
||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
$this->Controller->Auth->allow('action_name', 'anotherAction');
|
||||
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotheraction'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -848,7 +943,7 @@ class AuthTest extends CakeTestCase {
|
|||
$expected = Router::normalize($this->Controller->Auth->loginRedirect);
|
||||
$this->assertEqual($expected, $this->Controller->Auth->redirect());
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
|
||||
$this->Controller->params['url']['url'] = 'admin/';
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
|
@ -859,7 +954,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertTrue($this->Controller->Session->check('Message.auth'));
|
||||
$this->assertEqual($expected, $this->Controller->Auth->redirect());
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
|
||||
//empty referer no session
|
||||
$_SERVER['HTTP_REFERER'] = false;
|
||||
|
@ -887,7 +982,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertEqual($expected, $this->Controller->testUrl);
|
||||
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$_SERVER['HTTP_REFERER'] = Router::url('/admin/', true);
|
||||
|
||||
$this->Controller->Session->write('Auth', array(
|
||||
|
@ -904,7 +999,7 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
//Ticket #4750
|
||||
//named params
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$url = '/posts/index/year:2008/month:feb';
|
||||
$this->Controller->params = Router::parse($url);
|
||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||
|
@ -916,7 +1011,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));
|
||||
|
||||
//passed args
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$url = '/posts/view/1';
|
||||
$this->Controller->params = Router::parse($url);
|
||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||
|
@ -934,7 +1029,7 @@ class AuthTest extends CakeTestCase {
|
|||
'print' => 'true',
|
||||
'refer' => 'menu'
|
||||
);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$url = '/posts/index/29?print=true&refer=menu';
|
||||
$this->Controller->params = Dispatcher::parseParams($url);
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
|
@ -950,7 +1045,7 @@ class AuthTest extends CakeTestCase {
|
|||
'refer' => 'menu',
|
||||
'ext' => 'html'
|
||||
);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$url = '/posts/index/29?print=true&refer=menu';
|
||||
$this->Controller->params = Dispatcher::parseParams($url);
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
|
@ -963,7 +1058,7 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
//external authed action
|
||||
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$url = '/posts/edit/1';
|
||||
$this->Controller->params = Router::parse($url);
|
||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||
|
@ -976,7 +1071,7 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
//external direct login link
|
||||
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$url = '/AuthTest/login';
|
||||
$this->Controller->params = Router::parse($url);
|
||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||
|
@ -988,7 +1083,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));
|
||||
|
||||
$_SERVER['HTTP_REFERER'] = $backup;
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -998,7 +1093,7 @@ class AuthTest extends CakeTestCase {
|
|||
* @return void
|
||||
**/
|
||||
function testNoRedirectOn404() {
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
$this->Controller->params = Router::parse('auth_test/something_totally_wrong');
|
||||
$result = $this->Controller->Auth->startup($this->Controller);
|
||||
|
@ -1033,7 +1128,7 @@ class AuthTest extends CakeTestCase {
|
|||
$user = $this->Controller->Auth->user();
|
||||
$this->assertTrue($this->Controller->Session->check('Message.auth'));
|
||||
$this->assertEqual($user, false);
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1058,7 +1153,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue(is_array($this->Controller->Auth->user()));
|
||||
|
||||
$this->Controller->Session->del($this->Controller->Auth->sessionKey);
|
||||
$this->Controller->Session->delete($this->Controller->Auth->sessionKey);
|
||||
|
||||
$this->Controller->data['AuthUser']['username'] = 'nate';
|
||||
$this->Controller->data['AuthUser']['password'] = 'cake1';
|
||||
|
@ -1070,7 +1165,7 @@ class AuthTest extends CakeTestCase {
|
|||
$this->Controller->Auth->startup($this->Controller);
|
||||
$this->assertTrue(is_null($this->Controller->Auth->user()));
|
||||
|
||||
$this->Controller->Session->del($this->Controller->Auth->sessionKey);
|
||||
$this->Controller->Session->delete($this->Controller->Auth->sessionKey);
|
||||
|
||||
$this->Controller->data['AuthUser']['username'] = '> n';
|
||||
$this->Controller->data['AuthUser']['password'] = 'cake';
|
||||
|
@ -1167,7 +1262,7 @@ class AuthTest extends CakeTestCase {
|
|||
$user = $this->Controller->Auth->user();
|
||||
$this->assertTrue(!!$user);
|
||||
|
||||
$this->Controller->Session->del('Auth');
|
||||
$this->Controller->Session->delete('Auth');
|
||||
Router::reload();
|
||||
Router::connect('/', array('controller' => 'people', 'action' => 'login'));
|
||||
$url = '/';
|
||||
|
@ -1260,6 +1355,53 @@ class AuthTest extends CakeTestCase {
|
|||
Configure::write('Routing.admin', $admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* testPluginModel method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testPluginModel() {
|
||||
// Adding plugins
|
||||
Cache::delete('object_map', '_cake_core_');
|
||||
App::build(array(
|
||||
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
|
||||
'models' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models' . DS)
|
||||
), true);
|
||||
App::objects('plugin', null, false);
|
||||
|
||||
$PluginModel =& ClassRegistry::init('TestPlugin.TestPluginAuthUser');
|
||||
$user['id'] = 1;
|
||||
$user['username'] = 'gwoo';
|
||||
$user['password'] = Security::hash(Configure::read('Security.salt') . 'cake');
|
||||
$PluginModel->save($user, false);
|
||||
|
||||
$authUser = $PluginModel->find();
|
||||
|
||||
$this->Controller->data['TestPluginAuthUser']['username'] = $authUser['TestPluginAuthUser']['username'];
|
||||
$this->Controller->data['TestPluginAuthUser']['password'] = 'cake';
|
||||
|
||||
$this->Controller->params = Router::parse('auth_test/login');
|
||||
$this->Controller->params['url']['url'] = 'auth_test/login';
|
||||
|
||||
$this->Controller->Auth->initialize($this->Controller);
|
||||
|
||||
$this->Controller->Auth->loginAction = 'auth_test/login';
|
||||
$this->Controller->Auth->userModel = 'TestPlugin.TestPluginAuthUser';
|
||||
|
||||
$this->Controller->Auth->startup($this->Controller);
|
||||
$user = $this->Controller->Auth->user();
|
||||
$expected = array('TestPluginAuthUser' => array(
|
||||
'id' => 1, 'username' => 'gwoo', 'created' => '2007-03-17 01:16:23', 'updated' => date('Y-m-d H:i:s')
|
||||
));
|
||||
$this->assertEqual($user, $expected);
|
||||
|
||||
// Reverting changes
|
||||
Cache::delete('object_map', '_cake_core_');
|
||||
App::build();
|
||||
App::objects('plugin', null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* testAjaxLogin method
|
||||
*
|
||||
|
|
|
@ -1088,11 +1088,13 @@ class RouterTest extends CakeTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
|
||||
Configure::write('Routing.admin', 'admin');
|
||||
$paths = Configure::read('pluginPaths');
|
||||
Configure::write('pluginPaths', array(
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS
|
||||
));
|
||||
Configure::write('__objects.plugin', array('test_plugin'));
|
||||
$paths = App::path('plugins');
|
||||
App::build(array(
|
||||
'plugins' => array(
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS
|
||||
)
|
||||
), true);
|
||||
App::objects('plugin', null, false);
|
||||
|
||||
Router::reload();
|
||||
Router::setRequestInfo(array(
|
||||
|
@ -1107,7 +1109,7 @@ class RouterTest extends CakeTestCase {
|
|||
$expected = '/admin/test_plugin';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
Configure::write('pluginPaths', $paths);
|
||||
App::build(array('plugins' => $paths));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -411,6 +411,41 @@ class HelperTest extends CakeTestCase {
|
|||
$this->assertEqual($result, "/posts/index/page:1?one=value&two=value&three=purple");
|
||||
}
|
||||
|
||||
/**
|
||||
* test assetTimestamp application
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testAssetTimestamp() {
|
||||
$_timestamp = Configure::read('Asset.timestamp');
|
||||
$_debug = Configure::read('debug');
|
||||
|
||||
Configure::write('Asset.timestamp', false);
|
||||
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
|
||||
$this->assertEqual($result, CSS_URL . 'cake.generic.css');
|
||||
|
||||
Configure::write('Asset.timestamp', true);
|
||||
Configure::write('debug', 0);
|
||||
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
|
||||
$this->assertEqual($result, CSS_URL . 'cake.generic.css');
|
||||
|
||||
Configure::write('Asset.timestamp', true);
|
||||
Configure::write('debug', 2);
|
||||
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
|
||||
$this->assertPattern('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||
|
||||
Configure::write('Asset.timestamp', 'force');
|
||||
Configure::write('debug', 0);
|
||||
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css');
|
||||
$this->assertPattern('/' . preg_quote(CSS_URL . 'cake.generic.css?', '/') . '[0-9]+/', $result);
|
||||
|
||||
$result = $this->Helper->assetTimestamp(CSS_URL . 'cake.generic.css?someparam');
|
||||
$this->assertEqual($result, CSS_URL . 'cake.generic.css?someparam');
|
||||
|
||||
Configure::write('debug', $_debug);
|
||||
Configure::write('Asset.timestamp', $_timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* testFieldsWithSameName method
|
||||
*
|
||||
|
|
|
@ -308,6 +308,15 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Html->image('cake.icon.gif');
|
||||
$this->assertTags($result, array('img' => array('src' => 'preg:/img\/cake\.icon\.gif\?\d+/', 'alt' => '')));
|
||||
|
||||
$webroot = $this->Html->webroot;
|
||||
$this->Html->webroot = '/testing/longer/';
|
||||
$result = $this->Html->image('cake.icon.gif');
|
||||
$expected = array(
|
||||
'img' => array('src' => 'preg:/\/testing\/longer\/img\/cake\.icon\.gif\?[0-9]+/', 'alt' => '')
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
$this->Html->webroot = $webroot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -332,6 +341,16 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
'src' => 'preg:/themed\/default\/img\/cake\.power\.gif\?\d+/',
|
||||
'alt' => ''
|
||||
)));
|
||||
|
||||
$webroot = $this->Html->webroot;
|
||||
$this->Html->webroot = '/testing/';
|
||||
$result = $this->Html->image('cake.power.gif');
|
||||
$this->assertTags($result, array(
|
||||
'img' => array(
|
||||
'src' => 'preg:/\/testing\/themed\/default\/img\/cake\.power\.gif\?\d+/',
|
||||
'alt' => ''
|
||||
)));
|
||||
$this->Html->webroot = $webroot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,14 +439,14 @@ class HtmlHelperTest extends CakeTestCase {
|
|||
$webroot = $this->Html->webroot;
|
||||
$this->Html->webroot = '/testing/';
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/\/testing\/css\/cake\.generic\.css\?/';
|
||||
$expected['link']['href'] = 'preg:/\/testing\/css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->Html->webroot = $webroot;
|
||||
|
||||
$webroot = $this->Html->webroot;
|
||||
$this->Html->webroot = '/testing/longer/';
|
||||
$result = $this->Html->css('cake.generic');
|
||||
$expected['link']['href'] = 'preg:/\/testing\/longer\/css\/cake\.generic\.css\?/';
|
||||
$expected['link']['href'] = 'preg:/\/testing\/longer\/css\/cake\.generic\.css\?[0-9]+/';
|
||||
$this->assertTags($result, $expected);
|
||||
$this->Html->webroot = $webroot;
|
||||
}
|
||||
|
|
|
@ -278,11 +278,11 @@ class JavascriptTest extends CakeTestCase {
|
|||
|
||||
$this->Javascript->webroot = '/testing/';
|
||||
$result = $this->Javascript->link('__cake_js_test');
|
||||
$this->assertPattern('/^<script[^<>]+src="\/testing\/js\/__cake_js_test\.js\?"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+src="\/testing\/js\/__cake_js_test\.js\?\d+"[^<>]*>/', $result);
|
||||
|
||||
$this->Javascript->webroot = '/testing/longer/';
|
||||
$result = $this->Javascript->link('__cake_js_test');
|
||||
$this->assertPattern('/^<script[^<>]+src="\/testing\/longer\/js\/__cake_js_test\.js\?"[^<>]*>/', $result);
|
||||
$this->assertPattern('/^<script[^<>]+src="\/testing\/longer\/js\/__cake_js_test\.js\?\d+"[^<>]*>/', $result);
|
||||
|
||||
$this->Javascript->webroot = $webroot;
|
||||
Configure::write('debug', $debug);
|
||||
|
|
|
@ -160,6 +160,12 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
$expected = '$.ajax({url:"\\/posts\\/view\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request(array('controller' => 'posts', 'action' => 'view', 1), array(
|
||||
'update' => '#content'
|
||||
));
|
||||
$expected = '$.ajax({success:function (data, textStatus) {$("#content").html(data);}, url:"\/posts\/view\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
'method' => 'post',
|
||||
'before' => 'doBefore',
|
||||
|
@ -179,7 +185,7 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
'method' => 'post',
|
||||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({success:function (msg, status) {$("#updated").html(msg);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$expected = '$.ajax({success:function (data, textStatus) {$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
|
@ -190,7 +196,7 @@ class JqueryEngineHelperTestCase extends CakeTestCase {
|
|||
'data' => '$("#someId").serialize()',
|
||||
'wrapCallbacks' => false
|
||||
));
|
||||
$expected = '$.ajax({data:$("#someId").serialize(), success:function (msg, status) {$("#updated").html(msg);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$expected = '$.ajax({data:$("#someId").serialize(), success:function (data, textStatus) {$("#updated").html(data);}, type:"post", url:"\\/people\\/edit\\/1"});';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->Jquery->request('/people/edit/1', array(
|
||||
|
|
|
@ -419,6 +419,17 @@ CODE;
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that Object::Object() is not breaking json output in JsHelper
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testObjectPassThrough() {
|
||||
$result = $this->Js->object(array('one' => 'first', 'two' => 'second'));
|
||||
$expected = '{"one":"first","two":"second"}';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
App::import('Helper', array('Html', 'Paginator', 'Form', 'Ajax', 'Javascript'));
|
||||
App::import('Helper', array('Html', 'Paginator', 'Form', 'Ajax', 'Javascript', 'Js'));
|
||||
|
||||
Mock::generate('JsHelper', 'PaginatorMockJsHelper');
|
||||
|
||||
/**
|
||||
* PaginatorHelperTest class
|
||||
|
@ -40,7 +42,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
function setUp() {
|
||||
$this->Paginator = new PaginatorHelper();
|
||||
$this->Paginator = new PaginatorHelper(array('ajax' => 'Ajax'));
|
||||
$this->Paginator->params['paging'] = array(
|
||||
'Article' => array(
|
||||
'current' => 9,
|
||||
|
@ -1682,5 +1684,31 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test that mock classes injected into paginatorHelper are called when using link()
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testMockAjaxProviderClassInjection() {
|
||||
$Paginator =& new PaginatorHelper(array('ajax' => 'PaginatorMockJs'));
|
||||
$Paginator->params['paging'] = array(
|
||||
'Article' => array(
|
||||
'current' => 9,
|
||||
'count' => 62,
|
||||
'prevPage' => false,
|
||||
'nextPage' => true,
|
||||
'pageCount' => 7,
|
||||
'defaults' => array(),
|
||||
'options' => array()
|
||||
)
|
||||
);
|
||||
$Paginator->PaginatorMockJs =& new PaginatorMockJsHelper();
|
||||
$Paginator->PaginatorMockJs->expectOnce('link');
|
||||
$result = $Paginator->link('Page 2', array('page' => 2), array('update' => '#content'));
|
||||
|
||||
$this->expectError();
|
||||
$Paginator =& new PaginatorHelper(array('ajax' => 'Form'));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
|
||||
/**
|
||||
* Test Plugin Auth User Model
|
||||
*
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework (http://www.cakephp.org)
|
||||
* Copyright 2006-2008, Cake Software Foundation, Inc.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.test_app.plugins.test_plugin
|
||||
* @since CakePHP v 1.2.0.4487
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
class TestPluginAuthUser extends TestPluginAppModel {
|
||||
|
||||
/**
|
||||
* Name property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $name = 'TestPluginAuthUser';
|
||||
|
||||
/**
|
||||
* useTable property
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
var $useTable = 'auth_users';
|
||||
|
||||
/**
|
||||
* useDbConfig property
|
||||
*
|
||||
* @var string 'test_suite'
|
||||
* @access public
|
||||
*/
|
||||
var $useDbConfig = 'test_suite';
|
||||
}
|
Loading…
Add table
Reference in a new issue