Merge branch '2.0' into 2.1

Conflicts:
	lib/Cake/Model/Datasource/Database/Postgres.php
	lib/Cake/Test/Case/Console/TaskCollectionTest.php
	lib/Cake/Test/Case/Model/ModelIntegrationTest.php
	lib/Cake/Test/Case/Utility/ClassRegistryTest.php
	lib/Cake/Utility/ClassRegistry.php
This commit is contained in:
mark_story 2011-12-11 22:51:40 -05:00
commit 2e8498e166
162 changed files with 920 additions and 306 deletions

View file

@ -200,6 +200,7 @@
* timestamping regardless of debug value.
*/
//Configure::write('Asset.timestamp', true);
/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.

View file

@ -19,6 +19,7 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Helper', 'View');
/**

View file

@ -374,6 +374,7 @@ class Cache {
self::set(null, $config);
return $success;
}
/**
* Decrement a number under the key and return decremented value.
*
@ -401,6 +402,7 @@ class Cache {
self::set(null, $config);
return $success;
}
/**
* Delete a key from the cache.
*

View file

@ -21,7 +21,11 @@
*/
/**
* File Storage engine for cache
* File Storage engine for cache. Filestorage is the slowest cache storage
* to read and write. However, it is good for servers that don't have other storage
* engine available, or have content which is not performance sensitive.
*
* You can configure a FileEngine cache, using Cache::config()
*
* @package Cake.Cache.Engine
*/

View file

@ -110,6 +110,7 @@ class XcacheEngine extends CacheEngine {
public function decrement($key, $offset = 1) {
return xcache_dec($key, $offset);
}
/**
* Delete a key from the cache
*

View file

@ -24,6 +24,8 @@ App::uses('File', 'Utility');
/**
* API shell to show method signatures of CakePHP core classes.
*
* Implementation of a Cake Shell to show CakePHP core method signatures.
*
* @package Cake.Console.Command
*/
class ApiShell extends AppShell {
@ -151,6 +153,7 @@ class ApiShell extends AppShell {
))->description(__d('cake_console', 'Lookup doc block comments for classes in CakePHP.'));
return $parser;
}
/**
* Show help for this shell.
*

View file

@ -24,7 +24,11 @@ App::uses('AppShell', 'Console/Command');
App::uses('Model', 'Model');
/**
* Bake is a command-line code generation utility for automating programmer chores.
* Command-line code generation utility to automate programmer chores.
*
* Bake is CakePHP's code generation script, which can help you kickstart
* application development by writing fully functional skeleton controllers,
* models, and views. Going further, Bake can also write Unit Tests for you.
*
* @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html

View file

@ -27,6 +27,9 @@ App::uses('CakeSchema', 'Model');
/**
* Schema is a command-line database management utility for automating programmer chores.
*
* Schema is CakePHP's database management utility. This helps you maintain versions of
* of your database.
*
* @package Cake.Console.Command
* @link http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html
*/

View file

