Merge master in 1.3

This commit is contained in:
gwoo 2009-03-19 14:10:13 -07:00
parent 6cb8b3d286
commit 643651fe56
250 changed files with 2589 additions and 2019 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
1.2.1.8004
1.2.2.8120

View file

@ -198,10 +198,14 @@ class ShellDispatcher {
*/
function __buildPaths() {
$paths = array();
$pluginPaths = Configure::read('pluginPaths');
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
}
foreach ($pluginPaths as $pluginPath) {
$plugins = Configure::listObjects('plugin', $pluginPath);
$Folder =& new Folder($pluginPath);
list($plugins,) = $Folder->read(false, true);
foreach ((array)$plugins as $plugin) {
$path = $pluginPath . Inflector::underscore($plugin) . DS . 'vendors' . DS . 'shells' . DS;
if (file_exists($path)) {
@ -262,7 +266,6 @@ class ShellDispatcher {
Configure::write('debug', 1);
return true;
}
/**
* Dispatches a CLI request
*
@ -542,16 +545,19 @@ class ShellDispatcher {
$this->stdout("\nAvailable Shells:");
$_shells = array();
foreach ($this->shellPaths as $path) {
if (is_dir($path)) {
$shells = Configure::listObjects('file', $path);
$path = str_replace(CORE_PATH, 'CORE/', $path);
$path = str_replace(CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS, 'CORE' . DS, $path);
$path = str_replace(APP, 'APP' . DS, $path);
$path = str_replace(ROOT, 'ROOT', $path);
$path = rtrim($path, DS);
$this->stdout("\n " . $path . ":");
if (empty($shells)) {
$this->stdout("\t - none");
} else {
sort($shells);
foreach ($shells as $shell) {
if ($shell !== 'shell.php') {
$this->stdout("\t " . str_replace('.php', '', $shell));

View file

@ -36,7 +36,7 @@ class AclShell extends Shell {
/**
* Contains instance of AclComponent
*
* @var object
* @var AclComponent
* @access public
*/
var $Acl;

View file

@ -34,7 +34,7 @@ class Shell extends Object {
/**
* An instance of the ShellDispatcher object that loaded this script
*
* @var object
* @var ShellDispatcher
* @access public
*/
var $Dispatch = null;
@ -49,7 +49,7 @@ class Shell extends Object {
* Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
* or the app does not exist.
*
* @var object
* @var DATABASE_CONFIG
* @access public
*/
var $DbConfig = null;

View file

@ -135,7 +135,7 @@ class ExtractTask extends Shell{
} else {
$response = '';
while ($response == '') {
$response = $this->in("What is the full path you would like to extract?\nExample: " . $this->params['root'] . DS . "myapp\n[Q]uit", null, 'Q');
$response = $this->in("What is the full path you would like to extract?\nExample: " . $this->params['root'] . DS . "myapp\n[Q]uit", null, $this->params['working']);
if (strtoupper($response) === 'Q') {
$this->out('Extract Aborted');
$this->_stop();

View file

@ -33,7 +33,7 @@ class Cache extends Object {
/**
* Cache engine to use
*
* @var object
* @var CacheEngine
* @access protected
*/
var $_Engine = null;

View file

@ -34,7 +34,7 @@ class FileEngine extends CacheEngine {
/**
* Instance of File class
*
* @var object
* @var File
* @access private
*/
var $__File = null;

View file

@ -33,7 +33,7 @@ class MemcacheEngine extends CacheEngine {
/**
* Memcache wrapper.
*
* @var object
* @var Memcache
* @access private
*/
var $__Memcache = null;

View file

@ -291,6 +291,32 @@ class Controller extends Object {
* @link
*/
var $methods = array();
/**
* This controller's primary model class name, the Inflector::classify()'ed version of
* the controller's $name property.
*
* Example: For a controller named 'Comments', the modelClass would be 'Comment'
*
* @var string
* @access public
*/
var $modelClass = null;
/**
* This controller's model key name, an underscored version of the controller's $modelClass property.
*
* Example: For a controller named 'ArticleComments', the modelKey would be 'article_comment'
*
* @var string
* @access public
*/
var $modelKey = null;
/**
* Holds any validation errors produced by the last call of the validateErrors() method/
*
* @var array Validation errors, or false if none
* @access public
*/
var $validationErrors = null;
/**
* Constructor.
*

View file

@ -39,7 +39,7 @@ class Scaffold extends Object {
/**
* Controller object
*
* @var object
* @var Controller
* @access public
*/
var $controller = null;

View file

@ -70,7 +70,7 @@ class ErrorHandler extends Object {
/**
* Controller instance.
*
* @var object
* @var Controller
* @access public
*/
var $controller = null;

View file

@ -42,7 +42,7 @@ class File extends Object {
/**
* Folder object of the File
*
* @var object
* @var Folder
* @access public
*/
var $Folder = null;
@ -376,7 +376,7 @@ class File extends Object {
}
/**
* Returns the full path of the File.
*
*
* @return string Full path to file
* @access public
*/

View file

@ -212,17 +212,18 @@ class Folder extends Object {
*/
function _findRecursive($pattern, $sort = false) {
list($dirs, $files) = $this->read($sort);
$found = array();
foreach ($files as $file) {
if (preg_match('/^' . $pattern . '$/i', $file)) {
$found[] = Folder::addPathElement($this->path, $file);
}
}
$start = $this->path;
foreach ($dirs as $dir) {
$this->cd(Folder::addPathElement($start, $dir));
$found = array_merge($found, $this->findRecursive($pattern));
$found = array_merge($found, $this->findRecursive($pattern, $sort));
}
return $found;
}

View file

@ -40,7 +40,7 @@ class I18n extends Object {
/**
* Instance of the I10n class for localization
*
* @var object
* @var I10n
* @access public
*/
var $l10n = null;

View file

@ -205,11 +205,11 @@ class ModelBehavior extends Object {
* @subpackage cake.cake.libs.model
*/
class BehaviorCollection extends Object {
/**
* Stores a reference to the attached name
*
* @var object
* @var string
* @access public
*/
var $modelName = null;
/**

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* Datasource connection manager
*
* Long description for file
* Provides an interface for loading and enumerating connections defined in app/config/database.php
*
* PHP versions 4 and 5
*
@ -39,7 +39,7 @@ class ConnectionManager extends Object {
/**
* Holds a loaded instance of the Connections object
*
* @var object
* @var DATABASE_CONFIG
* @access public
*/
var $config = null;
@ -85,7 +85,7 @@ class ConnectionManager extends Object {
/**
* Gets a reference to a DataSource object
*
* @param string $name The name of the DataSource, as defined in app/config/connections
* @param string $name The name of the DataSource, as defined in app/config/database.php
* @return object Instance
* @access public
* @static
@ -145,8 +145,9 @@ class ConnectionManager extends Object {
/**
* Loads the DataSource class for the given connection name
*
* @param mixed $connName A string name of the connection, as defined in Connections config,
* or an array containing the file and class name of the object.
* @param mixed $connName A string name of the connection, as defined in app/config/database.php,
* or an array containing the filename (without extension) and class name of the object,
* to be found in app/models/datasources/ or cake/libs/model/datasources/.
* @return boolean True on success, null on failure or false if the class is already loaded
* @access public
* @static
@ -259,4 +260,4 @@ class ConnectionManager extends Object {
}
}
}
?>
?>

View file

@ -221,7 +221,7 @@ class Model extends Overloadable {
/**
* Holds the Behavior objects currently bound to this model.
*
* @var object
* @var BehaviorCollection
* @access public
*/
var $Behaviors = null;
@ -2343,9 +2343,15 @@ class Model extends Overloadable {
$this->exists();
$_validate = $this->validate;
if (array_key_exists('fieldList', $options) && is_array($options['fieldList']) && !empty($options['fieldList'])) {
$whitelist = $this->whitelist;
if (array_key_exists('fieldList', $options)) {
$whitelist = $options['fieldList'];
}
if (!empty($whitelist)) {
$validate = array();
foreach ($options['fieldList'] as $f) {
foreach ((array)$whitelist as $f) {
if (!empty($this->validate[$f])) {
$validate[$f] = $this->validate[$f];
}

View file

@ -38,7 +38,7 @@ class Object {
/**
* Log object
*
* @var object
* @var CakeLog
* @access protected
*/
var $_log = null;
@ -248,7 +248,11 @@ class Object {
$objectArray = array(&$object);
$data = str_replace('\\', '\\\\', serialize($objectArray));
$data = '<?php $' . $name . ' = \'' . str_replace('\'', '\\\'', $data) . '\' ?>';
cache($file, $data, '+1 day');
$duration = '+999 days';
if (Configure::read() >= 1) {
$duration = '+10 seconds';
}
cache($file, $data, $duration);
}
/**
* Open the persistent class file for reading
@ -267,14 +271,16 @@ class Object {
case 'registry':
$vars = unserialize(${$name});
foreach ($vars['0'] as $key => $value) {
App::import('Model', Inflector::classify($key));
if (strpos($key, '_behavior') !== false) {
App::import('Behavior', Inflector::classify(substr($key, 0, -9)));
} else {
App::import('Model', Inflector::classify($key));
}
unset ($value);
}
unset($vars);
$vars = unserialize(${$name});
foreach ($vars['0'] as $key => $value) {
foreach ($vars['0'][$key]->Behaviors->_attached as $behavior) {
App::import('Behavior', $behavior);
}
ClassRegistry::addObject($key, $value);
unset ($value);
}

View file

@ -349,7 +349,9 @@ class CakeSession extends Object {
if (empty($var)) {
return false;
}
$this->watchKeys[] = $var;
if (!in_array($var, $this->watchKeys, true)) {
$this->watchKeys[] = $var;
}
}
/**
* Tells Session to stop watching a given key path
@ -571,10 +573,8 @@ class CakeSession extends Object {
$this->__setError(1, 'Session Highjacking Attempted !!!');
}
} else {
srand ((double)microtime() * 1000000);
$this->write('Config.userAgent', $this->_userAgent);
$this->write('Config.time', $this->sessionTime);
$this->write('Config.rand', mt_rand());
$this->write('Config.timeout', 10);
$this->valid = true;
$this->__setError(1, 'Session is valid');

View file

@ -374,12 +374,12 @@ class Set extends Object {
$data = $path;
$path = $tmp;
}
if (empty($data)) {
return array();
}
if (strpos($path, '/') === false) {
return Set::classicExtract($data, $path);
}
if (empty($data)) {
return array();
}
if ($path === '/') {
return $data;
}

View file

@ -42,14 +42,14 @@ class AjaxHelper extends AppHelper {
/**
* HtmlHelper instance
*
* @var object
* @var HtmlHelper
* @access public
*/
var $Html = null;
/**
* JavaScriptHelper instance
*
* @var object
* @var JavaScriptHelper
* @access public
*/
var $Javascript = null;
@ -901,7 +901,7 @@ class AjaxHelper extends AppHelper {
}
if (isset($options['bind'])) {
$bind = $options['bind'];
$hasBinding = (
(is_array($bind) && in_array($callback, $bind)) ||
(is_string($bind) && strpos($bind, $callback) !== false)

View file

@ -52,7 +52,7 @@ class CacheHelper extends AppHelper {
/**
* holds the View object passed in final call to CacheHelper::cache()
*
* @var object
* @var View
* @access public
*/
var $view;

View file

@ -79,6 +79,13 @@ class MediaView extends View {
'iges' => 'model/iges', 'igs' => 'model/iges', 'mesh' => 'model/mesh', 'msh' => 'model/mesh',
'silo' => 'model/mesh', 'vrml' => 'model/vrml', 'wrl' => 'model/vrml',
'mime' => 'www/mime', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-pdb');
/**
* Holds headers sent to browser before rendering media
*
* @var array
* @access protected
*/
var $_headers = array();
/**
* Constructor
*
@ -105,7 +112,7 @@ class MediaView extends View {
} else {
$path = APP . $path . $id;
}
if (!file_exists($path)) {
header('Content-Type: text/html');
$this->cakeError('error404');
@ -118,7 +125,7 @@ class MediaView extends View {
if (is_array($mimeType)) {
$this->mimeType = array_merge($this->mimeType, $mimeType);
}
if (isset($extension) && isset($this->mimeType[$extension]) && connection_status() == 0) {
$chunkSize = 8192;
$buffer = '';
@ -148,13 +155,14 @@ class MediaView extends View {
));
}
foreach($contentTypes as $contentType) {
header('Content-Type: ' . $contentType);
$this->_header('Content-Type: ' . $contentType);
}
header('Content-Disposition: attachment; filename="' . $name . '.' . $extension . '";');
header('Expires: 0');
header('Accept-Ranges: bytes');
header('Cache-Control: private', false);
header('Pragma: private');
$this->_header(array(
'Content-Disposition: attachment; filename="' . $name . '.' . $extension . '";',
'Expires: 0',
'Accept-Ranges: bytes',
'Cache-Control: private' => false,
'Pragma: private'));
$httpRange = env('HTTP_RANGE');
if (isset($httpRange)) {
@ -163,30 +171,36 @@ class MediaView extends View {
$size = $fileSize - 1;
$length = $fileSize - $range;
header('HTTP/1.1 206 Partial Content');
header('Content-Length: ' . $length);
header('Content-Range: bytes ' . $range . $size . '/' . $fileSize);
$this->_header(array(
'HTTP/1.1 206 Partial Content',
'Content-Length: ' . $length,
'Content-Range: bytes ' . $range . $size . '/' . $fileSize));
fseek($handle, $range);
} else {
header('Content-Length: ' . $fileSize);
$this->_header('Content-Length: ' . $fileSize);
}
} else {
header('Date: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
$this->_header('Date: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
if ($cache) {
if (!is_numeric($cache)) {
$cache = strtotime($cache) - time();
}
header('Cache-Control: max-age=' . $cache);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $cache) . ' GMT');
header('Pragma: cache');
$this->_header(array(
'Cache-Control: max-age=' . $cache,
'Expires: ' . gmdate('D, d M Y H:i:s', time() + $cache) . ' GMT',
'Pragma: cache'));
} else {
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: no-cache');
$this->_header(array(
'Cache-Control: must-revalidate, post-check=0, pre-check=0',
'Pragma: no-cache'));
}
header('Last-Modified: ' . $modified);
header('Content-Type: ' . $this->mimeType[$extension]);
header('Content-Length: ' . $fileSize);
$this->_header(array(
'Last-Modified: ' . $modified,
'Content-Type: ' . $this->mimeType[$extension],
'Content-Length: ' . $fileSize));
}
$this->_output();
@ob_end_clean();
while (!feof($handle) && connection_status() == 0 && !connection_aborted()) {
@ -201,5 +215,35 @@ class MediaView extends View {
}
return false;
}
/**
* Method to set headers
* @param mixed $header
* @param boolean $boolean
* @access protected
*/
function _header($header, $boolean = true) {
if (is_array($header)) {
foreach ($header as $string => $boolean) {
if (is_numeric($string)) {
$this->_headers[] = array($boolean => true);
} else {
$this->_headers[] = array($string => $boolean);
}
}
return;
}
$this->_headers[] = array($header => $boolean);
return;
}
/**
* Method to output headers
* @access protected
*/
function _output() {
foreach ($this->_headers as $key => $value) {
$header = key($value);
header($header, $value[$header]);
}
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* BasicsTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -29,7 +29,7 @@ App::import('Core', 'Folder');
/**
* BasicsTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases
*/
class BasicsTest extends CakeTestCase {
@ -119,6 +119,8 @@ class BasicsTest extends CakeTestCase {
* @return void
*/
function testUses() {
$this->skipIf(class_exists('Security') || class_exists('Sanitize'), 'Security and/or Sanitize class already loaded');
$this->assertFalse(class_exists('Security'));
$this->assertFalse(class_exists('Sanitize'));
@ -532,15 +534,17 @@ class BasicsTest extends CakeTestCase {
ob_start();
debug('this-is-a-test');
$result = ob_get_clean();
$pattern = '/.*' . preg_quote(substr(__FILE__, 1), '/')
. '.*line.*' . (__LINE__ - 3) . '.*this-is-a-test.*/s';
$pattern = '/.*\>(cake(\/|\\\)tests(\/|\\\)cases(\/|\\\)basics\.test\.php|';
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*this-is-a-test.*/s';
$this->assertPattern($pattern, $result);
ob_start();
debug('<div>this-is-a-test</div>', true);
$result = ob_get_clean();
$pattern = '/.*' . preg_quote(substr(__FILE__, 1), '/')
. '.*line.*' . (__LINE__ - 3) . '.*&lt;div&gt;this-is-a-test&lt;\/div&gt;.*/s';
$pattern = '/.*\>(cake(\/|\\\)tests(\/|\\\)cases(\/|\\\)basics\.test\.php|';
$pattern .= preg_quote(substr(__FILE__, 1), '/') . ')';
$pattern .= '.*line.*' . (__LINE__ - 4) . '.*&lt;div&gt;this-is-a-test&lt;\/div&gt;.*/s';
$this->assertPattern($pattern, $result);
}
/**

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ShellDispatcherTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -76,7 +76,6 @@ class TestShellDispatcher extends ShellDispatcher {
* @return void
*/
function _initEnvironment() {
//
}
/**
* stderr method
@ -111,9 +110,9 @@ class TestShellDispatcher extends ShellDispatcher {
}
}
/**
* Short description for class.
* ShellDispatcherTest
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ShellDispatcherTest extends UnitTestCase {
@ -128,10 +127,11 @@ class ShellDispatcherTest extends UnitTestCase {
$this->pluginPaths = Configure::read('pluginPaths');
$this->shellPaths = Configure::read('shellPaths');
}
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS));
Configure::write('pluginPaths', array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS
));
Configure::write('shellPaths', array(
ROOT . DS . CONSOLE_LIBS,
CORE_PATH ? CONSOLE_LIBS : ROOT . DS . CONSOLE_LIBS,
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'shells' . DS
));
}
@ -406,14 +406,18 @@ class ShellDispatcherTest extends UnitTestCase {
*/
function testBuildPaths() {
$Dispatcher =& new TestShellDispatcher();
$this->assertEqual($Dispatcher->shellPaths, array(
$result = $Dispatcher->shellPaths;
$expected = array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin' . DS . 'vendors' . DS . 'shells' . DS,
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS . 'test_plugin_two' . DS . 'vendors' . DS . 'shells' . DS,
APP . 'vendors' . DS . 'shells' . DS,
VENDORS . 'shells' . DS,
ROOT . DS . CONSOLE_LIBS,
CORE_PATH ? CONSOLE_LIBS : ROOT . DS . CONSOLE_LIBS,
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'shells' . DS,
));
);
$this->assertIdentical(array_diff($result, $expected), array());
$this->assertIdentical(array_diff($expected, $result), array());
}
/**
* testDispatch method
@ -440,32 +444,26 @@ class ShellDispatcherTest extends UnitTestCase {
function testHelpCommand() {
$Dispatcher =& new TestShellDispatcher();
$expected = "/ ROOT(\\\|\/)cake(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin(\\\|\/)vendors(\\\|\/)shells:";
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n\t example";
$expected .= "\n/";
$this->assertPattern($expected, $Dispatcher->stdout);
// Shells need to be returned ordered
// See Configure::__list/Folder::read
$expected = "/ ROOT(\\\|\/)cake(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin_two(\\\|\/)vendors(\\\|\/)shells:";
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)plugins(\\\|\/)test_plugin_two(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n\t example";
$expected .= "\n\t welcome";
$expected .= "\n/";
$this->assertPattern($expected, $Dispatcher->stdout);
$expected = "/ ROOT(\\\|\/)app(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n\t - none";
$expected = "/ APP(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n/";
$this->assertPattern($expected, $Dispatcher->stdout);
$expected = "/ ROOT(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n\t - none";
$expected .= "\n/";
$this->assertPattern($expected, $Dispatcher->stdout);
// Shells need to be returned ordered
// See Configure::__list/Folder::read
$expected = "/ ROOT(\\\|\/)cake(\\\|\/)console(\\\|\/)libs:";
$expected = "/ CORE(\\\|\/)console(\\\|\/)libs:";
$expected .= "\n\t acl";
$expected .= "\n\t api";
$expected .= "\n\t bake";
@ -476,7 +474,7 @@ class ShellDispatcherTest extends UnitTestCase {
$expected .= "\n/";
$this->assertPattern($expected, $Dispatcher->stdout);
$expected = "/ ROOT(\\\|\/)cake(\\\|\/)tests(\\\|\/)test_app(\\\|\/)vendors(\\\|\/)shells:";
$expected = "/ CORE(\\\|\/)tests(\\\|\/)test_app(\\\|\/)vendors(\\\|\/)shells:";
$expected .= "\n\t sample";
$expected .= "\n/";
$this->assertPattern($expected, $Dispatcher->stdout);

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Test Case for Shell
* ShellTest file
*
* Long description for file
* Test Case for Shell
*
* PHP versions 4 and 5
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs
* @since CakePHP v 1.2.0.7726
* @version $Revision$
@ -44,7 +44,7 @@ Mock::generatePartial(
/**
* TestShell class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs
*/
class TestShell extends Shell {
@ -52,7 +52,7 @@ class TestShell extends Shell {
/**
* TestAppleTask class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs
*/
class TestAppleTask extends Shell {
@ -60,7 +60,7 @@ class TestAppleTask extends Shell {
/**
* TestBananaTask class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs
*/
class TestBananaTask extends Shell {
@ -68,7 +68,7 @@ class TestBananaTask extends Shell {
/**
* ShellTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs
*/
class ShellTest extends CakeTestCase {

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id: extract.test.php 7838 2008-11-07 10:41:52Z nate $ */
/* SVN FILE: $Id$ */
/**
* Test Case for i18n extraction shell task
* ExtractTaskTest file
*
* Long description for file
* Test Case for i18n extraction shell task
*
* PHP versions 4 and 5
*
@ -16,12 +16,12 @@
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
* @since CakePHP v 1.2.0.7726
* @version $Revision: 7838 $
* @modifiedby $LastChangedBy: DarkAngelBGE $
* @lastmodified $Date: 2008-11-07 05:41:52 -0500 (Fri, 07 Nov 2008) $
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', array('Shell', 'Folder'));
@ -45,11 +45,10 @@ Mock::generatePartial(
'ShellDispatcher', 'TestExtractTaskMockShellDispatcher',
array('getInput', 'stdout', 'stderr', '_stop', '_initEnvironment')
);
/**
* ExtractTaskTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class ExtractTaskTest extends CakeTestCase {

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Test Case for test generation shell task
* TestTaskTest file
*
* Long description for file
* Test Case for test generation shell task
*
* PHP versions 4 and 5
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
* @since CakePHP v 1.2.0.7726
* @version $Revision$
@ -52,7 +52,7 @@ Mock::generatePartial(
/**
* TestTaskTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.console.libs.tasks
*/
class TestTaskTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* DispatcherTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -72,7 +72,6 @@ class TestDispatcher extends Dispatcher {
function _stop() {
return true;
}
}
/**
* MyPluginAppController class
@ -81,7 +80,6 @@ class TestDispatcher extends Dispatcher {
* @subpackage cake.tests.cases
*/
class MyPluginAppController extends AppController {
}
/**
* MyPluginController class
@ -182,7 +180,6 @@ class SomePagesController extends AppController {
function _protected() {
return true;
}
/**
* redirect method overriding
*
@ -264,7 +261,6 @@ class TestDispatchPagesController extends AppController {
function admin_index() {
return true;
}
/**
* camelCased method
*
@ -282,7 +278,6 @@ class TestDispatchPagesController extends AppController {
* @subpackage cake.tests.cases
*/
class ArticlesTestAppController extends AppController {
}
/**
* ArticlesTestController class
@ -481,9 +476,9 @@ class TimesheetsController extends AppController {
}
}
/**
* Short description for class.
* DispatcherTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases
*/
class DispatcherTest extends CakeTestCase {
@ -502,6 +497,15 @@ class DispatcherTest extends CakeTestCase {
Configure::write('App.webroot', 'webroot');
Configure::write('Cache.disable', true);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
$_GET = $this->_get;
}
/**
* testParseParamsWithoutZerosAndEmptyPost method
*
@ -2088,14 +2092,5 @@ class DispatcherTest extends CakeTestCase {
}
return $filename;
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
$_GET = $this->_get;
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* CacheTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -28,9 +28,9 @@ if (!class_exists('Cache')) {
require LIBS . 'cache.php';
}
/**
* Short description for class.
* CacheTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class CacheTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ApcEngineTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
* @since CakePHP(tm) v 1.2.0.5434
* @version $Revision$
@ -28,9 +28,9 @@ if (!class_exists('Cache')) {
require LIBS . 'cache.php';
}
/**
* Short description for class.
* ApcEngineTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
*/
class ApcEngineTest extends UnitTestCase {
@ -56,6 +56,15 @@ class ApcEngineTest extends UnitTestCase {
function setUp() {
Cache::config('apc', array('engine'=>'Apc', 'prefix' => 'cake_'));
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Cache::config('default');
}
/**
* testReadAndWriteCache method
*
@ -127,14 +136,5 @@ class ApcEngineTest extends UnitTestCase {
$result = Cache::delete('delete_test');
$this->assertTrue($result);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Cache::config('default');
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* FileEngineTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
* @since CakePHP(tm) v 1.2.0.5434
* @version $Revision$
@ -31,9 +31,9 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
/**
* Short description for class.
* FileEngineTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
*/
class FileEngineTest extends CakeTestCase {
@ -103,7 +103,7 @@ class FileEngineTest extends CakeTestCase {
$result = Cache::read('test');
$expecting = $data;
$this->assertEqual($result, $expecting);
Cache::delete('test');
}
/**
@ -331,7 +331,12 @@ class FileEngineTest extends CakeTestCase {
Cache::delete('test_dir_map');
$this->assertEqual($expected, $data);
}
/**
* testWriteQuotedString method
*
* @access public
* @return void
*/
function testWriteQuotedString() {
Cache::engine('File', array('path' => TMP . 'tests'));
Cache::write('App.doubleQuoteTest', '"this is a quoted string"');

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* MemcacheEngineTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
* @since CakePHP(tm) v 1.2.0.5434
* @version $Revision$
@ -27,9 +27,9 @@
if (!class_exists('Cache')) {
require LIBS . 'cache.php';
}/**
* Short description for class.
* MemcacheEngineTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
*/
/**
@ -129,7 +129,6 @@ class MemcacheEngineTest extends CakeTestCase {
$result = $Cache->_Engine['Memcache']->connect('127.0.0.1');
$this->assertTrue($result);
}
/**
* testReadAndWriteCache method
*

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* XcacheEngineTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
* @since CakePHP(tm) v 1.2.0.5434
* @version $Revision$
@ -28,9 +28,9 @@ if (!class_exists('Cache')) {
require LIBS . 'cache.php';
}
/**
* Short description for class.
* XcacheEngineTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.cache
*/
class XcacheEngineTest extends UnitTestCase {
@ -56,6 +56,15 @@ class XcacheEngineTest extends UnitTestCase {
function setUp() {
Cache::config('xcache', array('engine'=>'Xcache', 'prefix' => 'cake_'));
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Cache::config('default');
}
/**
* testSettings method
*
@ -156,14 +165,5 @@ class XcacheEngineTest extends UnitTestCase {
$result = Cache::clear();
$this->assertTrue($result);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Cache::config('default');
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* CakeLogTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'Log');
/**
* Short description for class.
* CakeLogTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class CakeLogTest extends CakeTestCase {
@ -52,5 +52,4 @@ class CakeLogTest extends CakeTestCase {
unlink(LOGS . 'error.log');
}
}
?>

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* CakeTestCase TestCase
* CakeTestCaseTest file
*
* Test Case for CakeTestCase Class
* Test Case for CakeTestCase class
*
* PHP versions 4 and 5
*
@ -32,13 +32,12 @@ Mock::generate('CakeTestCase', 'CakeDispatcherMockTestCase');
SimpleTest::ignore('SubjectCakeTestCase');
SimpleTest::ignore('CakeDispatcherMockTestCase');
/**
* SubjectCakeTestCase
*
* @package cake.tests
* @subpackage cake.tests.cases.libs
*/
* SubjectCakeTestCase
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SubjectCakeTestCase extends CakeTestCase {
/**
* Feed a Mocked Reporter to the subject case
@ -51,18 +50,21 @@ class SubjectCakeTestCase extends CakeTestCase {
function setReporter(&$reporter) {
$this->_reporter = &$reporter;
}
/**
* testDummy method
*
* @return void
* @access public
*/
function testDummy() {
}
}
/**
* CakeTestCaseTest
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
**/
*/
class CakeTestCaseTest extends CakeTestCase {
/**
* setUp
@ -76,6 +78,16 @@ class CakeTestCaseTest extends CakeTestCase {
$this->Case->setReporter($reporter);
$this->Reporter = $reporter;
}
/**
* tearDown
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Case);
unset($this->Reporter);
}
/**
* testAssertGoodTags
*
@ -214,7 +226,6 @@ class CakeTestCaseTest extends CakeTestCase {
$this->assertEqual(array_slice($result, 0, 2), array('start', 'startCase'));
$this->assertEqual(array_slice($result, -2), array('endCase', 'end'));
}
/**
* TestTestAction
*
@ -303,7 +314,7 @@ class CakeTestCaseTest extends CakeTestCase {
$fixture =& new PostFixture($db);
$fixture->create($db);
$fixture->insert($db);
$result = $this->Case->testAction('/tests_apps_posts/fixtured', array(
'return' => 'vars',
'fixturize' => true,
@ -334,17 +345,17 @@ class CakeTestCaseTest extends CakeTestCase {
$fixture =& new PostFixture($db);
$fixture->create($db);
$fixture->insert($db);
$this->Case->dropTables = false;
$result = $this->Case->testAction('/tests_apps_posts/fixtured', array(
'return' => 'vars',
'fixturize' => true,
'connection' => 'cake_test_case',
));
$tables = $db->listSources();
$this->assertTrue(in_array('cake_testaction_test_suite_posts', $tables));
$fixture->drop($db);
$db =& ConnectionManager::getDataSource('test_suite');
$db->config['prefix'] = $_backPrefix;
@ -396,15 +407,5 @@ class CakeTestCaseTest extends CakeTestCase {
Configure::write('viewPaths', $_back['view']);
Configure::write('pluginPaths', $_back['plugin']);
}
/**
* tearDown
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Case);
unset($this->Reporter);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* CakeTestFixture file
*
* Long description for file
*
@ -25,9 +25,8 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'DboSource');
/**
* CakeFixture Test Fixture
* CakeTestFixtureTestFixture class
*
* @package cake
* @subpackage cake.cake.tests.cases.libs
@ -66,10 +65,8 @@ class CakeTestFixtureTestFixture extends CakeTestFixture {
array('name' => 'Chewbacca')
);
}
/**
* Import Fixture Test Fixture
* CakeTestFixtureImportFixture class
*
* @package cake
* @subpackage cake.cake.tests.cases.libs
@ -88,9 +85,8 @@ class CakeTestFixtureImportFixture extends CakeTestFixture {
*/
var $import = array('table' => 'fixture_tests', 'connection' => 'test_suite');
}
/**
* Import Fixture Test Fixture
* CakeTestFixtureDefaultImportFixture class
*
* @package cake
* @subpackage cake.cake.tests.cases.libs
@ -103,9 +99,8 @@ class CakeTestFixtureDefaultImportFixture extends CakeTestFixture {
*/
var $name = 'ImportFixture';
}
/**
* Fixture Test Case Model
* FixtureImportTestModel class
*
* @package default
* @subpackage cake.cake.tests.cases.libs.
@ -115,9 +110,7 @@ class FixtureImportTestModel extends Model {
var $useTable = 'fixture_tests';
var $useDbConfig = 'test_suite';
}
Mock::generate('DboSource', 'FixtureMockDboSource');
/**
* Test case for CakeTestFixture
*
@ -125,10 +118,25 @@ Mock::generate('DboSource', 'FixtureMockDboSource');
* @subpackage cake.cake.tests.cases.libs
*/
class CakeTestFixtureTest extends CakeTestCase {
/**
* setUp method
*
* @access public
* @return void
*/
function setUp() {
$this->criticDb =& new FixtureMockDboSource();
$this->criticDb->fullDebug = true;
}
/**
* tearDown
*
* @access public
* @return void
*/
function tearDown() {
unset($this->criticDb);
}
/**
* testInit
*
@ -215,8 +223,9 @@ class CakeTestFixtureTest extends CakeTestCase {
/**
* test create method
*
* @access public
* @return void
**/
*/
function testCreate() {
$Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->expectAtLeastOnce('execute');
@ -229,12 +238,12 @@ class CakeTestFixtureTest extends CakeTestCase {
$return = $Fixture->create($this->criticDb);
$this->assertFalse($return);
}
/**
* test the insert method
*
* @access public
* @return void
**/
*/
function testInsert() {
$Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->setReturnValue('insertMulti', true);
@ -244,12 +253,12 @@ class CakeTestFixtureTest extends CakeTestCase {
$this->assertTrue($this->criticDb->fullDebug);
$this->assertTrue($return);
}
/**
* Test the drop method
*
* @access public
* @return void
**/
*/
function testDrop() {
$Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->setReturnValueAt(0, 'execute', true);
@ -267,22 +276,14 @@ class CakeTestFixtureTest extends CakeTestCase {
/**
* Test the truncate method.
*
* @access public
* @return void
**/
*/
function testTruncate() {
$Fixture =& new CakeTestFixtureTestFixture();
$this->criticDb->expectAtLeastOnce('truncate');
$Fixture->truncate($this->criticDb);
$this->assertTrue($this->criticDb->fullDebug);
}
/**
* tearDown
*
* @access public
* @return void
*/
function tearDown() {
unset($this->criticDb);
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ClassRegistryTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -28,7 +28,7 @@ App::import('Core', 'ClassRegistry');
/**
* ClassRegisterModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ClassRegisterModel extends CakeTestModel {
@ -43,7 +43,7 @@ class ClassRegisterModel extends CakeTestModel {
/**
* RegisterArticle class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RegisterArticle extends ClassRegisterModel {
@ -58,7 +58,7 @@ class RegisterArticle extends ClassRegisterModel {
/**
* RegisterArticleFeatured class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RegisterArticleFeatured extends ClassRegisterModel {
@ -73,7 +73,7 @@ class RegisterArticleFeatured extends ClassRegisterModel {
/**
* RegisterArticleTag class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RegisterArticleTag extends ClassRegisterModel {
@ -88,7 +88,7 @@ class RegisterArticleTag extends ClassRegisterModel {
/**
* RegistryPluginAppModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RegistryPluginAppModel extends ClassRegisterModel {
@ -103,7 +103,7 @@ class RegistryPluginAppModel extends ClassRegisterModel {
/**
* TestRegistryPluginModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class TestRegistryPluginModel extends RegistryPluginAppModel {
@ -118,7 +118,7 @@ class TestRegistryPluginModel extends RegistryPluginAppModel {
/**
* RegisterCategory class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RegisterCategory extends ClassRegisterModel {
@ -133,7 +133,7 @@ class RegisterCategory extends ClassRegisterModel {
/**
* ClassRegistryTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ClassRegistryTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* CodeCoverageManagerTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -28,13 +28,20 @@ App::import('Core', 'CodeCoverageManager');
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cli_reporter.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_reporter.php';
/**
* Short description for class.
* CodeCoverageManagerTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class CodeCoverageManagerTest extends CakeTestCase {
/**
* Skip if XDebug not installed
*
* @access public
*/
function skip() {
$this->skipif (!extension_loaded('xdebug'), 'XDebug not installed');
}
/**
* startTest Method
* Store reference of $_GET to restore later.
@ -44,7 +51,6 @@ class CodeCoverageManagerTest extends CakeTestCase {
function startCase() {
$this->_get = $_GET;
}
/**
* End Case - restore GET vars.
*
@ -53,14 +59,6 @@ class CodeCoverageManagerTest extends CakeTestCase {
function endCase() {
$_GET = $this->_get;
}
/**
* Skip if XDebug not installed
*
* @access public
*/
function skip() {
$this->skipif (!extension_loaded('xdebug'), 'XDebug not installed');
}
/**
* testNoTestCaseSupplied method
*

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ConfigureTest file
*
* Long description for file
* Holds several tests
*
* PHP versions 4 and 5
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -24,12 +24,11 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'Configure');
/**
* Short description for class.
* ConfigureTest
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ConfigureTest extends CakeTestCase {
@ -149,7 +148,6 @@ class ConfigureTest extends CakeTestCase {
$result = Configure::read('SomeName.someKey');
$this->assertEqual($result, null);
}
/**
* testSetErrorReporting Level
*
@ -537,5 +535,4 @@ class AppImportTest extends UnitTestCase {
$this->assertEqual($text, 'This is the welcome.php file in test_plugin/vendors directory');
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ComponentTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
* @since CakePHP(tm) v 1.2.0.5436
* @version $Revision$
@ -70,7 +70,8 @@ if (!class_exists('AppController')) {
/**
* ParamTestComponent
*
* @package cake.tests.cases.libs.controller
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ParamTestComponent extends Object {
/**
@ -106,9 +107,9 @@ class ParamTestComponent extends Object {
}
}
/**
* Short description for class.
* ComponentTestController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ComponentTestController extends AppController {
@ -185,7 +186,13 @@ class OrangeComponent extends Object {
$this->Banana->testField = 'OrangeField';
$this->settings = $settings;
}
/**
* startup method
*
* @param Controller $controller
* @return string
* @access public
*/
function startup(&$controller) {
$controller->foo = 'pass';
}
@ -204,7 +211,13 @@ class BananaComponent extends Object {
* @access public
*/
var $testField = 'BananaField';
/**
* startup method
*
* @param Controller $controller
* @return string
* @access public
*/
function startup(&$controller) {
$controller->bar = 'fail';
}
@ -216,6 +229,12 @@ class BananaComponent extends Object {
* @subpackage cake.tests.cases.libs.controller
*/
class MutuallyReferencingOneComponent extends Object {
/**
* components property
*
* @var array
* @access public
*/
var $components = array('MutuallyReferencingTwo');
}
/**
@ -225,9 +244,14 @@ class MutuallyReferencingOneComponent extends Object {
* @subpackage cake.tests.cases.libs.controller
*/
class MutuallyReferencingTwoComponent extends Object {
/**
* components property
*
* @var array
* @access public
*/
var $components = array('MutuallyReferencingOne');
}
/**
* SomethingWithEmailComponent class
*
@ -235,6 +259,12 @@ class MutuallyReferencingTwoComponent extends Object {
* @subpackage cake.tests.cases.libs.controller
*/
class SomethingWithEmailComponent extends Object {
/**
* components property
*
* @var array
* @access public
*/
var $components = array('Email');
}
/**
@ -321,7 +351,7 @@ class ComponentTest extends CakeTestCase {
$this->assertTrue(is_a($Controller->Apple->Orange->Banana, 'BananaComponent'));
$this->assertTrue(is_a($Controller->Apple->Orange->Controller, 'ComponentTestController'));
$this->assertTrue(empty($Controller->Apple->Session));
$this->assertTrue(empty($Controller->Apple->Orange->Session));
$this->assertTrue(empty($Controller->Apple->Orange->Session));
}
/**
* Tests Component::startup() and only running callbacks for components directly attached to
@ -430,7 +460,7 @@ class ComponentTest extends CakeTestCase {
$Controller->Component->initialize($Controller);
$Controller->beforeFilter();
$Controller->Component->startup($Controller);
$this->assertTrue(is_a(
$Controller->SomethingWithEmail,
'SomethingWithEmailComponent'
@ -458,5 +488,4 @@ class ComponentTest extends CakeTestCase {
$this->assertEqual($Controller->components, array('Session' => '', 'Orange' => array('colour' => 'blood orange')));
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* AclComponentTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5435
* @version $Revision$
@ -28,7 +28,6 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
App::import(array('controller'.DS.'components'.DS.'acl', 'model'.DS.'db_acl'));
/**
* AclNodeTwoTestBase class
*
@ -179,13 +178,11 @@ class DbAclTwoTest extends DbAcl {
* @subpackage cake.tests.cases.libs.controller.components
*/
class IniAclTest extends IniAcl {
}
/**
* Short description for class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class AclComponentTest extends CakeTestCase {
@ -217,6 +214,15 @@ class AclComponentTest extends CakeTestCase {
Configure::write('Acl.database', 'test_suite');
parent::before($method);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Acl);
}
/**
* testAclCreate method
*
@ -543,15 +549,6 @@ class AclComponentTest extends CakeTestCase {
$this->assertFalse($this->Acl->check('nobody', 'comments'));
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Acl);
}
/**
* debug function - to help editing/creating test cases for the ACL component
*

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* AutComponentTest file
*
* Long description for file
*
@ -30,9 +30,9 @@ App::import('Core', 'Xml');
Configure::write('Security.salt', 'JfIxfs2guVoUubWDYhG93b0qyJfIxfs2guwvniR2G0FgaC9mi');
/**
* Short description for class.
* TestAuthComponent class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class TestAuthComponent extends AuthComponent {
@ -61,9 +61,9 @@ class TestAuthComponent extends AuthComponent {
}
}
/**
* Short description for class.
* AuthUser class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class AuthUser extends CakeTestModel {
@ -117,12 +117,12 @@ class AuthUser extends CakeTestModel {
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
class AuthUserCustomField extends AuthUser{
* AuthUserCustomField class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class AuthUserCustomField extends AuthUser {
/**
* name property
*
@ -132,9 +132,9 @@ class AuthUserCustomField extends AuthUser{
var $name = 'AuthUserCustomField';
}
/**
* Short description for class.
* UuidUser class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class UuidUser extends CakeTestModel {
@ -195,9 +195,9 @@ class UuidUser extends CakeTestModel {
}
}
/**
* Short description for class.
* AuthTestController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class AuthTestController extends Controller {
@ -271,7 +271,7 @@ class AuthTestController extends Controller {
* @return void
*/
function logout() {
//$this->redirect($this->Auth->logout());
// $this->redirect($this->Auth->logout());
}
/**
* add method
@ -403,9 +403,9 @@ class AjaxAuthController extends Controller {
}
}
/**
* Short description for class.
* AuthTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class AuthTest extends CakeTestCase {
@ -448,6 +448,15 @@ class AuthTest extends CakeTestCase {
$this->Controller->Session->del('Message.auth');
$this->initialized = true;
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Controller, $this->AuthUser);
}
/**
* testNoAuth method
*
@ -622,7 +631,6 @@ class AuthTest extends CakeTestCase {
$result = $this->Controller->Auth->isAuthorized();
$this->assertFalse($result);
}
/**
* testAuthorizeCrud method
*
@ -815,6 +823,18 @@ class AuthTest extends CakeTestCase {
$expected = Router::normalize('posts/view/1');
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));
// QueryString parameters
$this->Controller->Session->del('Auth');
$url = '/posts/index/29?print=true&refer=menu';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
$this->Controller->Auth->userModel = 'AuthUser';
$this->Controller->Auth->startup($this->Controller);
$expected = Router::normalize('posts/index/29?print=true&refer=menu');
$this->assertEqual($expected, $this->Controller->Session->read('Auth.redirect'));
//external authed action
$_SERVER['HTTP_REFERER'] = 'http://webmail.example.com/view/message';
$this->Controller->Session->del('Auth');
@ -1035,7 +1055,6 @@ class AuthTest extends CakeTestCase {
$user = $this->Controller->Auth->user();
$this->assertTrue(!!$user);
}
/**
* testCustomField method
*
@ -1070,7 +1089,6 @@ class AuthTest extends CakeTestCase {
$user = $this->Controller->Auth->user();
$this->assertTrue(!!$user);
}
/**
* testAdminRoute method
*
@ -1177,14 +1195,5 @@ class AuthTest extends CakeTestCase {
$this->Controller->Auth->shutdown($this->Controller);
$this->assertFalse($this->Controller->Session->read('Auth.redirect'));
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Controller, $this->AuthUser);
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* CookieComponentTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5435
* @version $Revision$
@ -25,9 +25,26 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', array('Component', 'Controller', 'Cookie'));
/**
* CookieComponentTestController class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class CookieComponentTestController extends Controller {
/**
* components property
*
* @var array
* @access public
*/
var $components = array('Cookie');
/**
* beforeFilter method
*
* @access public
* @return void
*/
function beforeFilter() {
$this->Cookie->name = 'CakeTestCookie';
$this->Cookie->time = 10;
@ -38,29 +55,19 @@ class CookieComponentTestController extends Controller {
}
}
/**
* Short description for class.
* CookieComponentTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class CookieComponentTest extends CakeTestCase {
/**
* Controller property
*
* @var CookieComponentTestController
* @access public
*/
var $Controller;
function __encrypt($value) {
if (is_array($value)) {
$value = $this->__implode($value);
}
return "Q2FrZQ==." .base64_encode(Security::cipher($value, $this->Controller->Cookie->key));
}
function __implode($array) {
$string = '';
foreach ($array as $key => $value) {
$string .= ',' . $key . '|' . $value;
}
return substr($string, 1);
}
/**
* start
*
@ -75,6 +82,15 @@ class CookieComponentTest extends CakeTestCase {
$this->Controller->Component->startup($this->Controller);
$this->Controller->Cookie->destroy();
}
/**
* end
*
* @access public
* @return void
*/
function end() {
$this->Controller->Cookie->destroy();
}
/**
* testCookieName
*
@ -393,13 +409,31 @@ class CookieComponentTest extends CakeTestCase {
unset($_COOKIE['CakeTestCookie']);
}
/**
* end
* encrypt method
*
* @access public
* @return void
* @param mixed $value
* @return string
* @access private
*/
function end() {
$this->Controller->Cookie->destroy();
function __encrypt($value) {
if (is_array($value)) {
$value = $this->__implode($value);
}
return "Q2FrZQ==." . base64_encode(Security::cipher($value, $this->Controller->Cookie->key));
}
/**
* implode method
*
* @param array $value
* @return string
* @access private
*/
function __implode($array) {
$string = '';
foreach ($array as $key => $value) {
$string .= ',' . $key . '|' . $value;
}
return substr($string, 1);
}
}
?>

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Series of tests for email component.
* EmailComponentTest file
*
* Long description for file
* Series of tests for email component.
*
* PHP versions 4 and 5
*
@ -54,7 +54,12 @@ class EmailTestController extends Controller {
* @access public
*/
var $components = array('Email');
/**
* pageTitle property
*
* @var string
* @access public
*/
var $pageTitle = 'EmailTest';
}
/**
@ -63,7 +68,14 @@ class EmailTestController extends Controller {
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class EmailTest extends CakeTestCase {
class EmailComponentTest extends CakeTestCase {
/**
* Controller property
*
* @var EmailTestController
* @access public
*/
var $Controller;
/**
* name property
*
@ -369,7 +381,12 @@ TEXTBLOC;
$expected = "Previous content\n--alt-\n text/html; utf-8\n 7bit\n\n<p>My own html content</p>";
$this->assertEqual($result, $expected);
}
/**
* testMultibyte method
*
* @access public
* @return void
*/
function testMultibyte() {
$this->Controller->Email->reset();
$this->Controller->Email->to = 'postmaster@localhost';
@ -396,10 +413,15 @@ TEXTBLOC;
preg_match('/Subject: (.*)Header:/s', $this->Controller->Session->read('Message.email.message'), $matches);
$this->assertEqual(trim($matches[1]), $subject);
}
/**
* osFix method
*
* @param string $string
* @access private
* @return string
*/
function __osFix($string) {
return str_replace(array("\r\n", "\r"), "\n", $string);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* RequestHandlerComponentTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5435
* @version $Revision$
@ -92,18 +92,37 @@ class RequestHandlerTestDisabledController extends Controller {
}
parent::__construct();
}
/**
* beforeFilter method
*
* @return void
* @access public
*/
function beforeFilter() {
$this->RequestHandler->enabled = false;
}
}
/**
* Short description for class.
* RequestHandlerComponentTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class RequestHandlerComponentTest extends CakeTestCase {
/**
* Controller property
*
* @var RequestHandlerTestController
* @access public
*/
var $Controller;
/**
* RequestHandler property
*
* @var RequestHandlerComponent
* @access public
*/
var $RequestHandler;
/**
* setUp method
*
@ -114,15 +133,17 @@ class RequestHandlerComponentTest extends CakeTestCase {
$this->_init();
}
/**
* init method
* tearDown method
*
* @access protected
* @access public
* @return void
*/
function _init() {
$this->Controller = new RequestHandlerTestController(array('components' => array('RequestHandler')));
$this->Controller->constructClasses();
$this->RequestHandler =& $this->Controller->RequestHandler;
function tearDown() {
unset($this->RequestHandler);
unset($this->Controller);
if (!headers_sent()) {
header('Content-type: text/html'); //reset content type.
}
}
/**
* testInitializeCallback method
@ -196,7 +217,7 @@ class RequestHandlerComponentTest extends CakeTestCase {
$_SERVER['CONTENT_TYPE'] = 'application/xml; charset=UTF-8';
$this->RequestHandler->startup($this->Controller);
$this->assertTrue(is_object($this->Controller->data));
$this->assertEqual(strtolower(get_class($this->Controller->data)), 'xml');
$this->assertEqual(strtolower(get_class($this->Controller->data)), 'xml');
}
/**
* testNonAjaxRedirect method
@ -481,17 +502,15 @@ class RequestHandlerComponentTest extends CakeTestCase {
unset($_SERVER['HTTP_X_REQUESTED_WITH']);
}
/**
* tearDown method
* init method
*
* @access public
* @access protected
* @return void
*/
function tearDown() {
unset($this->RequestHandler);
unset($this->Controller);
if (!headers_sent()) {
header('Content-type: text/html'); //reset content type.
}
function _init() {
$this->Controller = new RequestHandlerTestController(array('components' => array('RequestHandler')));
$this->Controller->constructClasses();
$this->RequestHandler =& $this->Controller->RequestHandler;
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SecurityComponentTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5435
* @version $Revision$
@ -25,22 +25,27 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Component', 'Security');
/**
* Short description for class.
* TestSecurityComponent
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class TestSecurityComponent extends SecurityComponent {
/**
* validatePost method
*
* @param Controller $controller
* @return unknown
*/
function validatePost(&$controller) {
return $this->_validatePost($controller);
}
}
/**
* Short description for class.
* SecurityTestController
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class SecurityTestController extends Controller {
@ -104,14 +109,27 @@ class SecurityTestController extends Controller {
$this->testHeaders[] = $status;
}
}
/**
* Short description for class.
* SecurityComponentTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class SecurityComponentTest extends CakeTestCase {
/**
* Controller property
*
* @var SecurityTestController
* @access public
*/
var $Controller;
/**
* oldSalt property
*
* @var string
* @access public
*/
var $oldSalt;
/**
* setUp method
*
@ -128,7 +146,7 @@ class SecurityComponentTest extends CakeTestCase {
Configure::write('Security.salt', 'foo!');
}
/**
* Tear-down method. Resets environment state.
* Tear-down method. Resets environment state.
*
* @access public
* @return void
@ -139,7 +157,6 @@ class SecurityComponentTest extends CakeTestCase {
unset($this->Controller);
Configure::write('Security.salt', $this->oldSalt);
}
/**
* testStartup method
*
@ -584,7 +601,6 @@ DIGEST;
$result = $this->Controller->Security->validatePost($this->Controller);
$this->assertTrue($result);
}
/**
* test ValidatePost with multiple select elements.
*
@ -776,7 +792,6 @@ DIGEST;
$result = $this->Controller->Security->validatePost($this->Controller);
$this->assertTrue($result);
}
/**
* testValidateHasManyRecordsPass method
*
@ -1079,5 +1094,4 @@ DIGEST;
$this->assertEqual(current($this->Controller->testHeaders), $expected);
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SessionComponentTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
* @since CakePHP(tm) v 1.2.0.5436
* @version $Revision$
@ -29,12 +29,23 @@ App::import('Component', 'Session');
/**
* SessionTestController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class SessionTestController extends Controller {
/**
* uses property
*
* @var array
* @access public
*/
var $uses = array();
/**
* session_id method
*
* @return string
* @access public
*/
function session_id() {
return $this->Session->id();
}
@ -42,20 +53,31 @@ class SessionTestController extends Controller {
/**
* OrangeSessionTestController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class OrangeSessionTestController extends Controller {
/**
* uses property
*
* @var array
* @access public
*/
var $uses = array();
/**
* session_id method
*
* @return string
* @access public
*/
function session_id() {
return $this->Session->id();
}
}
/**
* Short description for class.
* SessionComponentTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class SessionComponentTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ControllerTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
* @since CakePHP(tm) v 1.2.0.5436
* @version $Revision$
@ -69,7 +69,7 @@ if (!class_exists('AppController')) {
/**
* ControllerPost class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ControllerPost extends CakeTestModel {
@ -146,7 +146,7 @@ class ControllerCommentsController extends AppController {
/**
* ControllerComment class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ControllerComment extends CakeTestModel {
@ -182,7 +182,7 @@ class ControllerComment extends CakeTestModel {
/**
* ControllerAlias class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ControllerAlias extends CakeTestModel {
@ -211,7 +211,7 @@ class ControllerAlias extends CakeTestModel {
/**
* ControllerPaginateModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ControllerPaginateModel extends CakeTestModel {
@ -336,7 +336,6 @@ class TestComponent extends Object {
* @return void
*/
function beforeRedirect() {
return true;
}
}
/**
@ -352,7 +351,6 @@ class AnotherTestController extends AppController {
* @access public
*/
var $name = 'AnotherTest';
/**
* uses property
*
@ -362,9 +360,9 @@ class AnotherTestController extends AppController {
var $uses = null;
}
/**
* Short description for class.
* ControllerTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ControllerTest extends CakeTestCase {
@ -417,7 +415,12 @@ class ControllerTest extends CakeTestCase {
Configure::write('pluginPaths', $_back['pluginPaths']);
unset($Controller);
}
/**
* testAliasName method
*
* @access public
* @return void
*/
function testAliasName() {
$Controller =& new Controller();
$Controller->uses = array('NameTest');
@ -428,7 +431,6 @@ class ControllerTest extends CakeTestCase {
unset($Controller);
}
/**
* testPersistent method
*
@ -735,7 +737,6 @@ class ControllerTest extends CakeTestCase {
* @return void
*/
function testRedirect() {
$url = 'cakephp.org';
$codes = array(
100 => "Continue",
101 => "Switching Protocols",
@ -779,26 +780,85 @@ class ControllerTest extends CakeTestCase {
);
Mock::generatePartial('Controller', 'MockController', array('header'));
Mock::generate('TestComponent', 'MockTestComponent');
Mock::generate('TestComponent', 'MockTestBComponent');
App::import('Helper', 'Cache');
// $codes = array_merge($codes, array_flip($codes));
foreach ($codes as $code => $msg) {
$MockController =& new MockController();
$MockController->components = array('Test');
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}"));
$MockController->expectAt(1, 'header', array('Location: http://cakephp.org'));
$MockController->expectCallCount('header', 2);
$MockController->redirect($url, (int) $code, false);
$MockController->redirect('http://cakephp.org', (int)$code, false);
$this->assertFalse($MockController->autoRender);
}
$codes = array_flip($codes);
foreach ($codes as $code => $msg) {
$MockController =& new MockController();
$MockController->components = array('Test');
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array("HTTP/1.1 {$code} {$msg}"));
$MockController->expectAt(1, 'header', array('Location: http://cakephp.org'));
$MockController->expectCallCount('header', 2);
$MockController->redirect($url, $code, false);
$MockController->redirect('http://cakephp.org', $msg, false);
$this->assertFalse($MockController->autoRender);
}
$MockController =& new MockController();
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array('Location: http://www.example.org/users/login'));
$MockController->expectCallCount('header', 1);
$MockController->redirect('http://www.example.org/users/login', null, false);
$MockController =& new MockController();
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
$MockController->expectAt(1, 'header', array('Location: http://www.example.org/users/login'));
$MockController->expectCallCount('header', 2);
$MockController->redirect('http://www.example.org/users/login', 301, false);
$MockController =& new MockController();
$MockController->components = array('MockTest');
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', null);
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
$MockController->expectAt(1, 'header', array('Location: http://cakephp.org'));
$MockController->expectCallCount('header', 2);
$MockController->redirect('http://cakephp.org', 301, false);
$MockController =& new MockController();
$MockController->components = array('MockTest');
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org');
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
$MockController->expectAt(1, 'header', array('Location: http://book.cakephp.org'));
$MockController->expectCallCount('header', 2);
$MockController->redirect('http://cakephp.org', 301, false);
$MockController =& new MockController();
$MockController->components = array('MockTest');
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', false);
$MockController->expectNever('header');
$MockController->redirect('http://cakephp.org', 301, false);
$MockController =& new MockController();
$MockController->components = array('MockTest', 'MockTestB');
$MockController->Component =& new Component();
$MockController->Component->init($MockController);
$MockController->MockTest->setReturnValue('beforeRedirect', 'http://book.cakephp.org');
$MockController->MockTestB->setReturnValue('beforeRedirect', 'http://bakery.cakephp.org');
$MockController->expectAt(0, 'header', array('HTTP/1.1 301 Moved Permanently'));
$MockController->expectAt(1, 'header', array('Location: http://bakery.cakephp.org'));
$MockController->expectCallCount('header', 2);
$MockController->redirect('http://cakephp.org', 301, false);
}
/**
* testMergeVars method
@ -859,7 +919,7 @@ class ControllerTest extends CakeTestCase {
$this->assertTrue(isset($TestController->ControllerComment));
}
/**
* Ensure that __mergeVars is not being greedy and merging with
* Ensure that __mergeVars is not being greedy and merging with
* AppController when you make an instance of Controller
*
* @return void

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* PagesControllerTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
* @since CakePHP(tm) v 1.2.0.5436
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', array('Controller', 'AppController', 'PagesController'));
/**
* Short description for class.
* PagesControllerTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class PagesControllerTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ScaffoldTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
* @since CakePHP(tm) v 1.2.0.5436
* @version $Revision$
@ -47,9 +47,8 @@ class ScaffoldMockController extends Controller {
*/
var $scaffold;
}
/**
* TestScaffoldMock
* TestScaffoldMock class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller
@ -72,7 +71,6 @@ class TestScaffoldMock extends Scaffold {
return $this->_params;
}
}
/**
* ScaffoldMock class
*
@ -112,9 +110,8 @@ class ScaffoldMock extends CakeTestModel {
)
);
}
/**
* ScaffoldAuthor class
* ScaffoldUser class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller
@ -140,7 +137,6 @@ class ScaffoldUser extends CakeTestModel {
)
);
}
/**
* ScaffoldComment class
*
@ -168,7 +164,6 @@ class ScaffoldComment extends CakeTestModel {
)
);
}
/**
* TestScaffoldView class
*
@ -188,9 +183,9 @@ class TestScaffoldView extends ScaffoldView {
}
}
/**
* ScaffoldViewTest Case.
* ScaffoldViewTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ScaffoldViewTest extends CakeTestCase {
@ -210,6 +205,15 @@ class ScaffoldViewTest extends CakeTestCase {
function setUp() {
$this->Controller =& new ScaffoldMockController();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Controller);
}
/**
* testGetViewFilename method
*
@ -298,7 +302,6 @@ class ScaffoldViewTest extends CakeTestCase {
Configure::write('pluginPaths', $_back['pluginPaths']);
Configure::write('Routing.admin', $_admin);
}
/**
* test default index scaffold generation
*
@ -505,26 +508,21 @@ class ScaffoldViewTest extends CakeTestCase {
Configure::write('Routing.admin', $_backAdmin);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Controller);
}
}
/**
* Scaffold Test Case
* Scaffold Test class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller
*/
class ScaffoldTestCase extends CakeTestCase {
class ScaffoldTest extends CakeTestCase {
/**
* Controller property
*
* @var SecurityTestController
* @access public
*/
var $Controller;
/**
* fixtures property
*
@ -541,6 +539,15 @@ class ScaffoldTestCase extends CakeTestCase {
function setUp() {
$this->Controller =& new ScaffoldMockController();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Controller);
}
/**
* Test the correct Generation of Scaffold Params.
* This ensures that the correct action and view will be generated
@ -573,15 +580,5 @@ class ScaffoldTestCase extends CakeTestCase {
$result = $Scaffold->getParams();
$this->assertEqual($result['action'], 'admin_edit');
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Controller);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* DebuggerTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -26,23 +26,24 @@
*/
App::import('Core', 'Debugger');
/**
* DebugggerTestCaseDebuggger
* DebugggerTestCaseDebuggger class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class DebuggerTestCaseDebugger extends Debugger {
class DebuggerTestCaseDebugger extends Debugger {
}
/**
* Debugger Test Case.
* DebuggerTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class DebuggerTest extends CakeTestCase {
//do not move code below or it change line numbers which are used in the tests
// !!!
// !!! Be careful with changing code below as it may
// !!! change line numbers which are used in the tests
// !!!
/**
* setUp method
*
@ -59,6 +60,15 @@ class DebuggerTest extends CakeTestCase {
}
}
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Configure::write('log', true);
}
/**
* testDocRef method
*
@ -71,18 +81,18 @@ class DebuggerTest extends CakeTestCase {
$debugger = new Debugger();
$this->assertEqual(ini_get('docref_root'), 'http://php.net/');
}
/**
* test Excerpt writing
*
* @access public
* @return void
**/
*/
function testExcerpt() {
$return = Debugger::excerpt(__FILE__, 2, 2);
$this->assertTrue(is_array($return));
$this->assertEqual(count($return), 4);
$this->assertPattern('#/*&nbsp;SVN&nbsp;FILE:&nbsp;\$Id:&nbsp;debugger.test.php#', $return[1]);
$return = Debugger::excerpt('[internal]', 2, 2);
$this->assertTrue(empty($return));
}
@ -247,34 +257,24 @@ class DebuggerTest extends CakeTestCase {
$expected = "<pre>array(\n\t\"People\" => array()\n)</pre>";
$this->assertEqual($expected, $result);
}
/**
* test getInstance.
*
* @return void
**/
function testGetInstance() {
$result = Debugger::getInstance();
$this->assertIsA($result, 'Debugger');
$result = Debugger::getInstance('DebuggerTestCaseDebugger');
$this->assertIsA($result, 'DebuggerTestCaseDebugger');
$result = Debugger::getInstance();
$this->assertIsA($result, 'DebuggerTestCaseDebugger');
$result = Debugger::getInstance('Debugger');
$this->assertIsA($result, 'Debugger');
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
Configure::write('log', true);
}
function testGetInstance() {
$result = Debugger::getInstance();
$this->assertIsA($result, 'Debugger');
$result = Debugger::getInstance('DebuggerTestCaseDebugger');
$this->assertIsA($result, 'DebuggerTestCaseDebugger');
$result = Debugger::getInstance();
$this->assertIsA($result, 'DebuggerTestCaseDebugger');
$result = Debugger::getInstance('Debugger');
$this->assertIsA($result, 'Debugger');
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ErrorHandlerTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -27,15 +27,13 @@
if (class_exists('TestErrorHandler')) {
return;
}
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
/**
* BlueberryComponent class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class BlueberryComponent extends Object {
@ -59,7 +57,7 @@ class BlueberryComponent extends Object {
/**
* BlueberryDispatcher class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class BlueberryDispatcher extends Dispatcher {
@ -77,7 +75,7 @@ class BlueberryDispatcher extends Dispatcher {
/**
* Short description for class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class AuthBlueberryUser extends CakeTestModel {
@ -100,7 +98,7 @@ if (!class_exists('AppController')) {
/**
* AppController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class AppController extends Controller {
@ -144,7 +142,7 @@ App::import('Core', array('Error', 'Controller'));
/**
* TestErrorController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class TestErrorController extends AppController {
@ -169,7 +167,7 @@ class TestErrorController extends AppController {
/**
* BlueberryController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class BlueberryController extends AppController {
@ -198,7 +196,7 @@ class BlueberryController extends AppController {
/**
* TestErrorHandler class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class TestErrorHandler extends ErrorHandler {
@ -213,12 +211,12 @@ class TestErrorHandler extends ErrorHandler {
}
}
/**
* Short description for class.
* ErrorHandlerTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class TestErrorHandlerTest extends CakeTestCase {
class ErrorHandlerTest extends CakeTestCase {
/**
* skip method
*
@ -259,7 +257,7 @@ class TestErrorHandlerTest extends CakeTestCase {
$result = ob_get_clean();
$this->assertPattern('/<h2>Not Found<\/h2>/', $result);
$this->assertPattern("/<strong>'\/test_error'<\/strong>/", $result);
ob_start();
$TestErrorHandler =& new TestErrorHandler('error404', array('message' => 'Page not found'));
ob_get_clean();

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* FileTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -25,11 +25,10 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'File');
/**
* Short description for class.
* FileTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class FileTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* FolderTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'File');
/**
* Short description for class.
* FolderTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class FolderTest extends CakeTestCase {
@ -271,13 +271,16 @@ class FolderTest extends CakeTestCase {
);
$result = $Folder->tree(TEST_CAKE_CORE_INCLUDE_PATH . 'config', false);
$this->assertEqual($result, $expected);
$this->assertIdentical(array_diff($expected[0], $result[0]), array());
$this->assertIdentical(array_diff($result[0], $expected[0]), array());
$result = $Folder->tree(TEST_CAKE_CORE_INCLUDE_PATH . 'config', false, 'dir');
$this->assertEqual($result, $expected[0]);
$this->assertIdentical(array_diff($expected[0], $result), array());
$this->assertIdentical(array_diff($result, $expected[0]), array());
$result = $Folder->tree(TEST_CAKE_CORE_INCLUDE_PATH . 'config', false, 'files');
$this->assertEqual($result, $expected[1]);
$this->assertIdentical(array_diff($expected[1], $result), array());
$this->assertIdentical(array_diff($result, $expected[1]), array());
}
/**
* testWindowsPath method
@ -405,10 +408,20 @@ class FolderTest extends CakeTestCase {
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config');
$result = $Folder->find();
$expected = array('config.php', 'paths.php');
$this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->find('.*', true);
$expected = array('config.php', 'paths.php');
$this->assertIdentical($result, $expected);
$result = $Folder->find('.*\.php');
$expected = array('config.php', 'paths.php');
$this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->find('.*\.php', true);
$expected = array('config.php', 'paths.php');
$this->assertIdentical($result, $expected);
$result = $Folder->find('.*ig\.php');
@ -450,6 +463,14 @@ class FolderTest extends CakeTestCase {
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'config.php',
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'paths.php'
);
$this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->findRecursive('(config|paths)\.php', true);
$expected = array(
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'config.php',
TEST_CAKE_CORE_INCLUDE_PATH . 'config' . DS . 'paths.php'
);
$this->assertIdentical($result, $expected);
$Folder->cd(TMP);
@ -472,6 +493,14 @@ class FolderTest extends CakeTestCase {
TMP . 'testme' . DS . 'my.php',
TMP . 'testme' . DS . 'paths.php'
);
$this->assertIdentical(array_diff($expected, $result), array());
$this->assertIdentical(array_diff($result, $expected), array());
$result = $Folder->findRecursive('(paths|my)\.php', true);
$expected = array(
TMP . 'testme' . DS . 'my.php',
TMP . 'testme' . DS . 'paths.php'
);
$this->assertIdentical($result, $expected);
$Folder->cd(TEST_CAKE_CORE_INCLUDE_PATH . 'config');

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* HttpSocketTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'HttpSocket');
/**
* Short description for class.
* HttpSocketTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class HttpSocketTest extends CakeTestCase {
@ -49,6 +49,8 @@ class HttpSocketTest extends CakeTestCase {
/**
* This function sets up a TestHttpSocket instance we are going to use for testing
*
* @access public
* @return void
*/
function setUp() {
if (!class_exists('TestHttpSocket')) {
@ -62,6 +64,8 @@ class HttpSocketTest extends CakeTestCase {
/**
* We use this function to clean up after the test case was executed
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Socket, $this->RequestSocket);
@ -69,6 +73,8 @@ class HttpSocketTest extends CakeTestCase {
/**
* Test that HttpSocket::__construct does what one would expect it to do
*
* @access public
* @return void
*/
function testConstruct() {
$this->Socket->reset();
@ -92,10 +98,11 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->__construct(array('request' => array('uri' => 'http://www.cakephp.org:23/')));
$this->assertIdentical($this->Socket->config, $baseConfig);
}
/**
* Test that HttpSocket::configUri works properly with different types of arguments
*
* @access public
* @return void
*/
function testConfigUri() {
$this->Socket->reset();
@ -158,10 +165,11 @@ class HttpSocketTest extends CakeTestCase {
$this->assertIdentical($this->Socket->config, $expected);
$this->assertIdentical($r, false);
}
/**
* Tests that HttpSocket::request (the heart of the HttpSocket) is working properly.
*
* @access public
* @return void
*/
function testRequest() {
$this->Socket->reset();
@ -515,10 +523,11 @@ class HttpSocketTest extends CakeTestCase {
$this->RequestSocket->{low($method)}('http://www.google.com/', null, array('line' => 'Hey Server'));
}
}
/**
* Enter description here...
* testParseResponse method
*
* @access public
* @return void
*/
function testParseResponse() {
$this->Socket->reset();
@ -605,10 +614,11 @@ class HttpSocketTest extends CakeTestCase {
}
}
}
/**
* Enter description here...
* testDecodeBody method
*
* @access public
* @return void
*/
function testDecodeBody() {
$this->Socket->reset();
@ -647,10 +657,11 @@ class HttpSocketTest extends CakeTestCase {
}
}
}
/**
* Enter description here...
* testDecodeChunkedBody method
*
* @access public
* @return void
*/
function testDecodeChunkedBody() {
$this->Socket->reset();
@ -763,10 +774,11 @@ class HttpSocketTest extends CakeTestCase {
$r = $this->Socket->buildRequestLine("GET * HTTP/1.1\r\n");
$this->assertIdentical($r, "GET * HTTP/1.1\r\n");
}
/**
* Asserts that HttpSocket::parseUri is working properly
*
* @access public
* @return void
*/
function testParseUri() {
$this->Socket->reset();
@ -867,10 +879,11 @@ class HttpSocketTest extends CakeTestCase {
'port' => 8080,
));
}
/**
* Tests that HttpSocket::buildUri can turn all kinds of uri arrays (and strings) into fully or partially qualified URI's
*
* @access public
* @return void
*/
function testBuildUri() {
$this->Socket->reset();
@ -929,10 +942,11 @@ class HttpSocketTest extends CakeTestCase {
$r = $this->Socket->buildUri(array('scheme' => 'foo', 'host' => 'www.cakephp.org'));
$this->assertIdentical($r, 'foo://www.cakephp.org:80/');
}
/**
* Asserts that HttpSocket::parseQuery is working properly
*
* @access public
* @return void
*/
function testParseQuery() {
$this->Socket->reset();
@ -1033,11 +1047,12 @@ class HttpSocketTest extends CakeTestCase {
);
$this->assertIdentical($query, $expectedQuery);
}
/**
* Tests that HttpSocket::buildHeader can turn a given $header array into a proper header string according to
* HTTP 1.1 specs.
*
* @access public
* @return void
*/
function testBuildHeader() {
$this->Socket->reset();
@ -1070,10 +1085,11 @@ class HttpSocketTest extends CakeTestCase {
$this->assertIdentical($r, "Test\"@\"Field: My value\r\n");
}
/**
* Test that HttpSocket::parseHeader can take apart a given (and valid) $header string and turn it into an array.
*
* @access public
* @return void
*/
function testParseHeader() {
$this->Socket->reset();
@ -1131,10 +1147,10 @@ class HttpSocketTest extends CakeTestCase {
$this->assertIdentical($r, $expected);
}
/**
* undocumented function
* testParseCookies method
*
* @return void
* @access public
* @return void
*/
function testParseCookies() {
$header = array(
@ -1168,7 +1184,7 @@ class HttpSocketTest extends CakeTestCase {
$this->assertEqual($cookies, $expected);
}
/**
* undocumented function
* testBuildCookies method
*
* @return void
* @access public
@ -1191,6 +1207,8 @@ class HttpSocketTest extends CakeTestCase {
/**
* Tests that HttpSocket::__tokenEscapeChars() returns the right characters.
*
* @access public
* @return void
*/
function testTokenEscapeChars() {
$this->Socket->reset();
@ -1211,10 +1229,11 @@ class HttpSocketTest extends CakeTestCase {
$r = $this->Socket->__tokenEscapeChars(false);
$this->assertEqual($r, $expected);
}
/**
* Test that HttpSocket::escapeToken is escaping all characters as descriped in RFC 2616 (HTTP 1.1 specs)
*
* @access public
* @return void
*/
function testEscapeToken() {
$this->Socket->reset();
@ -1235,10 +1254,11 @@ class HttpSocketTest extends CakeTestCase {
$expectedToken = 'Extreme-":"Token-" "-""""@"-test';
$this->assertIdentical($expectedToken, $escapedToken);
}
/**
* Test that escaped token strings are properly unescaped by HttpSocket::unescapeToken
*
* @access public
* @return void
*/
function testUnescapeToken() {
$this->Socket->reset();
@ -1259,11 +1279,12 @@ class HttpSocketTest extends CakeTestCase {
$expectedToken = 'Extreme-:Token- -"@-test';
$this->assertIdentical($expectedToken, $escapedToken);
}
/**
* This tests asserts HttpSocket::reset() resets a HttpSocket instance to it's initial state (before Object::__construct
* got executed)
*
* @access public
* @return void
*/
function testReset() {
$this->Socket->reset();
@ -1281,11 +1302,12 @@ class HttpSocketTest extends CakeTestCase {
$this->assertIdentical($return, true);
}
/**
* This tests asserts HttpSocket::reset(false) resets certain HttpSocket properties to their initial state (before
* Object::__construct got executed).
*
* @access public
* @return void
*/
function testPartialReset() {
$this->Socket->reset();
@ -1308,6 +1330,5 @@ class HttpSocketTest extends CakeTestCase {
}
$this->assertIdentical($return, true);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* I18nTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'i18n');
/**
* Short description for class.
* I18nTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class I18nTest extends CakeTestCase {
@ -2336,7 +2336,12 @@ class I18nTest extends CakeTestCase {
$this->assertFalse(in_array('24 everything else (from core translated)', $corePlurals));
$this->assertFalse(in_array('25 everything else (from core translated)', $corePlurals));
}
/**
* testPluginTranslation method
*
* @access public
* @return void
*/
function testPluginTranslation() {
$pluginPaths = Configure::read('pluginPaths');
Configure::write('pluginPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins'));

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* InflectorTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'Inflector');
/**
* Short description for class.
* InflectorTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class InflectorTest extends CakeTestCase {
@ -48,6 +48,15 @@ class InflectorTest extends CakeTestCase {
function setUp() {
$this->Inflector = Inflector::getInstance();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Inflector);
}
/**
* testInstantiation method
*
@ -246,14 +255,5 @@ class InflectorTest extends CakeTestCase {
$this->assertEqual(Inflector::humanize('posts_tags'), 'Posts Tags');
$this->assertEqual(Inflector::humanize('file_systems'), 'File Systems');
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Inflector);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* L10nTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -28,7 +28,7 @@ App::import('Core', 'l10n');
/**
* L10nTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class L10nTest extends CakeTestCase {

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for behavior.test.php
* BehaviorTest file
*
* Long description for behavior.test.php
*
@ -24,12 +24,11 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Model', 'AppModel');
require_once dirname(__FILE__) . DS . 'models.php';
/**
* Short description for class.
* TestBehavior class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TestBehavior extends ModelBehavior {
@ -329,7 +328,6 @@ class TestBehavior extends ModelBehavior {
* @subpackage cake.tests.cases.libs.model
*/
class Test2Behavior extends TestBehavior{
}
/**
* Test3Behavior class
@ -338,7 +336,6 @@ class Test2Behavior extends TestBehavior{
* @subpackage cake.tests.cases.libs.model
*/
class Test3Behavior extends TestBehavior{
}
/**
* BehaviorTest class
@ -354,6 +351,15 @@ class BehaviorTest extends CakeTestCase {
* @access public
*/
var $fixtures = array('core.apple', 'core.sample');
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
ClassRegistry::flush();
}
/**
* testBehaviorBinding method
*
@ -942,10 +948,10 @@ class BehaviorTest extends CakeTestCase {
$expected = array('TestBehavior', 'Test2Behavior');
$this->assertIdentical($Apple->beforeTestResult, $expected);
}
/**
* Test attach and detaching
*
* @access public
* @return void
**/
function testBehaviorAttachAndDetach() {
@ -954,19 +960,8 @@ class BehaviorTest extends CakeTestCase {
$Sample->Behaviors->init($Sample->alias, $Sample->actsAs);
$Sample->Behaviors->attach('Test2');
$Sample->Behaviors->detach('Test3');
$Sample->Behaviors->trigger($Sample, 'beforeTest');
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
ClassRegistry::flush();
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Acl behavior test
* AclBehaviorTest file
*
* Test the Acl Behavior
*
@ -26,11 +26,10 @@
*/
App::import('Behavior', 'Acl');
App::import('Core', 'db_acl');
/**
* Test Person Class - self joined model
* Test Person class - self joined model
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class AclPerson extends CakeTestModel {
@ -79,12 +78,12 @@ class AclPerson extends CakeTestModel {
'foreignKey' => 'mother_id'
)
);
/**
* ParentNode
* parentNode method
*
* @return void
**/
* @access public
*/
function parentNode() {
if (!$this->id && empty($this->data)) {
return null;
@ -99,13 +98,11 @@ class AclPerson extends CakeTestModel {
return array('AclPerson' => array('id' => $data['AclPerson']['mother_id']));
}
}
}
/**
* Acl Test User
* AclUser class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class AclUser extends CakeTestModel {
@ -139,11 +136,10 @@ class AclUser extends CakeTestModel {
return null;
}
}
/**
* Acl Test User
* AclPost class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class AclPost extends CakeTestModel {
@ -177,33 +173,62 @@ class AclPost extends CakeTestModel {
return null;
}
}
/**
* ACL behavior test class
* AclBehaviorTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class AclBehaviorTestCase extends CakeTestCase {
/**
* Aco property
*
* @var Aco
* @access public
*/
var $Aco;
/**
* Aro property
*
* @var Aro
* @access public
*/
var $Aro;
/**
* fixtures property
*
* @var array
* @access public
*/
var $fixtures = array('core.person', 'core.user', 'core.post', 'core.aco', 'core.aro', 'core.aros_aco');
/**
* Set up the test
*
* @return void
**/
* @access public
*/
function startTest() {
Configure::write('Acl.database', 'test_suite');
$this->Aco =& new Aco();
$this->Aro =& new Aro();
}
/**
* tearDown method
*
* @return void
* @access public
*/
function tearDown() {
ClassRegistry::flush();
unset($this->Aro, $this->Aco);
}
/**
* Test Setup of AclBehavior
*
* @return void
**/
* @access public
*/
function testSetup() {
$User =& new AclUser();
$this->assertTrue(isset($User->Behaviors->Acl->settings['User']));
@ -215,12 +240,12 @@ class AclBehaviorTestCase extends CakeTestCase {
$this->assertEqual($Post->Behaviors->Acl->settings['Post']['type'], 'controlled');
$this->assertTrue(is_object($Post->Aco));
}
/**
* test After Save
*
* @return void
**/
* @access public
*/
function testAfterSave() {
$Post =& new AclPost();
$data = array(
@ -264,12 +289,12 @@ class AclBehaviorTestCase extends CakeTestCase {
$this->assertEqual($node[0]['Aro']['parent_id'], 5);
$this->assertEqual($node[1]['Aro']['parent_id'], null);
}
/**
* Test After Delete
*
* @return void
**/
* @access public
*/
function testAfterDelete() {
$aroData = array(
'Aro' => array(
@ -317,12 +342,12 @@ class AclBehaviorTestCase extends CakeTestCase {
$this->assertTrue(empty($result));
}
/**
* Test Node()
*
* @return void
**/
* @access public
*/
function testNode() {
$Person =& new AclPerson();
$aroData = array(
@ -339,16 +364,5 @@ class AclBehaviorTestCase extends CakeTestCase {
$this->assertTrue(is_array($result));
$this->assertEqual(sizeof($result), 1);
}
/**
* tear down test
*
* @return void
**/
function tearDown() {
ClassRegistry::flush();
unset($this->Aro, $this->Aco);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ContainableBehaviorTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
* @since CakePHP(tm) v 1.2.0.5669
* @version $Revision$
@ -24,7 +24,6 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', array('AppModel', 'Model'));
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
/**
@ -33,7 +32,7 @@ require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class ContainableTest extends CakeTestCase {
class ContainableBehaviorTest extends CakeTestCase {
/**
* Fixtures associated with this test case
*
@ -2868,25 +2867,32 @@ class ContainableTest extends CakeTestCase {
$this->assertEqual($result, $expected);
$result = $this->Article->find('all', array('contain' => array('Comment(comment, published)' => 'Attachment(attachment)', 'User(user)'), 'fields' => array('title')));
if (!empty($result)) {
foreach($result as $i=>$article) {
foreach($article['Comment'] as $j=>$comment) {
$result[$i]['Comment'][$j] = array_diff_key($comment, array('id'=>true));
}
}
}
$expected = array(
array(
'Article' => array('title' => 'First Article', 'id' => 1),
'User' => array('user' => 'mariano', 'id' => 1),
'Comment' => array(
array('comment' => 'First Comment for First Article', 'published' => 'Y', 'id' => 1, 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'Second Comment for First Article', 'published' => 'Y', 'id' => 2, 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'Third Comment for First Article', 'published' => 'Y', 'id' => 3, 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'Fourth Comment for First Article', 'published' => 'N', 'id' => 4, 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'First Comment for First Article', 'published' => 'Y', 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'Second Comment for First Article', 'published' => 'Y', 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'Third Comment for First Article', 'published' => 'Y', 'article_id' => 1, 'Attachment' => array()),
array('comment' => 'Fourth Comment for First Article', 'published' => 'N', 'article_id' => 1, 'Attachment' => array()),
)
),
array(
'Article' => array('title' => 'Second Article', 'id' => 2),
'User' => array('user' => 'larry', 'id' => 3),
'Comment' => array(
array('comment' => 'First Comment for Second Article', 'published' => 'Y', 'id' => 5, 'article_id' => 2, 'Attachment' => array(
array('comment' => 'First Comment for Second Article', 'published' => 'Y', 'article_id' => 2, 'Attachment' => array(
'attachment' => 'attachment.zip', 'id' => 1
)),
array('comment' => 'Second Comment for Second Article', 'published' => 'Y', 'id' => 6, 'article_id' => 2, 'Attachment' => array())
array('comment' => 'Second Comment for Second Article', 'published' => 'Y', 'article_id' => 2, 'Attachment' => array())
)
),
array(
@ -3534,5 +3540,4 @@ class ContainableTest extends CakeTestCase {
return $debug;
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* TranslateBehaviorTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
* @since CakePHP(tm) v 1.2.0.5669
* @version $Revision$
@ -30,14 +30,13 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
App::import('Core', array('AppModel', 'Model'));
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
/**
* TranslateTest class.
* TranslateBehaviorTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class TranslateTest extends CakeTestCase {
class TranslateBehaviorTest extends CakeTestCase {
/**
* autoFixtures property
*

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* TreeBehaviorTest file
*
* Long description for file
* Holds several Test Cases
*
* PHP versions 4 and 5
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
* @since CakePHP(tm) v 1.2.0.5330
* @version $Revision$
@ -27,12 +27,12 @@
App::import('Core', array('AppModel', 'Model'));
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
/**
* NumberTreeCase class
* NumberTreeTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class NumberTreeCase extends CakeTestCase {
class NumberTreeTest extends CakeTestCase {
/**
* settings property
*
@ -1205,12 +1205,12 @@ class NumberTreeCase extends CakeTestCase {
}
}
/**
* ScopedTreeCase class
* ScopedTreeTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class ScopedTreeCase extends NumberTreeCase {
class ScopedTreeTest extends NumberTreeTest {
/**
* settings property
*
@ -1435,12 +1435,12 @@ class ScopedTreeCase extends NumberTreeCase {
}
}
/**
* AfterTreeCase class
* AfterTreeTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class AfterTreeCase extends NumberTreeCase {
class AfterTreeTest extends NumberTreeTest {
/**
* settings property
*
@ -1479,12 +1479,12 @@ class AfterTreeCase extends NumberTreeCase {
}
}
/**
* UnconventionalTreeCase class
* UnconventionalTreeTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class UnconventionalTreeCase extends NumberTreeCase {
class UnconventionalTreeTest extends NumberTreeTest {
/**
* settings property
*
@ -1506,12 +1506,12 @@ class UnconventionalTreeCase extends NumberTreeCase {
var $fixtures = array('core.unconventional_tree');
}
/**
* UuidTreeCase class
* UuidTreeTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.model.behaviors
*/
class UuidTreeCase extends NumberTreeCase {
class UuidTreeTest extends NumberTreeTest {
/**
* settings property
*

View file

@ -1,9 +1,9 @@
<?php
/* SVN FILE: $Id$ */
/**
* AdoDB layer for DBO.
* DboAdodbTest file
*
* Long description for file
* AdoDB layer for DBO
*
* PHP versions 4 and 5
*
@ -24,16 +24,14 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
require_once LIBS.'model'.DS.'model.php';
require_once LIBS.'model'.DS.'datasources'.DS.'datasource.php';
require_once LIBS.'model'.DS.'datasources'.DS.'dbo_source.php';
require_once LIBS.'model'.DS.'datasources'.DS.'dbo'.DS.'dbo_adodb.php';
/**
* Short description for class.
* DboAdoTestDb
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class DboAdoTestDb extends DboAdodb {
@ -75,11 +73,10 @@ class DboAdoTestDb extends DboAdodb {
return $this->simulated[count($this->simulated) - 1];
}
}
/**
* Short description for class.
* AdodbTestModel
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class AdodbTestModel extends CakeTestModel {
@ -152,7 +149,6 @@ class AdodbTestModel extends CakeTestModel {
);
}
}
if (!class_exists('Article')) {
/**
* Article class
@ -171,29 +167,27 @@ if (!class_exists('Article')) {
}
}
/**
* The test class for the DboAdobd
* DboAdodbTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboAdodbTest extends CakeTestCase {
/**
* The Dbo instance to be tested
*
* @var object
* @var DboSource
* @access public
*/
var $db = null;
/**
* undocumented class variable
* fixtures property
*
* @var string
* @access public
**/
var $fixtures = array('core.article');
/**
* Skip if cannot connect to AdoDb
*
@ -280,6 +274,5 @@ class DboAdodbTest extends CakeTestCase {
function testColumns() {
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* DboMssql test
* DboMssqlTest file
*
* PHP versions 4 and 5
*
@ -29,7 +29,6 @@ require_once LIBS.'model'.DS.'model.php';
require_once LIBS.'model'.DS.'datasources'.DS.'datasource.php';
require_once LIBS.'model'.DS.'datasources'.DS.'dbo_source.php';
require_once LIBS.'model'.DS.'datasources'.DS.'dbo'.DS.'dbo_mssql.php';
/**
* DboMssqlTestDb class
*
@ -37,14 +36,32 @@ require_once LIBS.'model'.DS.'datasources'.DS.'dbo'.DS.'dbo_mssql.php';
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMssqlTestDb extends DboMssql {
function __construct() {}
/**
* Contructor
*
* @return void
* @access public
*/
function __construct() {
}
/**
* connect method
*
* @return boolean
* @access public
*/
function connect() {
$this->connected = true;
return true;
}
function lastError() {}
/**
* lastError method
*
* @return void
* @access public
*/
function lastError() {
}
/**
* simulated property
*
@ -54,7 +71,7 @@ class DboMssqlTestDb extends DboMssql {
var $simulated = array();
/**
* fetchAllResultsStack
*
*
* @var array
* @access public
*/
@ -72,8 +89,8 @@ class DboMssqlTestDb extends DboMssql {
}
/**
* fetchAll method
*
* @param mixed $sql
*
* @param mixed $sql
* @access protected
* @return void
*/
@ -82,8 +99,8 @@ class DboMssqlTestDb extends DboMssql {
}
/**
* fetchAll method
*
* @param mixed $sql
*
* @param mixed $sql
* @access protected
* @return void
*/
@ -104,11 +121,10 @@ class DboMssqlTestDb extends DboMssql {
return $this->simulated[count($this->simulated) - 1];
}
}
/**
* Short description for class.
* MssqlTestModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class MssqlTestModel extends Model {
@ -183,16 +199,16 @@ class MssqlTestModel extends Model {
}
}
/**
* The test class for the DboMssql
* DboMssqlTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMssqlTest extends CakeTestCase {
/**
* The Dbo instance to be tested
*
* @var object
* @var DboSource
* @access public
*/
var $db = null;
@ -215,6 +231,16 @@ class DboMssqlTest extends CakeTestCase {
$this->db = new DboMssqlTestDb($db->config);
$this->model = new MssqlTestModel();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->model);
}
/**
* testQuoting method
*
@ -284,7 +310,7 @@ class DboMssqlTest extends CakeTestCase {
}
/**
* testDescribe method
*
*
* @access public
* @return void
*/
@ -314,7 +340,12 @@ class DboMssqlTest extends CakeTestCase {
);
$this->assertEqual($result, $expected);
}
/**
* testUpdateAllSyntax method
*
* @return void
* @access public
*/
function testUpdateAllSyntax() {
$model = ClassRegistry::init('MssqlTestModel');
$fields = array('MssqlTestModel.client_id' => '[MssqlTestModel].[client_id] + 1');
@ -326,15 +357,5 @@ class DboMssqlTest extends CakeTestCase {
$this->assertPattern('/^UPDATE \[mssql_test_models\]/', $result);
$this->assertPattern('/SET \[client_id\] = \[client_id\] \+ 1/', $result);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->model);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* DboMysql test
* DboMysqlTest file
*
* PHP versions 4 and 5
*
@ -26,9 +26,9 @@ App::import('Core', array('Model', 'DataSource', 'DboSource', 'DboMysql'));
Mock::generatePartial('DboMysql', 'QueryMockDboMysql', array('query'));
/**
* Short description for class.
* DboMysqlTestDb class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class DboMysqlTestDb extends DboMysql {
@ -71,9 +71,9 @@ class DboMysqlTestDb extends DboMysql {
}
}
/**
* Short description for class.
* MysqlTestModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class MysqlTestModel extends Model {
@ -147,16 +147,16 @@ class MysqlTestModel extends Model {
}
}
/**
* The test class for the DboMysql
* DboMysqlTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMysqlTest extends CakeTestCase {
/**
* The Dbo instance to be tested
*
* @var object
* @var DboSource
* @access public
*/
var $Db = null;
@ -372,76 +372,76 @@ class DboMysqlTest extends CakeTestCase {
$name = $this->db->fullTableName('simple');
$mockDbo =& new QueryMockDboMysql($this);
$columnData = array(
$columnData = array(
array('0' => array(
'Table' => 'with_compound_keys',
'Non_unique' => '0',
'Key_name' => 'PRIMARY',
'Seq_in_index' => '1',
'Column_name' => 'id',
'Collation' => 'A',
'Cardinality' => '0',
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => '',
'Index_type' => 'BTREE',
'Comment' => ''
)),
array('0' => array(
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'pointless_bool',
'Seq_in_index' => '1',
'Column_name' => 'bool',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Table' => 'with_compound_keys',
'Non_unique' => '0',
'Key_name' => 'PRIMARY',
'Seq_in_index' => '1',
'Column_name' => 'id',
'Collation' => 'A',
'Cardinality' => '0',
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => '',
'Index_type' => 'BTREE',
'Comment' => ''
)),
array('0' => array(
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'pointless_small_int',
'Seq_in_index' => '1',
'Column_name' => 'small_int',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'pointless_bool',
'Seq_in_index' => '1',
'Column_name' => 'bool',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
)),
)),
array('0' => array(
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'one_way',
'Seq_in_index' => '1',
'Column_name' => 'bool',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'pointless_small_int',
'Seq_in_index' => '1',
'Column_name' => 'small_int',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
)),
)),
array('0' => array(
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'one_way',
'Seq_in_index' => '2',
'Column_name' => 'small_int',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'one_way',
'Seq_in_index' => '1',
'Column_name' => 'bool',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
)),
array('0' => array(
'Table' => 'with_compound_keys',
'Non_unique' => '1',
'Key_name' => 'one_way',
'Seq_in_index' => '2',
'Column_name' => 'small_int',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
))
);
$mockDbo->setReturnValue('query', $columnData, array('SHOW INDEX FROM ' . $name));
@ -504,7 +504,7 @@ class DboMysqlTest extends CakeTestCase {
}
/**
* testAlterSchemaIndexes method
*
*
* @access public
* @return void
*/
@ -538,10 +538,10 @@ class DboMysqlTest extends CakeTestCase {
'PRIMARY' => array('column' => 'id', 'unique' => 1))
)));
$this->db->query($this->db->alterSchema($schema2->compare($schema1)));
$indexes = $this->db->index('altertest');
$this->assertEqual($schema2->tables['altertest']['indexes'], $indexes);
// Change three indexes, delete one and add another one
$schema3 =& new CakeSchema(array(
'name' => 'AlterTest3',
@ -552,7 +552,7 @@ class DboMysqlTest extends CakeTestCase {
'group1' => array('type' => 'integer', 'null' => true),
'group2' => array('type' => 'integer', 'null' => true),
'indexes' => array(
'name_idx' => array('column' => 'name', 'unique' => 1),
'name_idx' => array('column' => 'name', 'unique' => 1),
'group_idx' => array('column' => 'group2', 'unique' => 0),
'compound_idx' => array('column' => array('group2', 'group1'), 'unique' => 0),
'id_name_idx' => array('column' => array('id', 'name'), 'unique' => 0))
@ -575,5 +575,4 @@ class DboMysqlTest extends CakeTestCase {
$this->db->query($this->db->dropSchema($schema1));
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* DboMysqli test
* DboMysqliTest file
*
* PHP versions 4 and 5
*
@ -22,16 +22,14 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
App::import('Core', array('Model', 'DataSource', 'DboSource', 'DboMysqli'));
/**
* Short description for class.
* DboMysqliTestDb class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class DboMysqliTestDb extends DboMysqli {
@ -74,9 +72,9 @@ class DboMysqliTestDb extends DboMysqli {
}
}
/**
* Short description for class.
* MysqliTestModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class MysqliTestModel extends Model {
@ -150,16 +148,16 @@ class MysqliTestModel extends Model {
}
}
/**
* The test class for the DboMysqli
* DboMysqliTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboMysqliTest extends CakeTestCase {
/**
* The Dbo instance to be tested
*
* @var object
* @var DboSource
* @access public
*/
var $Db = null;
@ -300,5 +298,4 @@ class DboMysqliTest extends CakeTestCase {
$this->assertEqual($result, $expected);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* DboOracle test
* DboOracleTest file
*
* PHP versions 4 and 5
*
@ -22,13 +22,11 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
require_once LIBS . 'model' . DS . 'datasources' . DS . 'dbo_source.php';
require_once LIBS . 'model' . DS . 'datasources' . DS . 'dbo' . DS . 'dbo_oracle.php';
/**
* DboOracleTest class
*
@ -39,7 +37,7 @@ class DboOracleTest extends CakeTestCase {
/**
* fixtures property
*/
var $fixtures = array('core.oracle_user');
var $fixtures = array('core.oracle_user');
/**
* setup method
*
@ -99,7 +97,6 @@ class DboOracleTest extends CakeTestCase {
$this->db->config['password'] = $old_pw;
$this->db->connect();
}
/**
* testName method
*
@ -131,10 +128,5 @@ class DboOracleTest extends CakeTestCase {
$this->assertEqual($e, $r);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* DboPostgres test
* DboPostgresTest file
*
* PHP versions 4 and 5
*
@ -24,13 +24,11 @@
*/
App::import('Core', array('Model', 'DataSource', 'DboSource', 'DboPostgres'));
App::import('Model', 'App');
require_once dirname(dirname(dirname(__FILE__))) . DS . 'models.php';
/**
* Short description for class.
* DboPostgresTestDb class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class DboPostgresTestDb extends DboPostgres {
@ -63,9 +61,9 @@ class DboPostgresTestDb extends DboPostgres {
}
}
/**
* Short description for class.
* PostgresTestModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class PostgresTestModel extends Model {
@ -139,9 +137,9 @@ class PostgresTestModel extends Model {
}
}
/**
* The test class for the DboPostgres
* DboPostgresTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboPostgresTest extends CakeTestCase {
@ -159,19 +157,19 @@ class DboPostgresTest extends CakeTestCase {
* @var object
* @access public
*/
var $fixtures = array('core.user', 'core.binary_test', 'core.comment', 'core.article',
var $fixtures = array('core.user', 'core.binary_test', 'core.comment', 'core.article',
'core.tag', 'core.articles_tag', 'core.attachment', 'core.person', 'core.post', 'core.author');
/**
* Actual DB connection used in testing
*
* @var object
* @var DboSource
* @access public
*/
var $db = null;
/**
* Simulated DB connection used in testing
*
* @var object
* @var DboSource
* @access public
*/
var $db2 = null;
@ -376,7 +374,6 @@ class DboPostgresTest extends CakeTestCase {
$expected = '"foo" text DEFAULT \'FOO\'';
$this->assertEqual($this->db->buildColumn($result), $expected);
}
/**
* Tests that binary data is escaped/unescaped properly on reads and writes
*
@ -409,7 +406,6 @@ class DboPostgresTest extends CakeTestCase {
$result = $model->find('first');
$this->assertEqual($result['BinaryTest']['data'], $data);
}
/**
* Tests the syntax of generated schema indexes
*
@ -479,7 +475,6 @@ class DboPostgresTest extends CakeTestCase {
$db1->query('DROP TABLE ' . $db1->fullTableName('datatypes'));
}
/**
* Test index generation from table info.
*
@ -498,7 +493,7 @@ class DboPostgresTest extends CakeTestCase {
);
$result = $this->db->index($name);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
$name = $this->db->fullTableName('index_test_2', false);
$this->db->query('CREATE TABLE ' . $name . ' ("id" serial NOT NULL PRIMARY KEY, "bool" integer, "small_char" varchar(50), "description" varchar(40) )');
@ -532,7 +527,7 @@ class DboPostgresTest extends CakeTestCase {
)
));
$this->db->query($this->db->createSchema($Old));
$New =& new CakeSchema(array(
'connection' => 'test_suite',
'name' => 'AlterPosts',
@ -547,13 +542,13 @@ class DboPostgresTest extends CakeTestCase {
)
));
$this->db->query($this->db->alterSchema($New->compare($Old), 'alter_posts'));
$model = new CakeTestModel(array('table' => 'alter_posts', 'ds' => 'test_suite'));
$result = $model->schema();
$this->assertTrue(isset($result['status']));
$this->assertFalse(isset($result['published']));
$this->assertEqual($result['body']['type'], 'string');
$this->db->query($this->db->dropSchema($New));
}
/**
@ -561,7 +556,7 @@ class DboPostgresTest extends CakeTestCase {
*
* @access public
* @return void
*/
*/
function testAlterIndexes() {
$this->db->cacheSources = false;
@ -594,10 +589,10 @@ class DboPostgresTest extends CakeTestCase {
)
));
$this->db->query($this->db->alterSchema($schema2->compare($schema1)));
$indexes = $this->db->index('altertest');
$this->assertEqual($schema2->tables['altertest']['indexes'], $indexes);
// Change three indexes, delete one and add another one
$schema3 =& new CakeSchema(array(
'name' => 'AlterTest3',
@ -608,7 +603,7 @@ class DboPostgresTest extends CakeTestCase {
'group1' => array('type' => 'integer', 'null' => true),
'group2' => array('type' => 'integer', 'null' => true),
'indexes' => array(
'name_idx' => array('column' => 'name', 'unique' => 1),
'name_idx' => array('column' => 'name', 'unique' => 1),
'group_idx' => array('column' => 'group2', 'unique' => 0),
'compound_idx' => array('column' => array('group2', 'group1'), 'unique' => 0),
'another_idx' => array('column' => array('group1', 'name'), 'unique' => 0))

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* DboSqlite test
* DboSqliteTest file
*
* PHP versions 4 and 5
*
@ -23,11 +23,10 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', array('Model', 'DataSource', 'DboSource', 'DboSqlite'));
/**
* Short description for class.
* DboSqliteTestDb class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class DboSqliteTestDb extends DboSqlite {
@ -60,9 +59,9 @@ class DboSqliteTestDb extends DboSqlite {
}
}
/**
* The test class for the DboPostgres
* DboSqliteTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources.dbo
*/
class DboSqliteTest extends CakeTestCase {
@ -83,14 +82,14 @@ class DboSqliteTest extends CakeTestCase {
/**
* Actual DB connection used in testing
*
* @var object
* @var DboSource
* @access public
*/
var $db = null;
/**
* Simulated DB connection used in testing
*
* @var object
* @var DboSource
* @access public
*/
var $db2 = null;
@ -150,7 +149,7 @@ class DboSqliteTest extends CakeTestCase {
*
* @access public
* @return void
*/
*/
function testIndex() {
$name = $this->db->fullTableName('with_a_key');
$this->db->query('CREATE TABLE ' . $name . ' ("id" int(11) PRIMARY KEY, "bool" int(1), "small_char" varchar(50), "description" varchar(40) );');
@ -160,12 +159,12 @@ class DboSqliteTest extends CakeTestCase {
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'pointless_bool' => array('column' => 'bool', 'unique' => 0),
'char_index' => array('column' => 'small_char', 'unique' => 1),
);
$result = $this->db->index($name);
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
$this->db->query('CREATE TABLE ' . $name . ' ("id" int(11) PRIMARY KEY, "bool" int(1), "small_char" varchar(50), "description" varchar(40) );');
$this->db->query('CREATE UNIQUE INDEX multi_col ON ' . $name . '("small_char", "bool")');
$expected = array(
@ -176,7 +175,6 @@ class DboSqliteTest extends CakeTestCase {
$this->assertEqual($expected, $result);
$this->db->query('DROP TABLE ' . $name);
}
/**
* Tests that cached table descriptions are saved under the sanitized key name
*
@ -199,7 +197,7 @@ class DboSqliteTest extends CakeTestCase {
$db->cacheSources = false;
$fileName = '_' . preg_replace('/[^A-Za-z0-9_\-+]/', '_', TMP . $dbName) . '_list';
$result = Cache::read($fileName, '_cake_model_');
$this->assertEqual($result, array('test_list'));
@ -207,5 +205,4 @@ class DboSqliteTest extends CakeTestCase {
Configure::write('Cache.disable', true);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* DboSourceTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -30,11 +30,10 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
App::import('Core', array('Model', 'DataSource', 'DboSource', 'DboMysql'));
App::import('Model', 'App');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**
* Short description for class.
* TestModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel extends CakeTestModel {
@ -106,9 +105,9 @@ class TestModel extends CakeTestModel {
}
}
/**
* Short description for class.
* TestModel2 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel2 extends CakeTestModel {
@ -128,9 +127,9 @@ class TestModel2 extends CakeTestModel {
var $useTable = false;
}
/**
* Short description for class.
* TestModel4 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel3 extends CakeTestModel {
@ -150,9 +149,9 @@ class TestModel3 extends CakeTestModel {
var $useTable = false;
}
/**
* Short description for class.
* TestModel4 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel4 extends CakeTestModel {
@ -232,6 +231,12 @@ class TestModel4 extends CakeTestModel {
return $this->_schema;
}
}
/**
* TestModel4TestModel7 class
*
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel4TestModel7 extends CakeTestModel {
/**
* name property
@ -271,9 +276,9 @@ class TestModel4TestModel7 extends CakeTestModel {
}
}
/**
* Short description for class.
* TestModel5 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel5 extends CakeTestModel {
@ -338,9 +343,9 @@ class TestModel5 extends CakeTestModel {
}
}
/**
* Short description for class.
* TestModel6 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel6 extends CakeTestModel {
@ -395,9 +400,9 @@ class TestModel6 extends CakeTestModel {
}
}
/**
* Short description for class.
* TestModel7 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel7 extends CakeTestModel {
@ -441,9 +446,9 @@ class TestModel7 extends CakeTestModel {
}
}
/**
* Short description for class.
* TestModel8 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel8 extends CakeTestModel {
@ -501,9 +506,9 @@ class TestModel8 extends CakeTestModel {
}
}
/**
* Short description for class.
* TestModel9 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class TestModel9 extends CakeTestModel {
@ -1136,11 +1141,10 @@ class ArticleFeatured2 extends CakeTestModel {
return $this->_schema;
}
}
/**
* Short description for class.
* DboSourceTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model.datasources
*/
class DboSourceTest extends CakeTestCase {
@ -3135,7 +3139,7 @@ class DboSourceTest extends CakeTestCase {
'fields' => null, 'order' => null, 'recursive' => null
));
$this->assertEqual($result, $expected);
$result = $this->testDb->query('findByFindBy', array('value'), $this->Model);
$expected = array('first', array(
'conditions' => array('TestModel.find_by' => 'value'),
@ -3806,5 +3810,4 @@ class DboSourceTest extends CakeTestCase {
$this->assertNoPattern('/Took:/s', $contents);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* DbAclTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -27,16 +27,14 @@
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
App::import('Component', 'Acl');
App::import('Core', 'db_acl');
/**
* DB ACL wrapper test class
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* DB ACL wrapper test class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbAclNodeTestBase extends AclNode {
/**
* useDbConfig property
@ -53,13 +51,12 @@ class DbAclNodeTestBase extends AclNode {
*/
var $cacheSources = false;
}
/**
* Aro Test Wrapper
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* Aro Test Wrapper
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbAroTest extends DbAclNodeTestBase {
/**
* name property
@ -83,13 +80,12 @@ class DbAroTest extends DbAclNodeTestBase {
*/
var $hasAndBelongsToMany = array('DbAcoTest' => array('with' => 'DbPermissionTest'));
}
/**
* Aco Test Wrapper
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* Aco Test Wrapper
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbAcoTest extends DbAclNodeTestBase {
/**
* name property
@ -113,13 +109,12 @@ class DbAcoTest extends DbAclNodeTestBase {
*/
var $hasAndBelongsToMany = array('DbAroTest' => array('with' => 'DbPermissionTest'));
}
/**
* Permission Test Wrapper
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* Permission Test Wrapper
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbPermissionTest extends CakeTestModel {
/**
* name property
@ -151,11 +146,11 @@ class DbPermissionTest extends CakeTestModel {
var $belongsTo = array('DbAroTest' => array('foreignKey' => 'aro_id'), 'DbAcoTest' => array('foreignKey' => 'aco_id'));
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* DboActionTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbAcoActionTest extends CakeTestModel {
/**
* name property
@ -180,11 +175,11 @@ class DbAcoActionTest extends CakeTestModel {
var $belongsTo = array('DbAcoTest' => array('foreignKey' => 'aco_id'));
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* DbAroUserTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbAroUserTest extends CakeTestModel {
/**
* name property
@ -215,13 +210,12 @@ class DbAroUserTest extends CakeTestModel {
}
}
}
/**
* Short description for class.
*
* @package cake.tests
* @subpackage cake.tests.cases.libs.controller.components
*/
* DbAclTest class
*
* @package cake
* @subpackage cake.tests.cases.libs.controller.components
*/
class DbAclTest extends DbAcl {
/**
* construct method
@ -237,9 +231,9 @@ class DbAclTest extends DbAcl {
}
}
/**
* Short description for class.
* AclNodeTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.controller.components.dbacl.models
*/
class AclNodeTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ModelTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -24,14 +24,12 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', array('AppModel', 'Model'));
require_once dirname(__FILE__) . DS . 'models.php';
/**
* Short description for class.
* ModelTest
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModelTest extends CakeTestCase {
@ -90,6 +88,15 @@ class ModelTest extends CakeTestCase {
parent::end();
Configure::write('debug', $this->debug);
}
/**
* endTest method
*
* @access public
* @return void
*/
function endTest() {
ClassRegistry::flush();
}
/**
* testAutoConstructAssociations method
*
@ -956,7 +963,6 @@ class ModelTest extends CakeTestCase {
$result = $Article->read(null, 2);
$this->assertEqual($result['Article']['title'], 'Staying alive');
}
/**
* testCreationOfEmptyRecord method
*
@ -2999,16 +3005,16 @@ class ModelTest extends CakeTestCase {
)
);
$this->assertEqual($result, $expected);
$this->loadFixtures('JoinA', 'JoinC', 'JoinAC', 'JoinB', 'JoinAB');
$TestModel = new JoinA();
$TestModel->hasBelongsToMany['JoinC']['unique'] = true;
$data = array(
'JoinA' => array(
'id' => 1,
'name' => 'Join A 1',
'body' => 'Join A 1 Body',
'name' => 'Join A 1',
'body' => 'Join A 1 Body',
),
'JoinC' => array(
'JoinC' => array(
@ -3182,7 +3188,6 @@ class ModelTest extends CakeTestCase {
Configure::write('Cache.check', $_back['check']);
Configure::write('Cache.disable', $_back['disable']);
}
/**
* testSaveAll method
*
@ -3248,12 +3253,12 @@ class ModelTest extends CakeTestCase {
$expected = array('id' => '2', 'comment_id' => '7', 'attachment' => 'some_file.tgz', 'created' => $ts, 'updated' => $ts);
$this->assertEqual($result[6]['Attachment'], $expected);
}
/**
* Test SaveAll with Habtm relations
*
* @access public
* @return void
**/
*/
function testSaveAllHabtm() {
$this->loadFixtures('Article', 'Tag', 'Comment', 'User');
$data = array(
@ -3279,10 +3284,15 @@ class ModelTest extends CakeTestCase {
$this->assertEqual(count($result['Comment']), 1);
$this->assertEqual(count($result['Comment'][0]['comment']['Article comment']), 1);
}
/**
* Test SaveAll with Habtm relations and extra join table fields
*
* @access public
* @return void
*/
function testSaveAllHabtmWithExtraJoinTableFields() {
$this->loadFixtures('Something', 'SomethingElse', 'JoinThing');
$data = array(
'Something' => array(
'id' => 4,
@ -3301,18 +3311,18 @@ class ModelTest extends CakeTestCase {
$result = $Something->saveAll($data);
$this->assertTrue($result);
$result = $Something->read();
$this->assertEqual(count($result['SomethingElse']), 3);
$this->assertTrue(Set::matches('/Something[id=4]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=1]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=1]/JoinThing[something_else_id=1]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=1]/JoinThing[doomed=1]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=2]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=2]/JoinThing[something_else_id=2]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=2]/JoinThing[doomed=0]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=3]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=3]/JoinThing[something_else_id=3]', $result));
$this->assertTrue(Set::matches('/SomethingElse[id=3]/JoinThing[doomed=1]', $result));
@ -3753,7 +3763,6 @@ class ModelTest extends CakeTestCase {
);
$this->assertEqual($TestModel->validationErrors, $expected);
}
/**
* testSaveAllValidateFirst method
*
@ -3800,8 +3809,8 @@ class ModelTest extends CakeTestCase {
$model->deleteAll(true);
$data = array(
'Article' => array(
'title' => 'Post with Author saveAlled from comment',
'body' => 'This post will be saved with an author',
'title' => 'Post with Author saveAlled from comment',
'body' => 'This post will be saved with an author',
'user_id' => 2
),
'Comment' => array(
@ -3810,7 +3819,7 @@ class ModelTest extends CakeTestCase {
);
$result = $model->Comment->saveAll($data, array('validate' => 'first'));
$this->assertTrue($result);
$result = $model->find('all');
$this->assertEqual($result[0]['Article']['title'], 'Post with Author saveAlled from comment');
$this->assertEqual($result[0]['Comment'][0]['comment'], 'Only new comment');
@ -3929,7 +3938,6 @@ class ModelTest extends CakeTestCase {
$expected = array_fill(0, 1, 1);
$this->assertEqual($result, $expected);
}
/**
* testSaveWithCounterCacheScope method
*
@ -4786,7 +4794,6 @@ class ModelTest extends CakeTestCase {
$expected = $TestModel->save($data);
$this->assertFalse($expected);
}
// function testBasicValidation() {
// $TestModel =& new ValidationTest();
// $TestModel->testing = true;
@ -4983,6 +4990,13 @@ class ModelTest extends CakeTestCase {
$TestModel->invalidFields(array('fieldList' => array('name', 'title')));
$expected = array('name' => 'This field cannot be left blank', 'title' => 'This field cannot be left blank');
$this->assertEqual($TestModel->validationErrors, $expected);
$TestModel->validationErrors = array();
$TestModel->whitelist = array('name');
$TestModel->invalidFields();
$expected = array('name' => 'This field cannot be left blank');
$this->assertEqual($TestModel->validationErrors, $expected);
$TestModel->validationErrors = array();
$this->assertEqual($TestModel->validate, $validate);
}
@ -5530,7 +5544,6 @@ class ModelTest extends CakeTestCase {
$this->assertIdentical($result['DataTest']['count'], '0');
$this->assertIdentical($result['DataTest']['float'], '0');
}
/**
* testNonNumericHabtmJoinKey method
*
@ -5820,7 +5833,6 @@ class ModelTest extends CakeTestCase {
$this->assertEqual($db2->fullTableName($TestModel, false), 'apples');
$this->assertEqual($db1->fullTableName($TestModel, false), 'apples');
}
/**
* testDynamicBehaviorAttachment method
*
@ -5851,7 +5863,6 @@ class ModelTest extends CakeTestCase {
$this->assertEqual($TestModel->Behaviors->attached(), array());
$this->assertFalse(isset($TestModel->Behaviors->Tree));
}
/**
* Tests cross database joins. Requires $test and $test2 to both be set in DATABASE_CONFIG
* NOTE: When testing on MySQL, you must set 'persistent' => false on *both* database connections,
@ -6470,7 +6481,12 @@ class ModelTest extends CakeTestCase {
$result = $Portfolio->ItemsPortfolio->find('all', array('conditions' => array('ItemsPortfolio.portfolio_id' => 1)));
$this->assertFalse($result);
}
/**
* testDeleteArticleBLinks method
*
* @access public
* @return void
*/
function testDeleteArticleBLinks() {
$this->loadFixtures('Article', 'ArticlesTag', 'Tag');
$TestModel =& new ArticleB();
@ -6493,21 +6509,16 @@ class ModelTest extends CakeTestCase {
);
$this->assertEqual($result, $expected);
}
/**
* testPkInHAbtmLinkModelArticleB
*
* @access public
* @return void
*/
function testPkInHabtmLinkModelArticleB() {
$this->loadFixtures('Article', 'Tag');
$TestModel2 =& new ArticleB();
$this->assertEqual($TestModel2->ArticlesTag->primaryKey, 'article_id');
}
/**
* endTest method
*
* @access public
* @return void
*/
function endTest() {
ClassRegistry::flush();
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Mock models
* Mock models file
*
* Mock classes for use in Model and related test cases
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
* @since CakePHP(tm) v 1.2.0.6464
* @version $Revision$
@ -27,11 +27,10 @@
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
/**
* Test class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Test extends CakeTestModel {
@ -67,7 +66,7 @@ class Test extends CakeTestModel {
/**
* TestAlias class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TestAlias extends CakeTestModel {
@ -110,7 +109,7 @@ class TestAlias extends CakeTestModel {
/**
* TestValidate class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TestValidate extends CakeTestModel {
@ -169,7 +168,7 @@ class TestValidate extends CakeTestModel {
/**
* User class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class User extends CakeTestModel {
@ -191,7 +190,7 @@ class User extends CakeTestModel {
/**
* Article class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Article extends CakeTestModel {
@ -263,7 +262,7 @@ class Article extends CakeTestModel {
/**
* NumericArticle class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class NumericArticle extends CakeTestModel {
@ -285,7 +284,7 @@ class NumericArticle extends CakeTestModel {
/**
* Article10 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Article10 extends CakeTestModel {
@ -314,7 +313,7 @@ class Article10 extends CakeTestModel {
/**
* ArticleFeatured class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ArticleFeatured extends CakeTestModel {
@ -364,7 +363,7 @@ class ArticleFeatured extends CakeTestModel {
/**
* Featured class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Featured extends CakeTestModel {
@ -386,7 +385,7 @@ class Featured extends CakeTestModel {
/**
* Tag class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Tag extends CakeTestModel {
@ -401,7 +400,7 @@ class Tag extends CakeTestModel {
/**
* ArticlesTag class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ArticlesTag extends CakeTestModel {
@ -416,7 +415,7 @@ class ArticlesTag extends CakeTestModel {
/**
* ArticleFeaturedsTag class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ArticleFeaturedsTag extends CakeTestModel {
@ -431,7 +430,7 @@ class ArticleFeaturedsTag extends CakeTestModel {
/**
* Comment class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Comment extends CakeTestModel {
@ -460,7 +459,7 @@ class Comment extends CakeTestModel {
/**
* Modified Comment Class has afterFind Callback
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModifiedComment extends CakeTestModel {
@ -501,7 +500,7 @@ class ModifiedComment extends CakeTestModel {
/**
* MergeVarPluginAppModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MergeVarPluginAppModel extends AppModel {
@ -517,7 +516,7 @@ class MergeVarPluginAppModel extends AppModel {
/**
* MergeVarPluginPost class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MergeVarPluginPost extends MergeVarPluginAppModel {
@ -539,7 +538,7 @@ class MergeVarPluginPost extends MergeVarPluginAppModel {
/**
* MergeVarPluginComment class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MergeVarPluginComment extends MergeVarPluginAppModel {
@ -563,7 +562,7 @@ class MergeVarPluginComment extends MergeVarPluginAppModel {
/**
* Attachment class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Attachment extends CakeTestModel {
@ -578,7 +577,7 @@ class Attachment extends CakeTestModel {
/**
* Category class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Category extends CakeTestModel {
@ -593,7 +592,7 @@ class Category extends CakeTestModel {
/**
* CategoryThread class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class CategoryThread extends CakeTestModel {
@ -615,7 +614,7 @@ class CategoryThread extends CakeTestModel {
/**
* Apple class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Apple extends CakeTestModel {
@ -658,7 +657,7 @@ class Apple extends CakeTestModel {
/**
* Sample class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Sample extends CakeTestModel {
@ -680,7 +679,7 @@ class Sample extends CakeTestModel {
/**
* AnotherArticle class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class AnotherArticle extends CakeTestModel {
@ -702,7 +701,7 @@ class AnotherArticle extends CakeTestModel {
/**
* Advertisement class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Advertisement extends CakeTestModel {
@ -724,7 +723,7 @@ class Advertisement extends CakeTestModel {
/**
* Home class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Home extends CakeTestModel {
@ -746,7 +745,7 @@ class Home extends CakeTestModel {
/**
* Post class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Post extends CakeTestModel {
@ -768,7 +767,7 @@ class Post extends CakeTestModel {
/**
* Author class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Author extends CakeTestModel {
@ -801,7 +800,7 @@ class Author extends CakeTestModel {
/**
* ModifiedAuthor class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModifiedAuthor extends Author {
@ -829,7 +828,7 @@ class ModifiedAuthor extends Author {
/**
* Project class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Project extends CakeTestModel {
@ -851,7 +850,7 @@ class Project extends CakeTestModel {
/**
* Thread class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Thread extends CakeTestModel {
@ -880,7 +879,7 @@ class Thread extends CakeTestModel {
/**
* Message class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Message extends CakeTestModel {
@ -902,7 +901,7 @@ class Message extends CakeTestModel {
/**
* Bid class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Bid extends CakeTestModel {
@ -924,7 +923,7 @@ class Bid extends CakeTestModel {
/**
* NodeAfterFind class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class NodeAfterFind extends CakeTestModel {
@ -984,7 +983,7 @@ class NodeAfterFind extends CakeTestModel {
/**
* NodeAfterFindSample class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class NodeAfterFindSample extends CakeTestModel {
@ -1013,7 +1012,7 @@ class NodeAfterFindSample extends CakeTestModel {
/**
* NodeNoAfterFind class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class NodeNoAfterFind extends CakeTestModel {
@ -1063,7 +1062,7 @@ class NodeNoAfterFind extends CakeTestModel {
/**
* Node class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Node extends CakeTestModel{
@ -1093,7 +1092,7 @@ class Node extends CakeTestModel{
/**
* Dependency class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Dependency extends CakeTestModel {
@ -1108,7 +1107,7 @@ class Dependency extends CakeTestModel {
/**
* ModelA class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModelA extends CakeTestModel {
@ -1137,7 +1136,7 @@ class ModelA extends CakeTestModel {
/**
* ModelB class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModelB extends CakeTestModel {
@ -1166,7 +1165,7 @@ class ModelB extends CakeTestModel {
/**
* ModelC class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModelC extends CakeTestModel {
@ -1195,7 +1194,7 @@ class ModelC extends CakeTestModel {
/**
* ModelD class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ModelD extends CakeTestModel {
@ -1217,7 +1216,7 @@ class ModelD extends CakeTestModel {
/**
* Something class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Something extends CakeTestModel {
@ -1239,7 +1238,7 @@ class Something extends CakeTestModel {
/**
* SomethingElse class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class SomethingElse extends CakeTestModel {
@ -1261,7 +1260,7 @@ class SomethingElse extends CakeTestModel {
/**
* JoinThing class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class JoinThing extends CakeTestModel {
@ -1283,7 +1282,7 @@ class JoinThing extends CakeTestModel {
/**
* Portfolio class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Portfolio extends CakeTestModel {
@ -1305,7 +1304,7 @@ class Portfolio extends CakeTestModel {
/**
* Item class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Item extends CakeTestModel {
@ -1334,7 +1333,7 @@ class Item extends CakeTestModel {
/**
* ItemsPortfolio class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ItemsPortfolio extends CakeTestModel {
@ -1349,7 +1348,7 @@ class ItemsPortfolio extends CakeTestModel {
/**
* Syfile class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Syfile extends CakeTestModel {
@ -1371,7 +1370,7 @@ class Syfile extends CakeTestModel {
/**
* Image class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Image extends CakeTestModel {
@ -1386,7 +1385,7 @@ class Image extends CakeTestModel {
/**
* DeviceType class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class DeviceType extends CakeTestModel {
@ -1426,7 +1425,7 @@ class DeviceType extends CakeTestModel {
/**
* DeviceTypeCategory class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class DeviceTypeCategory extends CakeTestModel {
@ -1441,7 +1440,7 @@ class DeviceTypeCategory extends CakeTestModel {
/**
* FeatureSet class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class FeatureSet extends CakeTestModel {
@ -1456,7 +1455,7 @@ class FeatureSet extends CakeTestModel {
/**
* ExteriorTypeCategory class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ExteriorTypeCategory extends CakeTestModel {
@ -1478,7 +1477,7 @@ class ExteriorTypeCategory extends CakeTestModel {
/**
* Document class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Document extends CakeTestModel {
@ -1500,7 +1499,7 @@ class Document extends CakeTestModel {
/**
* Device class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Device extends CakeTestModel {
@ -1515,7 +1514,7 @@ class Device extends CakeTestModel {
/**
* DocumentDirectory class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class DocumentDirectory extends CakeTestModel {
@ -1530,7 +1529,7 @@ class DocumentDirectory extends CakeTestModel {
/**
* PrimaryModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class PrimaryModel extends CakeTestModel {
@ -1545,7 +1544,7 @@ class PrimaryModel extends CakeTestModel {
/**
* SecondaryModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class SecondaryModel extends CakeTestModel {
@ -1560,7 +1559,7 @@ class SecondaryModel extends CakeTestModel {
/**
* JoinA class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class JoinA extends CakeTestModel {
@ -1582,7 +1581,7 @@ class JoinA extends CakeTestModel {
/**
* JoinB class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class JoinB extends CakeTestModel {
@ -1604,7 +1603,7 @@ class JoinB extends CakeTestModel {
/**
* JoinC class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class JoinC extends CakeTestModel {
@ -1626,7 +1625,7 @@ class JoinC extends CakeTestModel {
/**
* ThePaper class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ThePaper extends CakeTestModel {
@ -1662,7 +1661,7 @@ class ThePaper extends CakeTestModel {
/**
* Monkey class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Monkey extends CakeTestModel {
@ -1684,7 +1683,7 @@ class Monkey extends CakeTestModel {
/**
* AssociationTest1 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class AssociationTest1 extends CakeTestModel {
@ -1715,7 +1714,7 @@ class AssociationTest1 extends CakeTestModel {
/**
* AssociationTest2 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class AssociationTest2 extends CakeTestModel {
@ -1746,7 +1745,7 @@ class AssociationTest2 extends CakeTestModel {
/**
* Callback class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Callback extends CakeTestModel {
@ -1755,7 +1754,7 @@ class Callback extends CakeTestModel {
/**
* Uuid class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Uuid extends CakeTestModel {
@ -1770,7 +1769,7 @@ class Uuid extends CakeTestModel {
/**
* DataTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class DataTest extends CakeTestModel {
@ -1785,7 +1784,7 @@ class DataTest extends CakeTestModel {
/**
* TheVoid class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TheVoid extends CakeTestModel {
@ -1807,7 +1806,7 @@ class TheVoid extends CakeTestModel {
/**
* ValidationTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ValidationTest extends CakeTestModel {
@ -1880,7 +1879,7 @@ class ValidationTest extends CakeTestModel {
/**
* ValidationTest2 class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ValidationTest2 extends CakeTestModel {
@ -1936,7 +1935,7 @@ class ValidationTest2 extends CakeTestModel {
/**
* Person class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Person extends CakeTestModel {
@ -1964,7 +1963,7 @@ class Person extends CakeTestModel {
/**
* UnderscoreField class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class UnderscoreField extends CakeTestModel {
@ -1979,7 +1978,7 @@ class UnderscoreField extends CakeTestModel {
/**
* Product class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Product extends CakeTestModel {
@ -1994,7 +1993,7 @@ class Product extends CakeTestModel {
/**
* Story class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Story extends CakeTestModel {
@ -2030,7 +2029,7 @@ class Story extends CakeTestModel {
/**
* Cd class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Cd extends CakeTestModel {
@ -2052,7 +2051,7 @@ class Cd extends CakeTestModel {
/**
* Book class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Book extends CakeTestModel {
@ -2074,7 +2073,7 @@ class Book extends CakeTestModel {
/**
* OverallFavorite class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class OverallFavorite extends CakeTestModel {
@ -2089,7 +2088,7 @@ class OverallFavorite extends CakeTestModel {
/**
* MyUser class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MyUser extends CakeTestModel {
@ -2111,7 +2110,7 @@ class MyUser extends CakeTestModel {
/**
* MyCategory class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MyCategory extends CakeTestModel {
@ -2133,7 +2132,7 @@ class MyCategory extends CakeTestModel {
/**
* MyProduct class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MyProduct extends CakeTestModel {
@ -2155,7 +2154,7 @@ class MyProduct extends CakeTestModel {
/**
* MyCategoriesMyUser class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MyCategoriesMyUser extends CakeTestModel {
@ -2170,7 +2169,7 @@ class MyCategoriesMyUser extends CakeTestModel {
/**
* MyCategoriesMyProduct class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class MyCategoriesMyProduct extends CakeTestModel {
@ -2185,7 +2184,7 @@ class MyCategoriesMyProduct extends CakeTestModel {
/**
* I18nModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class I18nModel extends CakeTestModel {
@ -2214,7 +2213,7 @@ class I18nModel extends CakeTestModel {
/**
* NumberTree class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class NumberTree extends CakeTestModel {
@ -2277,7 +2276,7 @@ class NumberTree extends CakeTestModel {
/**
* FlagTree class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class FlagTree extends NumberTree {
@ -2292,7 +2291,7 @@ class FlagTree extends NumberTree {
/**
* UnconventionalTree class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class UnconventionalTree extends NumberTree {
@ -2314,7 +2313,7 @@ class UnconventionalTree extends NumberTree {
/**
* UuidTree class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class UuidTree extends NumberTree {
@ -2330,7 +2329,7 @@ class UuidTree extends NumberTree {
/**
* Campaign class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Campaign extends CakeTestModel {
@ -2352,7 +2351,7 @@ class Campaign extends CakeTestModel {
/**
* Ad class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Ad extends CakeTestModel {
@ -2381,7 +2380,7 @@ class Ad extends CakeTestModel {
/**
* AfterTree class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class AfterTree extends NumberTree {
@ -2409,7 +2408,7 @@ class AfterTree extends NumberTree {
/**
* Nonconformant Content class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Content extends CakeTestModel {
@ -2445,7 +2444,7 @@ class Content extends CakeTestModel {
/**
* Nonconformant Account class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Account extends CakeTestModel {
@ -2474,7 +2473,7 @@ class Account extends CakeTestModel {
/**
* Nonconformant ContentAccount class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class ContentAccount extends CakeTestModel {
@ -2503,7 +2502,7 @@ class ContentAccount extends CakeTestModel {
/**
* FilmFile class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class FilmFile extends CakeTestModel {
@ -2512,7 +2511,7 @@ class FilmFile extends CakeTestModel {
/**
* Basket test model
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Basket extends CakeTestModel {
@ -2531,7 +2530,7 @@ class Basket extends CakeTestModel {
/**
* TestPluginArticle class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TestPluginArticle extends CakeTestModel {
@ -2566,7 +2565,7 @@ class TestPluginArticle extends CakeTestModel {
/**
* TestPluginComment class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TestPluginComment extends CakeTestModel {
@ -2594,7 +2593,7 @@ class TestPluginComment extends CakeTestModel {
/**
* Uuidportfolio class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Uuidportfolio extends CakeTestModel {
@ -2616,7 +2615,7 @@ class Uuidportfolio extends CakeTestModel {
/**
* Uuiditem class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class Uuiditem extends CakeTestModel {
@ -2641,7 +2640,7 @@ class Uuiditem extends CakeTestModel {
/**
* UuiditemsPortfolio class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class UuiditemsUuidportfolio extends CakeTestModel {
@ -2656,7 +2655,7 @@ class UuiditemsUuidportfolio extends CakeTestModel {
/**
* UuiditemsPortfolioNumericid class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class UuiditemsUuidportfolioNumericid extends CakeTestModel {
@ -2671,7 +2670,7 @@ class UuiditemsUuidportfolioNumericid extends CakeTestModel {
/**
* TranslateTestModel class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TranslateTestModel extends CakeTestModel {
@ -2700,7 +2699,7 @@ class TranslateTestModel extends CakeTestModel {
/**
* TranslatedItem class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TranslatedItem extends CakeTestModel {
@ -2736,7 +2735,7 @@ class TranslatedItem extends CakeTestModel {
/**
* TranslatedItemWithTable class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TranslatedItemWithTable extends CakeTestModel {
@ -2786,7 +2785,7 @@ class TranslatedItemWithTable extends CakeTestModel {
/**
* TranslateArticleModel class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TranslateArticleModel extends CakeTestModel {
@ -2815,7 +2814,7 @@ class TranslateArticleModel extends CakeTestModel {
/**
* TranslatedArticle class.
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TranslatedArticle extends CakeTestModel {

View file

@ -15,7 +15,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5550
* @version $Revision$
@ -24,11 +24,10 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'Schema');
/**
* Test for Schema database management
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class MyAppSchema extends CakeSchema {
@ -102,7 +101,7 @@ class MyAppSchema extends CakeSchema {
/**
* TestAppSchema class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class TestAppSchema extends CakeSchema {
@ -200,9 +199,9 @@ class TestAppSchema extends CakeSchema {
}
}
/**
* Short description for class.
* SchmeaPost class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class SchemaPost extends CakeTestModel {
@ -234,12 +233,11 @@ class SchemaPost extends CakeTestModel {
* @access public
*/
var $hasAndBelongsToMany = array('SchemaTag');
}
/**
* Short description for class.
* SchemaComment class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class SchemaComment extends CakeTestModel {
@ -266,9 +264,9 @@ class SchemaComment extends CakeTestModel {
var $belongsTo = array('SchemaPost');
}
/**
* Short description for class.
* SchemaTag class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class SchemaTag extends CakeTestModel {
@ -295,9 +293,9 @@ class SchemaTag extends CakeTestModel {
var $hasAndBelongsToMany = array('SchemaPost');
}
/**
* Short description for class.
* SchemaDatatype class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.model
*/
class SchemaDatatype extends CakeTestModel {
@ -319,8 +317,9 @@ class SchemaDatatype extends CakeTestModel {
/**
* Testdescribe class
*
* This class is defined purely to inherit the cacheSources variable otherwise testSchemaCreatTable will fail if
* listSources has already been called and its source cache populated - I.e. if the test is run within a group
* This class is defined purely to inherit the cacheSources variable otherwise
* testSchemaCreatTable will fail if listSources has already been called and
* its source cache populated - I.e. if the test is run within a group
*
* @uses CakeTestModel
* @package
@ -336,9 +335,9 @@ class Testdescribe extends CakeTestModel {
var $name = 'Testdescribe';
}
/**
* Short description for class.
* CakeSchemaTest
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class CakeSchemaTest extends CakeTestCase {
@ -358,6 +357,15 @@ class CakeSchemaTest extends CakeTestCase {
function startTest() {
$this->Schema = new TestAppSchema();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Schema);
}
/**
* testSchemaName method
*
@ -471,7 +479,7 @@ class CakeSchemaTest extends CakeTestCase {
function testSchemaCreateTable() {
$db =& ConnectionManager::getDataSource('test_suite');
$db->cacheSources = false;
$Schema =& new CakeSchema(array(
'connection' => 'test_suite',
'testdescribes' => array(
@ -481,25 +489,16 @@ class CakeSchemaTest extends CakeTestCase {
),
));
$sql = $db->createSchema($Schema);
$col = $Schema->tables['testdescribes']['int_null'];
$col['name'] = 'int_null';
$column = $this->db->buildColumn($col);
$this->assertPattern('/' . preg_quote($column, '/') . '/', $sql);
$col = $Schema->tables['testdescribes']['int_not_null'];
$col['name'] = 'int_not_null';
$column = $this->db->buildColumn($col);
$this->assertPattern('/' . preg_quote($column, '/') . '/', $sql);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Schema);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* MultibyteTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.6833
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'Multibyte');
/**
* Short description for class.
* MultibyteTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class MultibyteTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* ObjectTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -117,6 +117,37 @@ class RequestActionController extends Controller {
return $this->params;
}
}
/**
* RequestActionPersistentController class
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RequestActionPersistentController extends Controller {
/**
* uses property
*
* @var array
* @access public
*/
var $uses = array('PersisterOne');
/**
* persistModel property
*
* @var array
* @access public
*/
var $persistModel = true;
/**
* post pass, testing post passing
*
* @return array
**/
function index() {
return 'This is a test';
}
}
/**
* TestObject class
*
@ -240,7 +271,6 @@ class TestObject extends Object {
function methodWithOptionalParam($param = null) {
$this->methodCalls[] = array('methodWithOptionalParam' => array($param));
}
/**
* testPersist
*
@ -250,24 +280,20 @@ class TestObject extends Object {
return $this->_persist($name, $return, $object, $type);
}
}
/**
* ObjectTestModel
* ObjectTestModel class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ObjectTestModel extends CakeTestModel {
var $useTable = false;
var $name = 'ObjectTestModel';
}
/**
* Object Test Class
* Object Test class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ObjectTest extends CakeTestCase {
@ -276,7 +302,7 @@ class ObjectTest extends CakeTestCase {
*
* @var string
**/
var $fixtures = array('core.post');
var $fixtures = array('core.post', 'core.comment');
/**
* setUp method
*
@ -286,6 +312,15 @@ class ObjectTest extends CakeTestCase {
function setUp() {
$this->object = new TestObject();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->object);
}
/**
* testLog method
*
@ -378,6 +413,104 @@ class ObjectTest extends CakeTestCase {
Configure::write('Cache.disable', $cacheDisable);
}
/**
* testPersistWithRequestAction method
*
* @access public
* @return void
*/
function testPersistWithBehavior() {
ClassRegistry::flush();
$cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
Configure::write('modelPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models'. DS));
Configure::write('behaviorPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models'. DS . 'behaviors' . DS));
$this->assertFalse(class_exists('PersisterOneBehaviorBehavior'));
$this->assertFalse(class_exists('PersisterTwoBehaviorBehavior'));
$Controller = new RequestActionPersistentController();
$Controller->persistModel = true;
$Controller->constructClasses();
$this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisterone.php'));
$this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisteroneregistry.php'));
$contents = str_replace('"PersisterOne"', '"PersisterTwo"', file_get_contents(CACHE . 'persistent' . DS . 'persisteroneregistry.php'));
$contents = str_replace('persister_one_', 'persister_two_', file_get_contents(CACHE . 'persistent' . DS . 'persisteroneregistry.php'));
$result = file_put_contents(CACHE . 'persistent' . DS . 'persisteroneregistry.php', $contents);
$this->assertTrue(class_exists('PersisterOneBehaviorBehavior'));
$this->assertFalse(class_exists('PersisterTwoBehaviorBehavior'));
$Controller = new RequestActionPersistentController();
$Controller->persistModel = true;
$Controller->constructClasses();
$this->assertTrue(class_exists('PersisterOneBehaviorBehavior'));
$this->assertTrue(class_exists('PersisterTwoBehaviorBehavior'));
@unlink(CACHE . 'persistent' . DS . 'persisterone.php');
@unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
}
/**
* testPersistWithBehaviorAndRequestAction method
*
* @see testPersistWithBehavior
* @access public
* @return void
*/
function testPersistWithBehaviorAndRequestAction() {
ClassRegistry::flush();
$cacheDisable = Configure::read('Cache.disable');
Configure::write('Cache.disable', false);
$this->assertFalse(class_exists('ContainableBehavior'));
Configure::write('modelPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models'. DS));
Configure::write('behaviorPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models'. DS . 'behaviors' . DS));
$this->assertFalse(class_exists('PersistOneBehaviorBehavior'));
$this->assertFalse(class_exists('PersistTwoBehaviorBehavior'));
$Controller = new RequestActionPersistentController();
$Controller->persistModel = true;
$Controller->constructClasses();
$this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisterone.php'));
$this->assertTrue(file_exists(CACHE . 'persistent' . DS . 'persisteroneregistry.php'));
$keys = ClassRegistry::keys();
$this->assertEqual($keys, array('persister_one', 'comment', 'persister_one_behavior_behavior'));
ob_start();
$Controller->set('content_for_layout', 'cool');
$Controller->render('index', 'ajax', '/layouts/ajax');
$result = ob_get_clean();
$keys = ClassRegistry::keys();
$this->assertEqual($keys, array('persister_one', 'comment', 'persister_one_behavior_behavior', 'view'));
$result = $this->object->requestAction('/request_action_persistent/index');
$expected = 'This is a test';
$this->assertEqual($result, $expected);
@unlink(CACHE . 'persistent' . DS . 'persisterone.php');
@unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
$Controller = new RequestActionPersistentController();
$Controller->persistModel = true;
$Controller->constructClasses();
@unlink(CACHE . 'persistent' . DS . 'persisterone.php');
@unlink(CACHE . 'persistent' . DS . 'persisteroneregistry.php');
Configure::write('Cache.disable', $cacheDisable);
}
/**
* testToString method
*
* @access public
@ -593,7 +726,6 @@ class ObjectTest extends CakeTestCase {
$_POST = $_tmp;
}
/**
* testCakeError
*
@ -602,14 +734,5 @@ class ObjectTest extends CakeTestCase {
function testCakeError() {
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->object);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* OverloadableTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'Overloadable');
/**
* Short description for class.
* OverloadableTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class OverloadableTest extends CakeTestCase {
@ -39,7 +39,7 @@ class OverloadableTest extends CakeTestCase {
* @return void
*/
function skip() {
$this->skipif (true, 'OverloadableTest not implemented');
$this->skipif(true, 'OverloadableTest not implemented');
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* RouterTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -29,11 +29,10 @@ App::import('Core', array('Router', 'Debugger'));
if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', 'http://cakephp.org');
}
/**
* Short description for class.
* RouterTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class RouterTest extends CakeTestCase {
@ -1494,7 +1493,6 @@ class RouterTest extends CakeTestCase {
$expected = array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'index');
$this->assertEqual($result, $expected);
}
/**
* Tests URL generation with flags and prefixes in and out of context
*

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SanitizeTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5428
* @version $Revision$
@ -70,9 +70,9 @@ class SanitizeArticle extends CakeTestModel {
var $useTable = 'articles';
}
/**
* Short description for class.
* SanitizeTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SanitizeTest extends CakeTestCase {
@ -445,5 +445,4 @@ class SanitizeTest extends CakeTestCase {
$this->assertEqual($result, $expected);
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SecurityTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'Security');
/**
* Short description for class.
* SecurityTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SecurityTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SessionTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -28,9 +28,9 @@ if (!class_exists('CakeSession')) {
App::import('Core', 'Session');
}
/**
* Short description for class.
* SessionTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SessionTest extends CakeTestCase {
@ -369,6 +369,11 @@ class SessionTest extends CakeTestCase {
$this->Session->destroy();
$this->assertFalse($this->Session->read('SessionTestCase'));
session_write_close();
unset($_SESSION);
ini_set('session.save_handler', 'files');
Configure::write('Session.save', 'php');
$this->setUp();
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SetTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -25,11 +25,10 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'Set');
/**
* UnitTestCase for the Set class
* SetTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SetTest extends CakeTestCase {
@ -1052,15 +1051,17 @@ class SetTest extends CakeTestCase {
*/
function testSetExtractReturnsEmptyArray() {
$this->assertEqual(Set::extract(array(), '/Post/id'), array());
$this->assertIdentical(Set::extract(array(), '/Post/id'), array());
$this->assertEqual(Set::extract('/Post/id', array()), array());
$this->assertIdentical(Set::extract('/Post/id', array()), array());
$this->assertEqual(Set::extract('/Post/id', array(
$this->assertIdentical(Set::extract('/Post/id', array(
array('Post' => array('name' => 'bob')),
array('Post' => array('name' => 'jim'))
)), array());
$this->assertIdentical(Set::extract(array(), 'Message.flash'), null);
}
/**
* testClassicExtract method
@ -2573,7 +2574,6 @@ class SetTest extends CakeTestCase {
$set = array('a' => 'hi');
$this->assertFalse(Set::check($set, 'a.b'));
}
/**
* Tests Set::flatten
*
@ -2610,5 +2610,4 @@ class SetTest extends CakeTestCase {
$this->assertEqual($result, $expected);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SocketTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'Socket');
/**
* Short description for class.
* SocketTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class SocketTest extends CakeTestCase {
@ -41,6 +41,15 @@ class SocketTest extends CakeTestCase {
function setUp() {
$this->Socket = new CakeSocket();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Socket);
}
/**
* testConstruct method
*
@ -165,14 +174,5 @@ class SocketTest extends CakeTestCase {
$anotherSocket->reset();
$this->assertEqual(array(), $anotherSocket->config);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Socket);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* StringTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.5432
* @version $Revision$
@ -26,9 +26,9 @@
*/
App::import('Core', 'String');
/**
* Short description for class.
* StringTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class StringTest extends CakeTestCase {

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* TestManagerTest file
*
* Long description for file
*
@ -16,20 +16,26 @@
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
App::import('Core', 'TestManager');
/**
* TestManagerTest class
*
* @package cake
* @subpackage cake.tests.cases.libs
*/
class TestManagerTest extends CakeTestCase {
/**
* undocumented function
* setUp method
*
* @return void
* @access public
@ -39,7 +45,7 @@ class TestManagerTest extends CakeTestCase {
$this->Reporter =& new CakeHtmlReporter();
}
/**
* undocumented function
* testRunAllTests method
*
* @return void
* @access public
@ -55,7 +61,7 @@ class TestManagerTest extends CakeTestCase {
$this->assertEqual(count($out), count($list));
}
/**
* undocumented function
* testRunTestCase method
*
* @return void
* @access public
@ -71,49 +77,44 @@ class TestManagerTest extends CakeTestCase {
$this->assertTrue($result);
}
/**
* undocumented function
* testRunGroupTest method
*
* @return void
* @access public
*/
function testRunGroupTest() {
}
/**
* undocumented function
* testAddTestCasesFromDirectory method
*
* @return void
* @access public
*/
function testAddTestCasesFromDirectory() {
}
/**
* undocumented function
* testAddTestFile method
*
* @return void
* @access public
*/
function testAddTestFile() {
}
/**
* undocumented function
* testGetTestCaseList method
*
* @return void
* @access public
*/
function testGetTestCaseList() {
}
/**
* undocumented function
* testGetGroupTestList method
*
* @return void
* @access public
*/
function testGetGroupTestList() {
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Validation Class Test Case
* ValidationTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -43,14 +43,13 @@ class CustomValidator {
return preg_match('/^[0-9]{3}$/', $check);
}
}
/**
* Test Case for Validation Class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class ValidationTestCase extends CakeTestCase {
class ValidationTest extends CakeTestCase {
/**
* Validation property
*
@ -64,7 +63,7 @@ class ValidationTestCase extends CakeTestCase {
* @access public
* @return void
*/
function setup() {
function setUp() {
$this->Validation =& Validation::getInstance();
}
/**
@ -83,7 +82,7 @@ class ValidationTestCase extends CakeTestCase {
$this->assertTrue(Validation::notEmpty('π'));
$this->assertFalse(Validation::notEmpty("\t "));
$this->assertFalse(Validation::notEmpty(""));
}
/**
* testNotEmptyISO88591Encoding method
@ -1514,6 +1513,7 @@ class ValidationTestCase extends CakeTestCase {
$this->assertTrue(Validation::email('abc@g.cn'));
$this->assertTrue(Validation::email('abc@x.com'));
$this->assertTrue(Validation::email('henrik@sbcglobal.net'));
$this->assertTrue(Validation::email('sani@sbcglobal.net'));
// all ICANN TLDs
$this->assertTrue(Validation::email('abc@example.aero'));

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* HelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -65,7 +65,6 @@ class HelperTestPost extends Model {
*/
var $hasAndBelongsToMany = array('HelperTestTag'=> array('with' => 'HelperTestPostsTag'));
}
/**
* HelperTestComment class
*
@ -156,11 +155,10 @@ class HelperTestPostsTag extends Model {
return $this->_schema;
}
}
/**
* Short description for class.
* HelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs
*/
class HelperTest extends CakeTestCase {
@ -180,6 +178,16 @@ class HelperTest extends CakeTestCase {
ClassRegistry::addObject('HelperTestComment', new HelperTestComment());
ClassRegistry::addObject('HelperTestTag', new HelperTestTag());
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Helper, $this->View);
ClassRegistry::flush();
}
/**
* testFormFieldNameParsing method
*
@ -355,22 +363,22 @@ class HelperTest extends CakeTestCase {
function testUrlConversion() {
$result = $this->Helper->url('/controller/action/1');
$this->assertEqual($result, '/controller/action/1');
$result = $this->Helper->url('/controller/action/1?one=1&two=2');
$this->assertEqual($result, '/controller/action/1?one=1&amp;two=2');
$result = $this->Helper->url(array('controller' => 'posts', 'action' => 'index', 'page' => '1" onclick="alert(\'XSS\');"'));
$this->assertEqual($result, "/posts/index/page:1&quot; onclick=&quot;alert(&#039;XSS&#039;);&quot;");
$result = $this->Helper->url('/controller/action/1/param:this+one+more');
$this->assertEqual($result, '/controller/action/1/param:this+one+more');
$result = $this->Helper->url('/controller/action/1/param:this%20one%20more');
$this->assertEqual($result, '/controller/action/1/param:this%20one%20more');
$result = $this->Helper->url('/controller/action/1/param:%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24');
$this->assertEqual($result, '/controller/action/1/param:%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24');
$result = $this->Helper->url(array(
'controller' => 'posts', 'action' => 'index', 'param' => '%7Baround%20here%7D%5Bthings%5D%5Bare%5D%24%24'
));
@ -518,15 +526,5 @@ class HelperTest extends CakeTestCase {
$result = $this->Helper->clean('&lt;script&gt;alert(document.cookie)&lt;/script&gt;');
$this->assertEqual($result, '&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&amp;gt;');
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Helper, $this->View);
ClassRegistry::flush();
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* AjaxHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -27,8 +27,16 @@
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
uses('view'.DS.'helpers'.DS.'app_helper', 'controller'.DS.'controller', 'model'.DS.'model', 'view'.DS.'helper', 'view'.DS.'helpers'.DS.'ajax',
'view'.DS.'helpers'.DS.'html', 'view'.DS.'helpers'.DS.'form', 'view'.DS.'helpers'.DS.'javascript');
uses(
'view' . DS . 'helpers' . DS . 'app_helper',
'controller' . DS . 'controller',
'model' . DS . 'model',
'view' . DS . 'helper',
'view' . DS . 'helpers'.DS.'ajax',
'view' . DS . 'helpers' . DS . 'html',
'view' . DS . 'helpers' . DS . 'form',
'view' . DS . 'helpers' . DS . 'javascript'
);
/**
* AjaxTestController class
*
@ -131,14 +139,13 @@ class TestJavascriptHelper extends JavascriptHelper {
$this->codeBlocks[] = $parameter;
}
}
/**
* Short description for class.
* AjaxTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class AjaxTest extends CakeTestCase {
class AjaxHelperTest extends CakeTestCase {
/**
* Regexp for CDATA start block
*
@ -168,6 +175,16 @@ class AjaxTest extends CakeTestCase {
ClassRegistry::addObject('view', $view);
ClassRegistry::addObject('PostAjaxTest', new PostAjaxTest());
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Ajax);
ClassRegistry::flush();
}
/**
* testEvalScripts method
*
@ -624,7 +641,6 @@ class AjaxTest extends CakeTestCase {
$this->assertPattern('/^<script[^<>]+>\s*' . str_replace('/', '\\/', preg_quote('//<![CDATA[')) . '\s*new Form.Element.EventObserver\(\'field\', function\(element, value\) {.+}\)\s*' . str_replace('/', '\\/', preg_quote('//]]>')) . '\s*<\/script>$/', $result);
$this->assertPattern('/' . str_replace('/', '\\/', preg_quote('new Ajax.Updater(\'divId\',\'http://www.cakephp.org\', {asynchronous:true, evalScripts:true, parameters:Form.Element.serialize(\'otherField\'), requestHeaders:[\'X-Update\', \'divId\']})')) . '/', $result);
}
/**
* testObserveForm method
*
@ -887,15 +903,5 @@ class AjaxTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Ajax);
ClassRegistry::flush();
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* CacheHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -29,26 +29,34 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
}
App::import('Core', array('Controller', 'Model', 'View'));
App::import('Helper', 'Cache');
/**
* Test Cache Helper
* TestCacheHelper class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class TestCacheHelper extends CacheHelper {
}
/**
* Test Cache Helper
* CacheTestController class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class CacheTestController extends Controller {
/**
* helpers property
*
* @var array
* @access public
*/
var $helpers = array('Html', 'Cache');
/**
* cache_parsing method
*
* @access public
* @return void
*/
function cache_parsing() {
$this->viewPath = 'posts';
$this->layout = 'cache_layout';
@ -56,11 +64,10 @@ class CacheTestController extends Controller {
$this->set('superman', 'clark kent');
}
}
/**
* Cache Helper Test Case
* CacheHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class CacheHelperTest extends CakeTestCase {
@ -76,7 +83,6 @@ class CacheHelperTest extends CakeTestCase {
Configure::write('Cache.check', true);
Configure::write('Cache.disable', false);
}
/**
* Start Case - switch view paths
*
@ -87,10 +93,29 @@ class CacheHelperTest extends CakeTestCase {
$this->_viewPaths = Configure::read('viewPaths');
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS));
}
/**
* End Case - restore view Paths
*
* @access public
* @return void
*/
function endCase() {
Configure::write('viewPaths', $this->_viewPaths);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Cache);
}
/**
* test cache parsing with no cake:nocache tags in view file.
*
* @access public
* @return void
*/
function testLayoutCacheParsingNoTagsInView() {
$this->Controller->cache_parsing();
@ -113,10 +138,11 @@ class CacheHelperTest extends CakeTestCase {
@unlink($filename);
}
/**
* Test cache parsing with cake:nocache tags in view file.
*
* @access public
* @return void
*/
function testLayoutCacheParsingWithTagsInView() {
$this->Controller->cache_parsing();
@ -238,23 +264,5 @@ class CacheHelperTest extends CakeTestCase {
@unlink($filename);
}
*/
/**
* End Case - restore view Paths
*
* @access public
* @return void
*/
function endCase() {
Configure::write('viewPaths', $this->_viewPaths);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Cache);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* FormHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -127,6 +127,12 @@ class Contact extends CakeTestModel {
*/
var $hasAndBelongsToMany = array('ContactTag' => array('with' => 'ContactTagsContact'));
}
/**
* ContactTagsContact class
*
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class ContactTagsContact extends CakeTestModel {
/**
* useTable property
@ -164,8 +170,13 @@ class ContactTagsContact extends CakeTestModel {
$this->_schema = $schema;
}
}
Class ContactNonStandardPk extends Contact {
/**
* ContactNonStandardPk class
*
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class ContactNonStandardPk extends Contact {
/**
* primaryKey property
*
@ -567,9 +578,9 @@ class TestMail extends CakeTestModel {
var $name = 'TestMail';
}
/**
* Short description for class.
* FormHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class FormHelperTest extends CakeTestCase {
@ -617,6 +628,25 @@ class FormHelperTest extends CakeTestCase {
Configure::write('Security.salt', 'foo!');
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
ClassRegistry::removeObject('view');
ClassRegistry::removeObject('Contact');
ClassRegistry::removeObject('ContactNonStandardPk');
ClassRegistry::removeObject('ContactTag');
ClassRegistry::removeObject('OpenidUrl');
ClassRegistry::removeObject('UserForm');
ClassRegistry::removeObject('ValidateItem');
ClassRegistry::removeObject('ValidateUser');
ClassRegistry::removeObject('ValidateProfile');
unset($this->Form->Html, $this->Form, $this->Controller, $this->View);
Configure::write('Security.salt', $this->oldSalt);
}
/**
* testFormCreateWithSecurity method
*
@ -723,7 +753,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* Tests correct generation of text fields for double and float fields
*
@ -786,14 +815,13 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* testFormSecurityMultipleSubmitButtons
*
* test form submit generation and ensure that _Token is only created on end()
*
* @return void
**/
*/
function testFormSecurityMultipleSubmitButtons() {
$key = 'testKey';
$this->Form->params['_Token']['key'] = $key;
@ -828,7 +856,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* testFormSecurityMultipleInputFields method
*
@ -962,7 +989,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* testFormSecuredInput method
*
@ -2631,7 +2657,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* testNestedSelect method
*
@ -2694,7 +2719,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* testSelectMultiple method
*
@ -5071,7 +5095,12 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* testBrokenness method
*
* @access public
* @return void
*/
function testBrokenness() {
/*
* #4 This test has two parents and four children. By default (as of r7117) both
@ -5154,25 +5183,5 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
ClassRegistry::removeObject('view');
ClassRegistry::removeObject('Contact');
ClassRegistry::removeObject('ContactNonStandardPk');
ClassRegistry::removeObject('ContactTag');
ClassRegistry::removeObject('OpenidUrl');
ClassRegistry::removeObject('UserForm');
ClassRegistry::removeObject('ValidateItem');
ClassRegistry::removeObject('ValidateUser');
ClassRegistry::removeObject('ValidateProfile');
unset($this->Form->Html, $this->Form, $this->Controller, $this->View);
Configure::write('Security.salt', $this->oldSalt);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* HtmlHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -73,6 +73,15 @@ class HtmlHelperTest extends CakeTestCase {
$view =& new View(new TheHtmlTestController());
ClassRegistry::addObject('view', $view);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Html);
}
/**
* testDocType method
*
@ -242,7 +251,7 @@ 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' => '')));
$back = Configure::read('debug');
Configure::write('debug', 0);
Configure::write('Asset.timestamp', 'force');
@ -878,7 +887,6 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->div('class-name', '<text>', array(), true);
$this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div'));
}
/**
* testPara method
*
@ -895,14 +903,5 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->para('class-name', '<text>', array(), true);
$this->assertTags($result, array('p' => array('class' => 'class-name'), '&lt;text&gt;', '/p'));
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Html);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* JavascriptHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2006-2008, Cake Software Foundation, Inc.
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -88,7 +88,7 @@ class TestJavascriptObject {
var $property2 = 2;
}
/**
* Short description for class.
* JavascriptTest class
*
* @package test_suite
* @subpackage test_suite.cases.libs
@ -653,7 +653,7 @@ class JavascriptTest extends CakeTestCase {
$result = $this->Javascript->escapeString('CakePHP: \'Rapid Development Framework\'');
$expected = 'CakePHP: \\\'Rapid Development Framework\\\'';
$this->assertEqual($result, $expected);
$result = $this->Javascript->escapeString('my \\"string\\"');
$expected = 'my \\\"string\\\"';
$this->assertEqual($result, $expected);
@ -700,5 +700,4 @@ class JavascriptTest extends CakeTestCase {
$this->Javascript->enabled = $old;
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* JsHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -27,16 +27,20 @@
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
uses('view'.DS.'helpers'.DS.'app_helper', 'controller'.DS.'controller', 'model'.DS.'model', 'view'.DS.'helper', 'view'.DS.'helpers'.DS.'js');
uses(
'view' . DS . 'helpers' . DS . 'app_helper',
'controller' . DS . 'controller',
'model' . DS . 'model',
'view' . DS . 'helper',
'view' . DS . 'helpers' . DS . 'js'
);
/**
* Short description for class.
* JsHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class JsTest extends UnitTestCase {
class JsHelperTest extends UnitTestCase {
/**
* skip method
*
@ -65,5 +69,4 @@ class JsTest extends UnitTestCase {
unset($this->Js);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* NumberHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,12 +26,12 @@
*/
App::import('Helper', 'Number');
/**
* Short description for class.
* NumberHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class NumberTest extends CakeTestCase {
class NumberHelperTest extends CakeTestCase {
/**
* helper property
*
@ -39,7 +39,6 @@ class NumberTest extends CakeTestCase {
* @access public
*/
var $helper = null;
/**
* setUp method
*
@ -49,6 +48,15 @@ class NumberTest extends CakeTestCase {
function setUp() {
$this->Number =& new NumberHelper();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Number);
}
/**
* testFormatAndCurrency method
*
@ -101,7 +109,7 @@ class NumberTest extends CakeTestCase {
$result = $this->Number->currency($value, '', array('thousands' =>' ', 'after' => '€', 'decimals' => ',', 'zero' => 'Gratuit'));
$expected = '100 100 100,00€';
$this->assertEqual($expected, $result);
}
/**
* testCurrencyPositive method
@ -136,7 +144,6 @@ class NumberTest extends CakeTestCase {
$expected = '&#163;100,100,100.00';
$this->assertEqual($expected, $result);
}
/**
* testCurrencyNegative method
*
@ -363,16 +370,6 @@ class NumberTest extends CakeTestCase {
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Number);
}
}
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* PaginatorHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,12 +26,12 @@
*/
App::import('Helper', array('Html', 'Paginator', 'Form', 'Ajax', 'Javascript'));
/**
* Short description for class.
* PaginatorHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class PaginatorTest extends CakeTestCase {
class PaginatorHelperTest extends CakeTestCase {
/**
* setUp method
*
@ -69,6 +69,15 @@ class PaginatorTest extends CakeTestCase {
Configure::write('Routing.admin', '');
Router::reload();
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Paginator);
}
/**
* testHasPrevious method
*
@ -842,14 +851,5 @@ class PaginatorTest extends CakeTestCase {
$result = $this->Paginator->link('Page 3', array('page' => 3));
$this->assertPattern('/["\']\/issues\/index\/page:3["\']/', $result);
}
/**
* tearDown method
*
* @access public
* @return void
*/
function tearDown() {
unset($this->Paginator);
}
}
?>
?>

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* RssHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -26,12 +26,12 @@
*/
App::import('Helper', array('Rss', 'Time'));
/**
* Short description for class.
* RssHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class RssTest extends CakeTestCase {
class RssHelperTest extends CakeTestCase {
/**
* setUp method
*
@ -301,7 +301,6 @@ class RssTest extends CakeTestCase {
$expected = '';
$this->assertEqual($result, $expected);
}
/**
* testItem method
*

View file

@ -1,7 +1,7 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
* SessionHelperTest file
*
* Long description for file
*
@ -16,7 +16,7 @@
* @filesource
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
* @since CakePHP(tm) v 1.2.0.4206
* @version $Revision$
@ -30,9 +30,9 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
App::import('Core', array('Helper', 'AppHelper', 'Controller', 'View'));
App::import('Helper', array('Session'));
/**
* Short description for class.
* SessionHelperTest class
*
* @package cake.tests
* @package cake
* @subpackage cake.tests.cases.libs.view.helpers
*/
class SessionHelperTest extends CakeTestCase {
@ -224,5 +224,4 @@ class SessionHelperTest extends CakeTestCase {
//$this->assertFalse($this->Session->valid());
}
}
?>

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