@ -101,10 +101,12 @@ class ModelTask extends BakeTask {
return $this->all();
}
$model = $this->_modelName($this->args[0]);
$object = $this->_getModelObject($model);
$this->listAll($this->connection);
$useTable = $this->getTable($model);
$object = $this->_getModelObject($model, $useTable);
if ($this->bake($object, false)) {
if ($this->_checkUnitTest()) {
$this->bakeFixture($model);
$this->bakeFixture($model, $useTable);
$this->bakeTest($model);
}
}
@ -822,12 +824,14 @@ class ModelTask extends BakeTask {
public function listAll($useDbConfig = null) {
$this->_tables = (array) $this->getAllTables($useDbConfig);
$this->_modelNames = array();
$count = count($this->_tables);
for ($i = 0; $i < $count; $i++) {
$this->_modelNames[] = $this->_modelName($this->_tables[$i]);
}
if ($this->interactive === true) {
$this->out(__d('cake_console', 'Possible Models based on your current database:'));
$this->_modelNames = array();
$count = count($this->_tables);
for ($i = 0; $i < $count; $i++) {
$this->_modelNames[] = $this->_modelName($this->_tables[$i]);
$this->out($i + 1 . ". " . $this->_modelNames[$i]);
}
}
@ -842,26 +846,27 @@ class ModelTask extends BakeTask {
* @return string Table name
*/
public function getTable($modelName, $useDbConfig = null) {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
$db = ConnectionManager::getDataSource($useDbConfig);
$useTable = Inflector::tableize($modelName);
if (in_array($modelName, $this->_modelNames)) {
$modelNames = array_flip($this->_modelNames);
$useTable = $this->_tables[$modelNames[$modelName]];
}
$fullTableName = $db->fullTableName($useTable, false);
$tableIsGood = false;
if (array_search($useTable, $this->_tables) === false) {
$this->out();
$this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
}
if (strtolower($tableIsGood) == 'n') {
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
if ($this->interactive === true) {
if (!isset($useDbConfig)) {
$useDbConfig = $this->connection;
}
$db = ConnectionManager::getDataSource($useDbConfig);
$fullTableName = $db->fullTableName($useTable, false);
$tableIsGood = false;
if (array_search($useTable, $this->_tables) === false) {
$this->out();
$this->out(__d('cake_console', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
$tableIsGood = $this->in(__d('cake_console', 'Do you want to use this table?'), array('y', 'n'), 'y');
}
if (strtolower($tableIsGood) == 'n') {
$useTable = $this->in(__d('cake_console', 'What is the name of the table?'));
}
}
return $useTable;
}

View file

@ -21,7 +21,7 @@ App::uses('File', 'Utility');
App::uses('Folder', 'Utility');
/**
* Task class for creating a plugin
* The Plugin Task handles creating an empty plugin, ready to be used
*
* @package Cake.Console.Command.Task
*/

View file

@ -288,9 +288,7 @@ class ProjectTask extends AppShell {
$File = new File($path . 'Config' . DS . 'core.php');
$contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
if (!class_exists('Security')) {
require CAKE . 'Utility' . DS . 'security.php';
}
App::uses('Security', 'Utility');
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents);
if ($File->write($result)) {

View file

@ -554,6 +554,7 @@ class UpgradeShell extends AppShell {
);
$this->_filesRegexpUpdate($patterns);
}
/**
* Move application views files to where they now should be
*

View file

@ -79,6 +79,14 @@ class Shell extends Object {
*/
public $name = null;
/**
* The name of the plugin the shell belongs to.
* Is automatically set by ShellDispatcher when a shell is constructed.
*
* @var string
*/
public $plugin = null;
/**
* Contains tasks to load and instantiate
*
@ -409,7 +417,8 @@ class Shell extends Object {
* @link http://book.cakephp.org/2.0/en/console-and-shells.html#Shell::getOptionParser
*/
public function getOptionParser() {
$parser = new ConsoleOptionParser($this->name);
$name = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
$parser = new ConsoleOptionParser($name);
return $parser;
}
@ -716,10 +725,10 @@ class Shell extends Object {
}
/**
* Creates the proper controller camelized name (singularized) for the specified name
* Creates the proper model camelized name (singularized) for the specified name
*
* @param string $name Name
* @return string Camelized and singularized controller name
* @return string Camelized and singularized model name
*/
protected function _modelName($name) {
return Inflector::camelize(Inflector::singularize($name));

View file

@ -219,6 +219,7 @@ class ShellDispatcher {
));
}
$Shell = new $class();
$Shell->plugin = trim($plugin, '.');
return $Shell;
}

View file

@ -200,6 +200,7 @@
* timestamping regardless of debug value.
*/
//Configure::write('Asset.timestamp', true);
/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.

View file

@ -365,6 +365,7 @@ form .submit input[type=submit] {
form .submit input[type=submit]:hover {
background: #5BA150;
}
/* Form errors */
form .error {
background: #FFDACC;
@ -646,6 +647,7 @@ pre {
overflow: auto;
text-shadow: none;
}
/* excerpt */
.cake-code-dump pre,
.cake-code-dump pre code {

View file

@ -24,6 +24,7 @@
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
@ -37,6 +38,7 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
* The actual directory name for the "app".
*

View file

@ -24,6 +24,7 @@ ini_set('display_errors', 1);
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
@ -37,6 +38,7 @@ ini_set('display_errors', 1);
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
* The actual directory name for the "app".
*

View file

@ -18,6 +18,14 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Error Handling Controller
*
* Controller used by ErrorHandler to render error views.
*
* @package Cake.Controller
*/
class CakeErrorController extends AppController {
/**

View file

@ -100,6 +100,7 @@ class DigestAuthenticate extends BaseAuthenticate {
$this->settings['opaque'] = md5($this->settings['realm']);
}
}
/**
* Authenticate a user using Digest HTTP auth. Will use the configured User model and attempt a
* login using Digest HTTP auth.
@ -142,6 +143,7 @@ class DigestAuthenticate extends BaseAuthenticate {
}
return false;
}
/**
* Find a user record using the standard options.
*

View file

@ -22,7 +22,11 @@
App::uses('Xml', 'Utility');
/**
* Request object for handling HTTP requests
* Request object for handling alternative HTTP requests
*
* Alternative HTTP requests can come from wireless units like mobile phones, palmtop computers,
* and the like. These units have no use for Ajax requests, and this Component can tell how Cake
* should respond to the different needs of a handheld computer and a desktop machine.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html

View file

@ -22,7 +22,14 @@ App::uses('String', 'Utility');
App::uses('Security', 'Utility');
/**
* SecurityComponent
* The Security Component creates an easy way to integrate tighter security in
* your application. It provides methods for various tasks like:
*
* - Restricting which HTTP methods your application accepts.
* - CSRF protection.
* - Form tampering protection
* - Requiring that SSL be used.
* - Limiting cross controller communication.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html

View file

@ -1,6 +1,6 @@
<?php
/**
* SessionComponent. Provides access to Sessions from the Controller layer
* SessionComponent. Provides access to Sessions from the Controller layer
*
* PHP 5
*
@ -21,9 +21,9 @@ App::uses('Component', 'Controller');
App::uses('CakeSession', 'Model/Datasource');
/**
* Session Component.
*
* Session handling from the controller.
* The CakePHP SessionComponent provides a way to persist client data between
* page requests. It acts as a wrapper for the `$_SESSION` as well as providing
* convenience methods for several `$_SESSION` related functions.
*
* @package Cake.Controller.Component
* @link http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html

View file

@ -19,6 +19,12 @@
App::uses('ObjectCollection', 'Utility');
App::uses('Component', 'Controller');
/**
* Components collection is used as a registry for loaded components and handles loading
* and constructing component class objects.
*
* @package Cake.Controller
*/
class ComponentCollection extends ObjectCollection {
/**

View file

@ -18,7 +18,8 @@
*/
/**
* CakePlugin class
* CakePlugin is responsible for loading and unloading plugins. It also can
* retrieve plugin paths and load their bootstrap and routes files.
*
* @package Cake.Core
* @link http://book.cakephp.org/2.0/en/plugins.html

View file

@ -152,9 +152,7 @@ class Object {
* @return boolean Success of log write
*/
public function log($msg, $type = LOG_ERROR) {
if (!class_exists('CakeLog')) {
require CAKE . 'cake_log.php';
}
App::uses('CakeLog', 'Log');
if (!is_string($msg)) {
$msg = print_r($msg, true);
}

View file

@ -224,7 +224,7 @@ class ExceptionRenderer {
public function error500($error) {
$message = $error->getMessage();
if (Configure::read('debug') == 0) {
$message = __d('cake', 'An Internal Error Has Occurred');
$message = __d('cake', 'An Internal Error Has Occurred.');
}
$url = $this->controller->request->here();
$code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500;

View file

@ -226,6 +226,7 @@ class MissingActionException extends CakeException {
parent::__construct($message, $code);
}
}
/**
* Private Action exception - used when a controller action
* starts with a `_`.

View file

@ -96,7 +96,7 @@ class I18n {
*
* @return void
*/
protected function __construct() {
public function __construct() {
$this->l10n = new L10n();
}

View file

@ -16,15 +16,11 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Load Model and AppModel
*/
App::uses('AppModel', 'Model');
/**
* ACL Node
*
*
* @package Cake.Model
*/
class AclNode extends AppModel {

View file

@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Load Model and AppModel
*/
App::uses('AppModel', 'Model');
/**

View file

@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Load Model and AppModel
*/
App::uses('AppModel', 'Model');
/**

View file

@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Load Model and AppModel
*/
App::uses('AppModel', 'Model');
/**

View file

@ -23,6 +23,8 @@ App::uses('AclNode', 'Model');
/**
* ACL behavior
*
* Enables objects to easily tie into an ACL system
*
* @package Cake.Model.Behavior
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/acl.html
*/

View file

@ -20,8 +20,9 @@
*/
/**
* Behavior to allow for dynamic and atomic manipulation of a Model's associations used for a find call. Most useful for limiting
* the amount of associations and data returned.
* Behavior to allow for dynamic and atomic manipulation of a Model's associations
* used for a find call. Most useful for limiting the amount of associations and
* data returned.
*
* @package Cake.Model.Behavior
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html

View file

@ -16,6 +16,7 @@
* @since CakePHP(tm) v 1.2.0.5550
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
App::uses('ConnectionManager', 'Model');
@ -247,7 +248,12 @@ class CakeSchema extends Object {
continue;
}
$Object = ClassRegistry::init(array('class' => $model, 'ds' => $connection));
try {
$Object = ClassRegistry::init(array('class' => $model, 'ds' => $connection));
} catch (CakeException $e) {
continue;
}
$db = $Object->getDataSource();
if (is_object($Object) && $Object->useTable !== false) {
$fulltable = $table = $db->fullTableName($Object, false, false);

View file

@ -24,6 +24,9 @@ App::uses('DataSource', 'Model/Datasource');
/**
* Manages loaded instances of DataSource objects
*
* Provides an interface for loading and enumerating connections defined in
* app/Config/database.php
*
* @package Cake.Model
*/
class ConnectionManager {

View file

@ -22,8 +22,6 @@ App::uses('DboSource', 'Model/Datasource');
/**
* PostgreSQL layer for DBO.
*
* Long description for class
*
* @package Cake.Model.Datasource.Database
*/
class Postgres extends DboSource {
@ -297,12 +295,12 @@ class Postgres extends DboSource {
*
* @param mixed $table A string or model class representing the table to be truncated
* @param boolean $reset true for resetting the sequence, false to leave it as is.
* and if 1, sequences are not modified
* and if 1, sequences are not modified
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
*/
public function truncate($table, $reset = 0) {
$table = $this->fullTableName($table, false, false);
if (!isset($this->_sequenceMap[$table])) {
public function truncate($table, $reset = false) {
$fullTable = $this->fullTableName($table, false);
if (!isset($this->_sequenceMap[$fullTable])) {
$cache = $this->cacheSources;
$this->cacheSources = false;
$this->describe($table);
@ -310,9 +308,8 @@ class Postgres extends DboSource {
}
if ($this->execute('DELETE FROM ' . $this->fullTableName($table))) {
$schema = $this->config['schema'];
$table = $this->fullTableName($table, false, false);
if (isset($this->_sequenceMap[$table]) && $reset !== 1) {
foreach ($this->_sequenceMap[$table] as $field => $sequence) {
if (isset($this->_sequenceMap[$fullTable]) && $reset != true) {
foreach ($this->_sequenceMap[$fullTable] as $field => $sequence) {
$this->_execute("ALTER SEQUENCE \"{$schema}\".\"{$sequence}\" RESTART WITH 1");
}
}

View file

@ -585,6 +585,7 @@ class Sqlserver extends DboSource {
return parent::value($data, $column);
}
}
/**
* Returns an array of all result rows for a given SQL query.
* Returns false if no rows matched.
@ -742,6 +743,7 @@ class Sqlserver extends DboSource {
}
return $affected;
}
/**
* Executes given SQL statement.
*

View file

@ -19,9 +19,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Included libs
*/
App::uses('ClassRegistry', 'Utility');
App::uses('Validation', 'Utility');
App::uses('String', 'Utility');
@ -709,6 +706,11 @@ class Model extends Object {
} elseif ($this->table === false) {
$this->table = Inflector::tableize($this->name);
}
if ($this->tablePrefix === null) {
unset($this->tablePrefix);
}
$this->_createLinks();
$this->Behaviors->init($this->alias, $this->actsAs);
}
@ -808,6 +810,13 @@ class Model extends Object {
if ($name === 'displayField') {
return $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey));
}
if ($name === 'tablePrefix') {
$this->setDataSource();
if (property_exists($this, 'tablePrefix')) {
return $this->tablePrefix;
}
return $this->tablePrefix = null;
}
if (isset($this->{$name})) {
return $this->{$name};
}
@ -1193,12 +1202,14 @@ class Model extends Object {
}
}
$format = $this->getDataSource()->columns[$type]['format'];
$day = empty($date['Y']) ? null : $date['Y'] . '-' . $date['m'] . '-' . $date['d'] . ' ';
$hour = empty($date['H']) ? null : $date['H'] . ':' . $date['i'] . ':' . $date['s'];
$date = new DateTime($day . $hour);
if ($useNewDate && !empty($date)) {
return $date->format($format);
$format = $this->getDataSource()->columns[$type]['format'];
foreach (array('m', 'd', 'H', 'i', 's') as $index) {
if (isset($date[$index])) {
$date[$index] = sprintf('%02d', $date[$index]);
}
}
return str_replace(array_keys($date), array_values($date), $format);
}
}
return $data;
@ -3090,6 +3101,7 @@ class Model extends Object {
}
return $valid;
}
/**
* Marks a field as invalid, optionally setting the name of validation
* rule (in case of multiple validation for field) that was broken.

View file

@ -16,9 +16,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Load Model and AppModel
*/
App::uses('AppModel', 'Model');
/**

View file

@ -223,7 +223,7 @@ class CakeRequest implements ArrayAccess {
$uri = substr($uri, strlen($base));
}
if (strpos($uri, '?') !== false) {
$uri = parse_url($uri, PHP_URL_PATH);
list($uri) = explode('?', $uri, 2);
}
if (empty($uri) || $uri == '/' || $uri == '//') {
return '/';

View file

@ -16,6 +16,7 @@
* @since CakePHP(tm) v 1.2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Validation', 'Utility');
/**

View file

@ -18,7 +18,7 @@
*/
/**
* Abstract class
* Abstract transport for sending email
*
* @package Cake.Network.Email
*/

View file

@ -16,6 +16,7 @@
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Validation', 'Utility');
App::uses('Multibyte', 'I18n');
App::uses('AbstractTransport', 'Network/Email');

View file

@ -18,7 +18,7 @@
*/
/**
* Mail class
* Send mail using mail() function
*
* @package Cake.Network.Email
*/

View file

@ -16,10 +16,11 @@
* @since CakePHP(tm) v 2.0.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeSocket', 'Network');
/**
* SendEmail class
* Send mail using SMTP protocol
*
* @package Cake.Network.Email
*/

View file

@ -18,7 +18,7 @@
*/
/**
* HTTP Response
* HTTP Response from HttpSocket.
*
* @package Cake.Network.Http
*/

View file

@ -159,7 +159,30 @@ class HttpSocket extends CakeSocket {
}
/**
* Set authentication settings
* Set authentication settings.
*
* Accepts two forms of parameters. If all you need is a username + password, as with
* Basic authentication you can do the following:
*
* {{{
* $http->configAuth('Basic', 'mark', 'secret');
* }}}
*
* If you are using an authentication strategy that requires more inputs, like Digest authentication
* you can call `configAuth()` with an array of user information.
*
* {{{
* $http->configAuth('Digest', array(
* 'user' => 'mark',
* 'pass' => 'secret',
* 'realm' => 'my-realm',
* 'nonce' => 1235
* ));
* }}}
*
* To remove any set authentication strategy, call `configAuth()` with no parameters:
*
* `$http->configAuth();`
*
* @param string $method Authentication method (ie. Basic, Digest). If empty, disable authentication
* @param mixed $user Username for authentication. Can be an array with settings to authentication class
@ -275,17 +298,17 @@ class HttpSocket extends CakeSocket {
if (!empty($this->request['cookies'])) {
$cookies = $this->buildCookies($this->request['cookies']);
}
$schema = '';
$scheme = '';
$port = 0;
if (isset($this->request['uri']['schema'])) {
$schema = $this->request['uri']['schema'];
if (isset($this->request['uri']['scheme'])) {
$scheme = $this->request['uri']['scheme'];
}
if (isset($this->request['uri']['port'])) {
$port = $this->request['uri']['port'];
}
if (
($schema === 'http' && $port != 80) ||
($schema === 'https' && $port != 443) ||
($scheme === 'http' && $port != 80) ||
($scheme === 'https' && $port != 443) ||
($port != 80 && $port != 443)
) {
$Host .= ':' . $port;

View file

@ -20,9 +20,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* List of helpers to include
*/
App::uses('Router', 'Routing');
App::uses('CakeRequest', 'Network');
App::uses('CakeResponse', 'Network');

View file

@ -11,6 +11,7 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Set', 'Utility');
/**

View file

@ -1,11 +1,5 @@
<?php
App::uses('CakeRoute', 'Routing/Route');
/**
* Plugin short route, that copies the plugin param to the controller parameters
* It is used for supporting /:plugin routes.
*
* PHP5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@ -14,14 +8,22 @@ App::uses('CakeRoute', 'Routing/Route');
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Routing.Route
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeRoute', 'Routing/Route');
/**
* Plugin short route, that copies the plugin param to the controller parameters
* It is used for supporting /:plugin routes.
*
* @package Cake.Routing.Route
*/
class PluginShortRoute extends CakeRoute {
/**
* Parses a string url into an array. If a plugin key is found, it will be copied to the
* Parses a string url into an array. If a plugin key is found, it will be copied to the
* controller parameter
*
* @param string $url The url to parse
@ -37,7 +39,7 @@ class PluginShortRoute extends CakeRoute {
}
/**
* Reverse route plugin shortcut urls. If the plugin and controller
* Reverse route plugin shortcut urls. If the plugin and controller
* are not the same the match is an auto fail.
*
* @param array $url Array of parameters to convert to a string.

View file

@ -1,14 +1,5 @@
<?php
App::uses('CakeResponse', 'Network');
App::uses('CakeRoute', 'Routing/Route');
/**
* Redirect route will perform an immediate redirect. Redirect routes
* are useful when you want to have Routing layer redirects occur in your
* application, for when URLs move.
*
* PHP5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@ -21,6 +12,17 @@ App::uses('CakeRoute', 'Routing/Route');
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeResponse', 'Network');
App::uses('CakeRoute', 'Routing/Route');
/**
* Redirect route will perform an immediate redirect. Redirect routes
* are useful when you want to have Routing layer redirects occur in your
* application, for when URLs move.
*
* @package Cake.Routing.Route
*/
class RedirectRoute extends CakeRoute {
/**
@ -31,7 +33,7 @@ class RedirectRoute extends CakeRoute {
public $response = null;
/**
* The location to redirect to. Either a string or a cake array url.
* The location to redirect to. Either a string or a cake array url.
*
* @var mixed
*/
@ -100,7 +102,7 @@ class RedirectRoute extends CakeRoute {
}
/**
* Stop execution of the current script. Wraps exit() making
* Stop execution of the current script. Wraps exit() making
* testing easier.
*
* @param integer|string $status see http://php.net/exit for values

View file

@ -80,6 +80,7 @@ class BasicsTest extends CakeTestCase {
$this->assertEquals($result, array());
}
/**
* testHttpBase method
*

View file

@ -45,7 +45,7 @@ class FileEngineTest extends CakeTestCase {
}
/**
* teardown method
* tearDown method
*
* @return void
*/

View file

@ -364,6 +364,7 @@ class MemcacheEngineTest extends CakeTestCase {
Cache::clear(false, 'memcache2');
}
/**
* test that a 0 duration can succesfully write.
*

View file

@ -32,8 +32,8 @@ class IniReaderTest extends CakeTestCase {
*
* @return void
*/
public function setup() {
parent::setup();
public function setUp() {
parent::setUp();
$this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
}

View file

@ -28,6 +28,7 @@ class PhpReaderTest extends CakeTestCase {
parent::setUp();
$this->path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
}
/**
* test reading files
*

View file

@ -37,11 +37,12 @@ class AclShellTest extends CakeTestCase {
public $fixtures = array('core.aco', 'core.aro', 'core.aros_aco');
/**
* setup method
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
Configure::write('Acl.database', 'test');
Configure::write('Acl.classname', 'DbAcl');

View file

@ -59,7 +59,7 @@ class BakeShellTest extends CakeTestCase {
}
/**
* teardown method
* tearDown method
*
* @return void
*/

View file

@ -60,7 +60,7 @@ class CommandListShellTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/

View file

@ -97,7 +97,7 @@ class SchemaShellTest extends CakeTestCase {
);
/**
* setup method
* setUp method
*
* @return void
*/

View file

@ -64,6 +64,7 @@ class ControllerTaskTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ControllerTask',
@ -86,14 +87,15 @@ class ControllerTaskTest extends CakeTestCase {
}
/**
* teardown method
* tearDown method
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->Task);
ClassRegistry::flush();
App::build();
parent::tearDown();
}
/**

View file

@ -31,7 +31,7 @@ App::uses('DbConfigTask', 'Console/Command/Task');
class DbConfigTaskTest extends CakeTestCase {
/**
* setup method
* setUp method
*
* @return void
*/

View file

@ -95,7 +95,7 @@ class ModelTaskTest extends CakeTestCase {
}
/**
* teardown method
* tearDown method
*
* @return void
*/
@ -205,7 +205,7 @@ class ModelTaskTest extends CakeTestCase {
*
* @return void
*/
public function testGetTableOddTable() {
public function testGetTableOddTableInteractive() {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask',
@ -233,6 +233,34 @@ class ModelTaskTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
/**
* test getTable with non-conventional tablenames
*
* @return void
*/
public function testGetTableOddTable() {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask',
array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables'),
array($out, $out, $in)
);
$this->_setupOtherMocks();
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->interactive = false;
$this->Task->args = array('BakeOdd');
$this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
$this->Task->listAll();
$result = $this->Task->getTable('BakeOdd');
$expected = 'bake_odd';
$this->assertEquals($expected, $result);
}
/**
* test that initializing the validations works.
*
@ -970,6 +998,61 @@ STRINGEND;
$this->Task->execute();
}
/**
* test that odd tablenames arent inflected back from modelname
*
* @return void
*/
public function testExecuteIntoBakeOddTables() {
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask',
array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables', '_getModelObject', 'bake', 'bakeFixture'),
array($out, $out, $in)
);
$this->_setupOtherMocks();
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->args = array('BakeOdd');
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
$this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
$object = new Model(array('name' => 'BakeOdd', 'table' => 'bake_odd', 'ds' => 'test'));
$this->Task->expects($this->once())->method('_getModelObject')->with('BakeOdd', 'bake_odd')->will($this->returnValue($object));
$this->Task->expects($this->once())->method('bake')->with($object, false)->will($this->returnValue(true));
$this->Task->expects($this->once())->method('bakeFixture')->with('BakeOdd', 'bake_odd');
$this->Task->execute();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
$this->Task = $this->getMock('ModelTask',
array('in', 'err', '_stop', '_checkUnitTest', 'getAllTables', '_getModelObject', 'doAssociations', 'doValidation', 'createFile'),
array($out, $out, $in)
);
$this->_setupOtherMocks();
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->args = array('BakeOdd');
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
$this->Task->expects($this->once())->method('getAllTables')->will($this->returnValue(array('articles', 'bake_odd')));
$object = new Model(array('name' => 'BakeOdd', 'table' => 'bake_odd', 'ds' => 'test'));
$this->Task->expects($this->once())->method('_getModelObject')->will($this->returnValue($object));
$this->Task->expects($this->once())->method('doAssociations')->will($this->returnValue(array()));
$this->Task->expects($this->once())->method('doValidation')->will($this->returnValue(array()));
$filename = '/my/path/BakeOdd.php';
$this->Task->expects($this->once())->method('createFile')
->with($filename, $this->stringContains('class BakeOdd'));
$filename = '/my/path/BakeOdd.php';
$this->Task->expects($this->once())->method('createFile')
->with($filename, $this->stringContains('public $useTable = \'bake_odd\''));
$this->Task->execute();
}
/**
* test that skipTables changes how all() works.
*

View file

@ -36,7 +36,7 @@ App::uses('File', 'Utility');
class PluginTaskTest extends CakeTestCase {
/**
* setup method
* setUp method
*
* @return void
*/

View file

@ -35,7 +35,7 @@ App::uses('File', 'Utility');
class ProjectTaskTest extends CakeTestCase {
/**
* setup method
* setUp method
*
* @return void
*/
@ -52,7 +52,7 @@ class ProjectTaskTest extends CakeTestCase {
}
/**
* teardown method
* tearDown method
*
* @return void
*/

View file

@ -19,12 +19,12 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('ShellDispatcher', 'Console');
App::uses('ConsoleOutput', 'Console');
App::uses('ConsoleInput', 'Console');
App::uses('Shell', 'Console');
App::uses('TemplateTask', 'Console/Command/Task');
/**
* TemplateTaskTest class
*
@ -33,11 +33,11 @@ App::uses('TemplateTask', 'Console/Command/Task');
class TemplateTaskTest extends CakeTestCase {
/**
* setup method
* setUp method
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
@ -49,7 +49,7 @@ class TemplateTaskTest extends CakeTestCase {
}
/**
* teardown method
* tearDown method
*
* @return void
*/

View file

@ -220,12 +220,12 @@ class TestTaskTest extends CakeTestCase {
public $fixtures = array('core.article', 'core.comment', 'core.articles_tag', 'core.tag');
/**
* setup method
* setUp method
*
* @return void
*/
public function setup() {
parent::setup();
public function setUp() {
parent::setUp();
$out = $this->getMock('ConsoleOutput', array(), array(), '', false);
$in = $this->getMock('ConsoleInput', array(), array(), '', false);

View file

@ -38,7 +38,7 @@ class ConsoleErrorHandlerTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/

View file

@ -422,6 +422,8 @@ class ShellDispatcherTest extends CakeTestCase {
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('test_plugin.example');
$this->assertInstanceOf('ExampleShell', $result);
$this->assertEquals('TestPlugin', $result->plugin);
$this->assertEquals('Example', $result->name);
$Dispatcher = new TestShellDispatcher();
$result = $Dispatcher->getShell('TestPlugin.example');

View file

@ -841,4 +841,17 @@ TEXT;
$expected = 'TestApple';
$this->assertEquals($expected, $this->Shell->TestApple->name);
}
/**
* Test that option parsers are created with the correct name/command.
*
* @return void
*/
public function testGetOptionParser() {
$this->Shell->name = 'test';
$this->Shell->plugin = 'plugin';
$parser = $this->Shell->getOptionParser();
$this->assertEquals('plugin.test', $parser->command());
}
}

View file

@ -22,23 +22,25 @@ App::uses('Shell', 'Console');
class TaskCollectionTest extends CakeTestCase {
/**
* setup
* setUp
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$shell = $this->getMock('Shell', array(), array(), '', false);
$dispatcher = $this->getMock('ShellDispatcher', array(), array(), '', false);
$this->Tasks = new TaskCollection($shell, $dispatcher);
}
/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->Tasks);
parent::tearDown();
}
/**
@ -55,6 +57,19 @@ class TaskCollectionTest extends CakeTestCase {
$this->assertEquals(array('DbConfig'), $result, 'attached() results are wrong.');
}
/**
* test load and enable = false
*
* @return void
*/
public function testLoadWithEnableFalse() {
$result = $this->Tasks->load('DbConfig', array('enabled' => false));
$this->assertInstanceOf('DbConfigTask', $result);
$this->assertInstanceOf('DbConfigTask', $this->Tasks->DbConfig);
$this->assertFalse($this->Tasks->enabled('DbConfig'), 'DbConfigTask should be disabled');
}
/**
* test missingtask exception
*

View file

@ -26,7 +26,7 @@ App::uses('CakeResponse', 'Network');
class ActionsAuthorizeTest extends CakeTestCase {
/**
* setup
* setUp
*
* @return void
*/

View file

@ -57,7 +57,7 @@ class BasicAuthenticateTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/
@ -163,6 +163,7 @@ class BasicAuthenticateTest extends CakeTestCase {
$result = $this->auth->authenticate($request, $this->response);
$this->assertFalse($result);
}
/**
* test authenticate sucesss
*

View file

@ -59,7 +59,7 @@ class DigestAuthenticateTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/

View file

@ -499,6 +499,7 @@ class CookieComponentTest extends CakeTestCase {
$this->assertNull($this->Cookie->read('User.email'));
$this->Cookie->destroy();
}
/**
* Test deleting recursively with keys that don't exist.
*

View file

@ -470,6 +470,7 @@ class DbAclTest extends CakeTestCase {
$this->Acl->deny('Bobs', 'ROOT/printers/DoesNotExist', 'create');
}
/**
* debug function - to help editing/creating test cases for the ACL component
*

View file

@ -45,6 +45,7 @@ class RequestHandlerTestController extends Controller {
$this->viewPath = 'Posts';
$this->render('index');
}
/**
* test method for ajax redirection + parameter parsing
*

View file

@ -29,21 +29,23 @@ class CookieAliasComponent extends CookieComponent {
class ComponentCollectionTest extends CakeTestCase {
/**
* setup
* setUp
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$this->Components = new ComponentCollection();
}
/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->Components);
parent::tearDown();
}
/**
@ -108,6 +110,7 @@ class ComponentCollectionTest extends CakeTestCase {
$this->assertFalse($this->Components->enabled('Cookie'), 'Cookie should be disabled');
}
/**
* test missingcomponent exception
*

View file

@ -34,6 +34,7 @@ class MergeVarsAppController extends Controller {
* @var array
*/
public $components = array('MergeVar' => array('flag', 'otherFlag', 'redirect' => false));
/**
* helpers
*
@ -42,7 +43,6 @@ class MergeVarsAppController extends Controller {
public $helpers = array('MergeVar' => array('format' => 'html', 'terse'));
}
/**
* MergeVar Component
*

View file

@ -35,12 +35,14 @@ class ControllerTestAppController extends Controller {
* @var array
*/
public $helpers = array('Html');
/**
* uses property
*
* @var array
*/
public $uses = array('ControllerPost');
/**
* components property
*
@ -305,6 +307,7 @@ class TestComponent extends Object {
*/
public function beforeRedirect() {
}
/**
* initialize method
*
@ -320,6 +323,7 @@ class TestComponent extends Object {
*/
public function startup(&$controller) {
}
/**
* shutdown method
*
@ -327,6 +331,7 @@ class TestComponent extends Object {
*/
public function shutdown(&$controller) {
}
/**
* beforeRender callback
*
@ -351,6 +356,7 @@ class AnotherTestController extends ControllerTestAppController {
* @var string 'Name'
*/
public $name = 'AnotherTest';
/**
* uses property
*
@ -358,6 +364,11 @@ class AnotherTestController extends ControllerTestAppController {
*/
public $uses = null;
/**
* merge parent
*
* @var string
*/
protected $_mergeParent = 'ControllerTestAppController';
}
@ -381,19 +392,21 @@ class ControllerTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
App::objects('plugin', null, false);
App::build();
Router::reload();
}
/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
CakePlugin::unload();
App::build();
parent::tearDown();
}
/**
@ -1112,6 +1125,7 @@ class ControllerTest extends CakeTestCase {
$Controller->startupProcess();
}
/**
* Tests that the shutdown process calls the correct functions
*

View file

@ -16,7 +16,6 @@
* @since CakePHP(tm) v 1.2.0.5436
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Router', 'Routing');
App::uses('Controller', 'Controller');
App::uses('Scaffold', 'Controller');
@ -105,8 +104,6 @@ class TestScaffoldMock extends Scaffold {
}
}
/**
* Scaffold Test class
*
@ -127,6 +124,7 @@ class ScaffoldTest extends CakeTestCase {
* @var array
*/
public $fixtures = array('core.article', 'core.user', 'core.comment', 'core.join_thing', 'core.tag');
/**
* setUp method
*
@ -273,6 +271,7 @@ class ScaffoldTest extends CakeTestCase {
$result = ob_get_clean();
$this->assertRegExp('/Scaffold Mock has been updated/', $result);
}
/**
* test that habtm relationship keys get added to scaffoldFields.
*
@ -308,6 +307,7 @@ class ScaffoldTest extends CakeTestCase {
$result = $Scaffold->controller->viewVars;
$this->assertEquals($result['scaffoldFields'], array('id', 'user_id', 'title', 'body', 'published', 'created', 'updated', 'ScaffoldTag'));
}
/**
* test that the proper names and variable values are set by Scaffold
*

View file

@ -29,12 +29,14 @@ App::uses('Router', 'Routing');
class ErrorHandlerTest extends CakeTestCase {
public $_restoreError = false;
/**
* setup create a request object to get out of router later.
*
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'View' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
@ -51,17 +53,18 @@ class ErrorHandlerTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
Configure::write('debug', $this->_debug);
Configure::write('Error', $this->_error);
App::build();
if ($this->_restoreError) {
restore_error_handler();
}
parent::tearDown();
}
/**

View file

@ -126,6 +126,7 @@ class MyCustomExceptionRenderer extends ExceptionRenderer {
echo 'widget thing is missing';
}
}
/**
* Exception class for testing app error handlers and custom errors.
*
@ -142,12 +143,14 @@ class MissingWidgetThingException extends NotFoundException { }
class ExceptionRendererTest extends CakeTestCase {
public $_restoreError = false;
/**
* setup create a request object to get out of router later.
*
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'views' => array(
CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS
@ -164,17 +167,18 @@ class ExceptionRendererTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
Configure::write('debug', $this->_debug);
Configure::write('Error', $this->_error);
App::build();
if ($this->_restoreError) {
restore_error_handler();
}
parent::tearDown();
}
/**
@ -406,6 +410,7 @@ class ExceptionRendererTest extends CakeTestCase {
$result = ob_get_clean();
$this->assertContains('Not Found', $result);
}
/**
* test that error400 doesn't expose XSS
*

View file

@ -2989,6 +2989,7 @@ class ContainableBehaviorTest extends CakeTestCase {
$this->assertFalse(isset($result[0]['Comment']['published']), 'published found %s');
$this->assertFalse(isset($result[0]['User']['password']), 'password found %s');
}
/**
* testFindConditionalBinding method
*
@ -3568,6 +3569,7 @@ class ContainableBehaviorTest extends CakeTestCase {
$this->assertTrue(isset($result[0]['Article']));
$this->assertTrue(isset($result[0]['User']));
}
/**
* test that autoFields doesn't splice in columns that aren't part of the join.
*

View file

@ -829,6 +829,7 @@ class TranslateBehaviorTest extends CakeTestCase {
);
$this->assertEquals($expected, $result);
}
/**
* testTranslateTableWithPrefix method
* Tests that is possible to have a translation model with a custom tablePrefix

View file

@ -1202,6 +1202,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->assertTrue($this->Tree->cacheQueries, 'cacheQueries was not restored after reorder(). %s');
$this->Tree->cacheQueries = $original;
}
/**
* testGenerateTreeListWithSelfJoin method
*

View file

@ -254,6 +254,7 @@ class TestBehavior extends ModelBehavior {
}
echo "onError trigger success";
}
/**
* beforeTest method
*

View file

@ -440,12 +440,14 @@ class SchemaPrefixAuthUser extends CakeTestModel {
* @var string
*/
public $name = 'SchemaPrefixAuthUser';
/**
* table prefix
*
* @var string
*/
public $tablePrefix = 'auth_';
/**
* useTable
*
@ -640,8 +642,11 @@ class CakeSchemaTest extends CakeTestCase {
*/
public function testSchemaReadWithConfigPrefix() {
$this->skipIf($this->db instanceof Sqlite, 'Cannot open 2 connections to Sqlite');
$db = ConnectionManager::getDataSource('test');
$config = $db->config;
$this->skipIf(!empty($config['prefix']), 'This test can not be executed with datasource prefix set.');
$config['prefix'] = 'schema_test_prefix_';
ConnectionManager::create('schema_prefix', $config);
$read = $this->Schema->read(array('connection' => 'schema_prefix', 'models' => false));
@ -743,6 +748,7 @@ class CakeSchemaTest extends CakeTestCase {
$result = $this->Schema->generateTable('posts', $posts);
$this->assertRegExp('/public \$posts/', $result);
}
/**
* testSchemaWrite method
*

View file

@ -24,7 +24,6 @@ App::uses('ConnectionManager', 'Model');
*/
class ConnectionManagerTest extends CakeTestCase {
/**
* tearDown method
*
@ -34,6 +33,7 @@ class ConnectionManagerTest extends CakeTestCase {
parent::tearDown();
CakePlugin::unload();
}
/**
* testEnumConnectionObjects method
*

View file

@ -71,8 +71,8 @@ class CakeSessionTest extends CakeTestCase {
*
* @return void
*/
public function setup() {
parent::setup();
public function setUp() {
parent::setUp();
Configure::write('Session', array(
'defaults' => 'php',
'cookie' => 'cakephp',
@ -382,7 +382,7 @@ class CakeSessionTest extends CakeTestCase {
*/
public function testCheckKeyWithSpaces() {
$this->assertTrue(TestCakeSession::write('Session Test', "test"));
$this->assertEquals('test', TestCakeSession::check('Session Test'));
$this->assertTrue(TestCakeSession::check('Session Test'));
TestCakeSession::delete('Session Test');
$this->assertTrue(TestCakeSession::write('Session Test.Test Case', "test"));
@ -526,6 +526,7 @@ class CakeSessionTest extends CakeTestCase {
App::build(array(
'plugins' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
), true);
CakePlugin::load('TestPlugin');
Configure::write('Session', array(
'defaults' => 'cake',

View file

@ -225,6 +225,7 @@ class MysqlTest extends CakeTestCase {
$this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
}
/**
* testLastAffected method
*

View file

@ -206,6 +206,7 @@ class PostgresTest extends CakeTestCase {
'core.tag', 'core.articles_tag', 'core.attachment', 'core.person', 'core.post', 'core.author',
'core.datatype',
);
/**
* Actual DB connection used in testing
*

View file

@ -163,6 +163,7 @@ class SqlserverTestModel extends Model {
'foreignKey' => 'client_id'
)
);
/**
* find method
*
@ -302,6 +303,7 @@ class SqlserverTest extends CakeTestCase {
$result = $this->db->value('', 'binary');
$this->assertSame($expected, $result);
}
/**
* testFields method
*
@ -459,6 +461,7 @@ class SqlserverTest extends CakeTestCase {
);
$this->assertEquals($expected, $result);
}
/**
* testBuildColumn
*
@ -521,6 +524,7 @@ class SqlserverTest extends CakeTestCase {
$expected = '[body] nvarchar(MAX)';
$this->assertEquals($expected, $result);
}
/**
* testBuildIndex method
*
@ -547,6 +551,7 @@ class SqlserverTest extends CakeTestCase {
$expected = array('ALTER TABLE items ADD CONSTRAINT client_id UNIQUE([client_id], [period_id]);');
$this->assertEquals($expected, $result);
}
/**
* testUpdateAllSyntax method
*

View file

@ -63,7 +63,7 @@ class CacheSessionTest extends CakeTestCase {
}
/**
* teardown
* tearDown
*
* @return void
*/

View file

@ -66,22 +66,24 @@ class DatabaseSessionTest extends CakeTestCase {
}
/**
* setup
* setUp
*
* @return void
*/
public function setup() {
public function setUp() {
parent::setUp();
$this->storage = new DatabaseSession();
}
/**
* teardown
* tearDown
*
* @return void
*/
public function teardown() {
public function tearDown() {
unset($this->storage);
ClassRegistry::flush();
parent::tearDown();
}
/**
@ -135,6 +137,7 @@ class DatabaseSessionTest extends CakeTestCase {
$result = $this->storage->write('', 'This is a Test');
$this->assertFalse($result);
}
/**
* test read()
*
@ -169,11 +172,14 @@ class DatabaseSessionTest extends CakeTestCase {
* @return void
*/
public function testGc() {
ClassRegistry::flush();
Configure::write('Session.timeout', 0);
$this->storage->write('foo', 'Some value');
$storage = new DatabaseSession();
$storage->write('foo', 'Some value');
sleep(1);
$this->storage->gc();
$this->assertFalse($this->storage->read('foo'));
$storage->gc();
$this->assertFalse($storage->read('foo'));
}
}

View file

@ -186,6 +186,7 @@ class DbAroUserTest extends CakeTestModel {
* @var string 'auth_users'
*/
public $useTable = 'auth_users';
/**
* bindNode method
*

View file

@ -32,6 +32,7 @@ class DboMock extends DboSource {
public function name($field) {
return $field;
}
/**
* Returns true to fake a database connection
*/
@ -2048,6 +2049,7 @@ class ModelIntegrationTest extends BaseModelTest {
$result = $TestModel->escapeField('DomainHandle', 'Domain');
$expected = $db->name('Domain.DomainHandle');
$this->assertEquals($expected, $result);
ConnectionManager::drop('mock');
}
/**

View file

@ -7447,6 +7447,7 @@ class ModelReadTest extends BaseModelTest {
);
$this->assertEquals($expected, $result);
}
/**
* Testing availability of $this->findQueryType in Model callbacks
*

Some files were not shown because too many files have changed in this diff Show more