mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.1' into 2.2
Conflicts: lib/Cake/Test/Case/Model/ModelWriteTest.php
This commit is contained in:
commit
c58b61c17b
128 changed files with 1342 additions and 1072 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Bake is a shell script for running CakePHP bake script
|
# Bake is a shell script for running CakePHP bake script
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
|
RewriteRule ^(.*)$ index.php [QSA,L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
|
@ -137,11 +137,17 @@
|
||||||
<package name="PHPUnit" channel="pear.phpunit.de" minimum_version="3.5.0" type="optional" />
|
<package name="PHPUnit" channel="pear.phpunit.de" minimum_version="3.5.0" type="optional" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<dirroles key="bin">script</dirroles>
|
<dirroles key="bin">script</dirroles>
|
||||||
|
<dirroles key="Cake/Test">php</dirroles>
|
||||||
|
<dirroles key="Cake/Console/Templates/skel">php</dirroles>
|
||||||
|
<dirroles key="Cake/Console/Templates/default">php</dirroles>
|
||||||
|
<dirroles key="Cake/View">php</dirroles>
|
||||||
<release>
|
<release>
|
||||||
<install as="cake" name="bin/cake" />
|
<install as="cake" name="bin/cake" />
|
||||||
<install as="cake.php" name="bin/cake.php" />
|
<install as="cake.php" name="bin/cake.php" />
|
||||||
<install as="cake.bat" name="bin/cake.bat" />
|
<install as="cake.bat" name="bin/cake.bat" />
|
||||||
</release>
|
</release>
|
||||||
|
<exceptions key="Cake/VERSION.txt">php</exceptions>
|
||||||
|
<exceptions key="Cake/LICENSE.txt">php</exceptions>
|
||||||
</d51pearpkg2>
|
</d51pearpkg2>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Bake is a shell script for running CakePHP bake script
|
# Bake is a shell script for running CakePHP bake script
|
||||||
|
@ -30,4 +30,4 @@ APP=`pwd`
|
||||||
|
|
||||||
exec php -q "$LIB"cake.php -working "$APP" "$@"
|
exec php -q "$LIB"cake.php -working "$APP" "$@"
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
|
RewriteRule ^(.*)$ index.php [QSA,L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Bake is a shell script for running CakePHP bake script
|
# Bake is a shell script for running CakePHP bake script
|
||||||
|
|
|
@ -190,8 +190,9 @@ class CookieComponent extends Component {
|
||||||
public function startup(Controller $controller) {
|
public function startup(Controller $controller) {
|
||||||
$this->_expire($this->time);
|
$this->_expire($this->time);
|
||||||
|
|
||||||
|
$this->_values[$this->name] = array();
|
||||||
if (isset($_COOKIE[$this->name])) {
|
if (isset($_COOKIE[$this->name])) {
|
||||||
$this->_values = $this->_decrypt($_COOKIE[$this->name]);
|
$this->_values[$this->name] = $this->_decrypt($_COOKIE[$this->name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,6 +216,10 @@ class CookieComponent extends Component {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::write
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::write
|
||||||
*/
|
*/
|
||||||
public function write($key, $value = null, $encrypt = true, $expires = null) {
|
public function write($key, $value = null, $encrypt = true, $expires = null) {
|
||||||
|
if (empty($this->_values[$this->name])) {
|
||||||
|
$this->read();
|
||||||
|
}
|
||||||
|
|
||||||
if (is_null($encrypt)) {
|
if (is_null($encrypt)) {
|
||||||
$encrypt = true;
|
$encrypt = true;
|
||||||
}
|
}
|
||||||
|
@ -227,14 +232,14 @@ class CookieComponent extends Component {
|
||||||
|
|
||||||
foreach ($key as $name => $value) {
|
foreach ($key as $name => $value) {
|
||||||
if (strpos($name, '.') === false) {
|
if (strpos($name, '.') === false) {
|
||||||
$this->_values[$name] = $value;
|
$this->_values[$this->name][$name] = $value;
|
||||||
$this->_write("[$name]", $value);
|
$this->_write("[$name]", $value);
|
||||||
} else {
|
} else {
|
||||||
$names = explode('.', $name, 2);
|
$names = explode('.', $name, 2);
|
||||||
if (!isset($this->_values[$names[0]])) {
|
if (!isset($this->_values[$this->name][$names[0]])) {
|
||||||
$this->_values[$names[0]] = array();
|
$this->_values[$this->name][$names[0]] = array();
|
||||||
}
|
}
|
||||||
$this->_values[$names[0]] = Set::insert($this->_values[$names[0]], $names[1], $value);
|
$this->_values[$this->name][$names[0]] = Set::insert($this->_values[$this->name][$names[0]], $names[1], $value);
|
||||||
$this->_write('[' . implode('][', $names) . ']', $value);
|
$this->_write('[' . implode('][', $names) . ']', $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,26 +257,28 @@ class CookieComponent extends Component {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::read
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::read
|
||||||
*/
|
*/
|
||||||
public function read($key = null) {
|
public function read($key = null) {
|
||||||
if (empty($this->_values) && isset($_COOKIE[$this->name])) {
|
if (empty($this->_values[$this->name]) && isset($_COOKIE[$this->name])) {
|
||||||
$this->_values = $this->_decrypt($_COOKIE[$this->name]);
|
$this->_values[$this->name] = $this->_decrypt($_COOKIE[$this->name]);
|
||||||
|
}
|
||||||
|
if (empty($this->_values[$this->name])) {
|
||||||
|
$this->_values[$this->name] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($key)) {
|
if (is_null($key)) {
|
||||||
return $this->_values;
|
return $this->_values[$this->name];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($key, '.') !== false) {
|
if (strpos($key, '.') !== false) {
|
||||||
$names = explode('.', $key, 2);
|
$names = explode('.', $key, 2);
|
||||||
$key = $names[0];
|
$key = $names[0];
|
||||||
}
|
}
|
||||||
if (!isset($this->_values[$key])) {
|
if (!isset($this->_values[$this->name][$key])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($names[1])) {
|
if (!empty($names[1])) {
|
||||||
return Set::extract($this->_values[$key], $names[1]);
|
return Set::extract($this->_values[$this->name][$key], $names[1]);
|
||||||
}
|
}
|
||||||
return $this->_values[$key];
|
return $this->_values[$this->name][$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,22 +295,22 @@ class CookieComponent extends Component {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::delete
|
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::delete
|
||||||
*/
|
*/
|
||||||
public function delete($key) {
|
public function delete($key) {
|
||||||
if (empty($this->_values)) {
|
if (empty($this->_values[$this->name])) {
|
||||||
$this->read();
|
$this->read();
|
||||||
}
|
}
|
||||||
if (strpos($key, '.') === false) {
|
if (strpos($key, '.') === false) {
|
||||||
if (isset($this->_values[$key]) && is_array($this->_values[$key])) {
|
if (isset($this->_values[$this->name][$key]) && is_array($this->_values[$this->name][$key])) {
|
||||||
foreach ($this->_values[$key] as $idx => $val) {
|
foreach ($this->_values[$this->name][$key] as $idx => $val) {
|
||||||
$this->_delete("[$key][$idx]");
|
$this->_delete("[$key][$idx]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_delete("[$key]");
|
$this->_delete("[$key]");
|
||||||
unset($this->_values[$key]);
|
unset($this->_values[$this->name][$key]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$names = explode('.', $key, 2);
|
$names = explode('.', $key, 2);
|
||||||
if (isset($this->_values[$names[0]])) {
|
if (isset($this->_values[$this->name][$names[0]])) {
|
||||||
$this->_values[$names[0]] = Set::remove($this->_values[$names[0]], $names[1]);
|
$this->_values[$this->name][$names[0]] = Set::remove($this->_values[$this->name][$names[0]], $names[1]);
|
||||||
}
|
}
|
||||||
$this->_delete('[' . implode('][', $names) . ']');
|
$this->_delete('[' . implode('][', $names) . ']');
|
||||||
}
|
}
|
||||||
|
@ -319,17 +326,17 @@ class CookieComponent extends Component {
|
||||||
*/
|
*/
|
||||||
public function destroy() {
|
public function destroy() {
|
||||||
if (isset($_COOKIE[$this->name])) {
|
if (isset($_COOKIE[$this->name])) {
|
||||||
$this->_values = $this->_decrypt($_COOKIE[$this->name]);
|
$this->_values[$this->name] = $this->_decrypt($_COOKIE[$this->name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->_values as $name => $value) {
|
foreach ($this->_values[$this->name] as $name => $value) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
foreach ($value as $key => $val) {
|
foreach ($value as $key => $val) {
|
||||||
unset($this->_values[$name][$key]);
|
unset($this->_values[$this->name][$name][$key]);
|
||||||
$this->_delete("[$name][$key]");
|
$this->_delete("[$name][$key]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($this->_values[$name]);
|
unset($this->_values[$this->name][$name]);
|
||||||
$this->_delete("[$name]");
|
$this->_delete("[$name]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -503,5 +510,5 @@ class CookieComponent extends Component {
|
||||||
}
|
}
|
||||||
return $array;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -581,9 +581,11 @@ class RequestHandlerComponent extends Component {
|
||||||
$controller->ext = '.ctp';
|
$controller->ext = '.ctp';
|
||||||
|
|
||||||
$viewClass = Inflector::classify($type);
|
$viewClass = Inflector::classify($type);
|
||||||
App::uses($viewClass . 'View', 'View');
|
$viewName = $viewClass . 'View';
|
||||||
|
if (!class_exists($viewName)) {
|
||||||
if (class_exists($viewClass . 'View')) {
|
App::uses($viewName, 'View');
|
||||||
|
}
|
||||||
|
if (class_exists($viewName)) {
|
||||||
$controller->viewClass = $viewClass;
|
$controller->viewClass = $viewClass;
|
||||||
} elseif (empty($this->_renderType)) {
|
} elseif (empty($this->_renderType)) {
|
||||||
$controller->viewPath .= DS . $type;
|
$controller->viewPath .= DS . $type;
|
||||||
|
|
|
@ -75,20 +75,26 @@ class Configure {
|
||||||
App::$bootstrapping = false;
|
App::$bootstrapping = false;
|
||||||
App::init();
|
App::init();
|
||||||
App::build();
|
App::build();
|
||||||
$level = -1;
|
|
||||||
if (isset(self::$_values['Error']['level'])) {
|
$exception = array(
|
||||||
error_reporting(self::$_values['Error']['level']);
|
'handler' => 'ErrorHandler::handleException',
|
||||||
$level = self::$_values['Error']['level'];
|
);
|
||||||
}
|
$error = array(
|
||||||
if (!empty(self::$_values['Error']['handler'])) {
|
'handler' => 'ErrorHandler::handleError',
|
||||||
set_error_handler(self::$_values['Error']['handler'], $level);
|
'level' => E_ALL & ~E_DEPRECATED,
|
||||||
}
|
);
|
||||||
if (!empty(self::$_values['Exception']['handler'])) {
|
self::_setErrorHandlers($error, $exception);
|
||||||
set_exception_handler(self::$_values['Exception']['handler']);
|
|
||||||
}
|
|
||||||
if (!include APP . 'Config' . DS . 'bootstrap.php') {
|
if (!include APP . 'Config' . DS . 'bootstrap.php') {
|
||||||
trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
|
trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
restore_error_handler();
|
||||||
|
|
||||||
|
self::_setErrorHandlers(
|
||||||
|
self::$_values['Error'],
|
||||||
|
self::$_values['Exception']
|
||||||
|
);
|
||||||
|
unset($error, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,4 +342,24 @@ class Configure {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the error and exception handlers.
|
||||||
|
*
|
||||||
|
* @param array $error The Error handling configuration.
|
||||||
|
* @param array $exception The exception handling configuration.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected static function _setErrorHandlers($error, $exception) {
|
||||||
|
$level = -1;
|
||||||
|
if (isset($error['level'])) {
|
||||||
|
error_reporting($error['level']);
|
||||||
|
$level = $error['level'];
|
||||||
|
}
|
||||||
|
if (!empty($error['handler'])) {
|
||||||
|
set_error_handler($error['handler'], $level);
|
||||||
|
}
|
||||||
|
if (!empty($exception['handler'])) {
|
||||||
|
set_exception_handler($exception['handler']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
$rght = $count++;
|
$rght = $count++;
|
||||||
$Model->create(false);
|
$Model->create(false);
|
||||||
$Model->id = $array[$Model->alias][$Model->primaryKey];
|
$Model->id = $array[$Model->alias][$Model->primaryKey];
|
||||||
$Model->save(array($left => $lft, $right => $rght), array('callbacks' => false));
|
$Model->save(array($left => $lft, $right => $rght), array('callbacks' => false, 'validate' => false));
|
||||||
}
|
}
|
||||||
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
|
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
|
||||||
$Model->create(false);
|
$Model->create(false);
|
||||||
|
@ -744,7 +744,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
$Model->id = $id;
|
$Model->id = $id;
|
||||||
return $Model->save(
|
return $Model->save(
|
||||||
array($left => $edge + 1, $right => $edge + 2, $parent => null),
|
array($left => $edge + 1, $right => $edge + 2, $parent => null),
|
||||||
array('callbacks' => false)
|
array('callbacks' => false, 'validate' => false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1792,8 +1792,14 @@ class Model extends Object implements CakeEventListener {
|
||||||
$newValues[$row] = $values;
|
$newValues[$row] = $values;
|
||||||
unset($values);
|
unset($values);
|
||||||
} elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
|
} elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
|
||||||
|
if (!empty($row[$this->{$join}->primaryKey])) {
|
||||||
|
$newJoins[] = $row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']];
|
||||||
|
}
|
||||||
$newData[] = $row;
|
$newData[] = $row;
|
||||||
} elseif (isset($row[$join]) && isset($row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
|
} elseif (isset($row[$join]) && isset($row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
|
||||||
|
if (!empty($row[$join][$this->{$join}->primaryKey])) {
|
||||||
|
$newJoins[] = $row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']];
|
||||||
|
}
|
||||||
$newData[] = $row[$join];
|
$newData[] = $row[$join];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1827,8 +1833,10 @@ class Model extends Object implements CakeEventListener {
|
||||||
if (!empty($newData)) {
|
if (!empty($newData)) {
|
||||||
foreach ($newData as $data) {
|
foreach ($newData as $data) {
|
||||||
$data[$this->hasAndBelongsToMany[$assoc]['foreignKey']] = $id;
|
$data[$this->hasAndBelongsToMany[$assoc]['foreignKey']] = $id;
|
||||||
$this->{$join}->create($data);
|
if (empty($data[$this->{$join}->primaryKey])) {
|
||||||
$this->{$join}->save();
|
$this->{$join}->create();
|
||||||
|
}
|
||||||
|
$this->{$join}->save($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class AllTests extends PHPUnit_Framework_TestSuite {
|
||||||
$suite->addTestFile($path . 'Model' . DS . 'ModelTest.php');
|
$suite->addTestFile($path . 'Model' . DS . 'ModelTest.php');
|
||||||
$suite->addTestFile($path . 'AllRoutingTest.php');
|
$suite->addTestFile($path . 'AllRoutingTest.php');
|
||||||
$suite->addTestFile($path . 'AllNetworkTest.php');
|
$suite->addTestFile($path . 'AllNetworkTest.php');
|
||||||
$suite->addTestFile($path . 'AllTestSuiteTest.php');;
|
$suite->addTestFile($path . 'AllTestSuiteTest.php');
|
||||||
$suite->addTestFile($path . 'AllUtilityTest.php');
|
$suite->addTestFile($path . 'AllUtilityTest.php');
|
||||||
$suite->addTestFile($path . 'AllViewTest.php');
|
$suite->addTestFile($path . 'AllViewTest.php');
|
||||||
$suite->addTestFile($path . 'AllI18nTest.php');
|
$suite->addTestFile($path . 'AllI18nTest.php');
|
||||||
|
|
|
@ -685,7 +685,7 @@ class BasicsTest extends CakeTestCase {
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('this-is-a-test', false);
|
debug('this-is-a-test', false);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expectedText = <<<EXPECTED
|
$expectedText = <<<EXPECTED
|
||||||
%s (line %d)
|
%s (line %d)
|
||||||
########## DEBUG ##########
|
########## DEBUG ##########
|
||||||
'this-is-a-test'
|
'this-is-a-test'
|
||||||
|
@ -697,7 +697,7 @@ EXPECTED;
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', true);
|
debug('<div>this-is-a-test</div>', true);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expectedHtml = <<<EXPECTED
|
$expectedHtml = <<<EXPECTED
|
||||||
<div class="cake-debug-output">
|
<div class="cake-debug-output">
|
||||||
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
|
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
|
||||||
<pre class="cake-debug">
|
<pre class="cake-debug">
|
||||||
|
@ -709,9 +709,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', true, true);
|
debug('<div>this-is-a-test</div>', true, true);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = <<<EXPECTED
|
$expected = <<<EXPECTED
|
||||||
<div class="cake-debug-output">
|
<div class="cake-debug-output">
|
||||||
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
|
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
|
||||||
<pre class="cake-debug">
|
<pre class="cake-debug">
|
||||||
|
@ -723,9 +723,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', true, false);
|
debug('<div>this-is-a-test</div>', true, false);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = <<<EXPECTED
|
$expected = <<<EXPECTED
|
||||||
<div class="cake-debug-output">
|
<div class="cake-debug-output">
|
||||||
|
|
||||||
<pre class="cake-debug">
|
<pre class="cake-debug">
|
||||||
|
@ -737,9 +737,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', null);
|
debug('<div>this-is-a-test</div>', null);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expectedHtml = <<<EXPECTED
|
$expectedHtml = <<<EXPECTED
|
||||||
<div class="cake-debug-output">
|
<div class="cake-debug-output">
|
||||||
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
|
<span><strong>%s</strong> (line <strong>%d</strong>)</span>
|
||||||
<pre class="cake-debug">
|
<pre class="cake-debug">
|
||||||
|
@ -747,7 +747,7 @@ $expectedHtml = <<<EXPECTED
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
EXPECTED;
|
EXPECTED;
|
||||||
$expectedText = <<<EXPECTED
|
$expectedText = <<<EXPECTED
|
||||||
%s (line %d)
|
%s (line %d)
|
||||||
########## DEBUG ##########
|
########## DEBUG ##########
|
||||||
'<div>this-is-a-test</div>'
|
'<div>this-is-a-test</div>'
|
||||||
|
@ -761,9 +761,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', null, false);
|
debug('<div>this-is-a-test</div>', null, false);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expectedHtml = <<<EXPECTED
|
$expectedHtml = <<<EXPECTED
|
||||||
<div class="cake-debug-output">
|
<div class="cake-debug-output">
|
||||||
|
|
||||||
<pre class="cake-debug">
|
<pre class="cake-debug">
|
||||||
|
@ -771,7 +771,7 @@ $expectedHtml = <<<EXPECTED
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
EXPECTED;
|
EXPECTED;
|
||||||
$expectedText = <<<EXPECTED
|
$expectedText = <<<EXPECTED
|
||||||
|
|
||||||
########## DEBUG ##########
|
########## DEBUG ##########
|
||||||
'<div>this-is-a-test</div>'
|
'<div>this-is-a-test</div>'
|
||||||
|
@ -785,9 +785,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', false);
|
debug('<div>this-is-a-test</div>', false);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = <<<EXPECTED
|
$expected = <<<EXPECTED
|
||||||
%s (line %d)
|
%s (line %d)
|
||||||
########## DEBUG ##########
|
########## DEBUG ##########
|
||||||
'<div>this-is-a-test</div>'
|
'<div>this-is-a-test</div>'
|
||||||
|
@ -797,9 +797,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', false, true);
|
debug('<div>this-is-a-test</div>', false, true);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = <<<EXPECTED
|
$expected = <<<EXPECTED
|
||||||
%s (line %d)
|
%s (line %d)
|
||||||
########## DEBUG ##########
|
########## DEBUG ##########
|
||||||
'<div>this-is-a-test</div>'
|
'<div>this-is-a-test</div>'
|
||||||
|
@ -809,9 +809,9 @@ EXPECTED;
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
debug('<div>this-is-a-test</div>', false, false);
|
debug('<div>this-is-a-test</div>', false, false);
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = <<<EXPECTED
|
$expected = <<<EXPECTED
|
||||||
|
|
||||||
########## DEBUG ##########
|
########## DEBUG ##########
|
||||||
'<div>this-is-a-test</div>'
|
'<div>this-is-a-test</div>'
|
||||||
|
@ -828,13 +828,13 @@ EXPECTED;
|
||||||
*/
|
*/
|
||||||
public function testPr() {
|
public function testPr() {
|
||||||
ob_start();
|
ob_start();
|
||||||
pr('this is a test');
|
pr('this is a test');
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = "<pre>this is a test</pre>";
|
$expected = "<pre>this is a test</pre>";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
pr(array('this' => 'is', 'a' => 'test'));
|
pr(array('this' => 'is', 'a' => 'test'));
|
||||||
$result = ob_get_clean();
|
$result = ob_get_clean();
|
||||||
$expected = "<pre>Array\n(\n [this] => is\n [a] => test\n)\n</pre>";
|
$expected = "<pre>Array\n(\n [this] => is\n [a] => test\n)\n</pre>";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
|
@ -160,7 +160,6 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testReadPlainCookieData() {
|
public function testReadPlainCookieData() {
|
||||||
$this->_setCookieData();
|
$this->_setCookieData();
|
||||||
|
|
||||||
$data = $this->Cookie->read('Plain_array');
|
$data = $this->Cookie->read('Plain_array');
|
||||||
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
|
@ -170,6 +169,26 @@ class CookieComponentTest extends CakeTestCase {
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test read() after switching the cookie name.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReadWithNameSwitch() {
|
||||||
|
$_COOKIE = array(
|
||||||
|
'CakeTestCookie' => array(
|
||||||
|
'key' => 'value'
|
||||||
|
),
|
||||||
|
'OtherTestCookie' => array(
|
||||||
|
'key' => 'other value'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals('value', $this->Cookie->read('key'));
|
||||||
|
|
||||||
|
$this->Cookie->name = 'OtherTestCookie';
|
||||||
|
$this->assertEquals('other value', $this->Cookie->read('key'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test a simple write()
|
* test a simple write()
|
||||||
*
|
*
|
||||||
|
|
|
@ -353,5 +353,5 @@ class ConfigureTest extends CakeTestCase {
|
||||||
$reader = new StdClass();
|
$reader = new StdClass();
|
||||||
Configure::config('test', $reader);
|
Configure::config('test', $reader);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -2668,7 +2668,7 @@ class I18nTest extends CakeTestCase {
|
||||||
private function __domainCategoryPlural($domain = 'test_plugin', $category = 3) {
|
private function __domainCategoryPlural($domain = 'test_plugin', $category = 3) {
|
||||||
$plurals = array();
|
$plurals = array();
|
||||||
for ($number = 0; $number <= 25; $number++) {
|
for ($number = 0; $number <= 25; $number++) {
|
||||||
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number);
|
$plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number);
|
||||||
}
|
}
|
||||||
return $plurals;
|
return $plurals;
|
||||||
}
|
}
|
||||||
|
@ -2691,7 +2691,7 @@ class I18nTest extends CakeTestCase {
|
||||||
private function __domainPlural($domain = 'test_plugin') {
|
private function __domainPlural($domain = 'test_plugin') {
|
||||||
$plurals = array();
|
$plurals = array();
|
||||||
for ($number = 0; $number <= 25; $number++) {
|
for ($number = 0; $number <= 25; $number++) {
|
||||||
$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number );
|
$plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number );
|
||||||
}
|
}
|
||||||
return $plurals;
|
return $plurals;
|
||||||
}
|
}
|
||||||
|
@ -2724,7 +2724,7 @@ class I18nTest extends CakeTestCase {
|
||||||
private function __plural() {
|
private function __plural() {
|
||||||
$plurals = array();
|
$plurals = array();
|
||||||
for ($number = 0; $number <= 25; $number++) {
|
for ($number = 0; $number <= 25; $number++) {
|
||||||
$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
|
$plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number);
|
||||||
}
|
}
|
||||||
return $plurals;
|
return $plurals;
|
||||||
}
|
}
|
||||||
|
@ -2747,7 +2747,7 @@ class I18nTest extends CakeTestCase {
|
||||||
private function __pluralFromCore() {
|
private function __pluralFromCore() {
|
||||||
$plurals = array();
|
$plurals = array();
|
||||||
for ($number = 0; $number <= 25; $number++) {
|
for ($number = 0; $number <= 25; $number++) {
|
||||||
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number );
|
$plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number );
|
||||||
}
|
}
|
||||||
return $plurals;
|
return $plurals;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,6 @@ class L10nTest extends CakeTestCase {
|
||||||
$l10n->get('');
|
$l10n->get('');
|
||||||
$this->assertEquals($l10n->lang, 'en-us');
|
$this->assertEquals($l10n->lang, 'en-us');
|
||||||
|
|
||||||
|
|
||||||
// Using $this->default
|
// Using $this->default
|
||||||
$l10n = new L10n();
|
$l10n = new L10n();
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ class L10nTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testGetAutoLanguage() {
|
public function testGetAutoLanguage() {
|
||||||
$__SERVER = $_SERVER;
|
$serverBackup = $_SERVER;
|
||||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca';
|
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca';
|
||||||
|
|
||||||
$l10n = new L10n();
|
$l10n = new L10n();
|
||||||
|
@ -107,7 +106,7 @@ class L10nTest extends CakeTestCase {
|
||||||
$this->assertEquals($l10n->languagePath, array('eng', 'eng', 'eng'));
|
$this->assertEquals($l10n->languagePath, array('eng', 'eng', 'eng'));
|
||||||
$this->assertEquals($l10n->locale, 'eng');
|
$this->assertEquals($l10n->locale, 'eng');
|
||||||
|
|
||||||
$_SERVER = $__SERVER;
|
$_SERVER = $serverBackup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -895,7 +894,7 @@ class L10nTest extends CakeTestCase {
|
||||||
$result = $l10n->catalog(array('cy'));
|
$result = $l10n->catalog(array('cy'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8',
|
'cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8',
|
||||||
'direction' => 'ltr')
|
'direction' => 'ltr')
|
||||||
);
|
);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
|
@ -159,14 +159,12 @@ class MultibyteTest extends CakeTestCase {
|
||||||
65265, 65266, 65267, 65268, 65269, 65270, 65271, 65272, 65273, 65274, 65275, 65276);
|
65265, 65266, 65267, 65268, 65269, 65270, 65271, 65272, 65273, 65274, 65275, 65276);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$string = 'abcdefghijklmnopqrstuvwxyz';
|
$string = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
$result = Multibyte::utf8($string);
|
$result = Multibyte::utf8($string);
|
||||||
$expected = array(65345, 65346, 65347, 65348, 65349, 65350, 65351, 65352, 65353, 65354, 65355, 65356, 65357, 65358, 65359, 65360,
|
$expected = array(65345, 65346, 65347, 65348, 65349, 65350, 65351, 65352, 65353, 65354, 65355, 65356, 65357, 65358, 65359, 65360,
|
||||||
65361, 65362, 65363, 65364, 65365, 65366, 65367, 65368, 65369, 65370);
|
65361, 65362, 65363, 65364, 65365, 65366, 65367, 65368, 65369, 65370);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$string = '。「」、・ヲァィゥェォャュョッーアイウエオカキク';
|
$string = '。「」、・ヲァィゥェォャュョッーアイウエオカキク';
|
||||||
$result = Multibyte::utf8($string);
|
$result = Multibyte::utf8($string);
|
||||||
$expected = array(65377, 65378, 65379, 65380, 65381, 65382, 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390, 65391, 65392,
|
$expected = array(65377, 65378, 65379, 65380, 65381, 65382, 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390, 65391, 65392,
|
||||||
|
@ -341,7 +339,6 @@ class MultibyteTest extends CakeTestCase {
|
||||||
11489, 11491);
|
11489, 11491);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
||||||
$result = Multibyte::utf8($string);
|
$result = Multibyte::utf8($string);
|
||||||
$expected = array(64256, 64257, 64258, 64259, 64260, 64261, 64262, 64275, 64276, 64277, 64278, 64279);
|
$expected = array(64256, 64257, 64258, 64259, 64260, 64261, 64262, 64275, 64276, 64277, 64278, 64279);
|
||||||
|
@ -6566,57 +6563,7 @@ class MultibyteTest extends CakeTestCase {
|
||||||
$result = mb_strtolower($string);
|
$result = mb_strtolower($string);
|
||||||
$expected = 'ἀι';
|
$expected = 'ἀι';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
/*
|
|
||||||
The tests below are flaky across different platforms.
|
|
||||||
|
|
||||||
$string = 'ԀԂԄԆԈԊԌԎԐԒ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ԁԃԅԇԉԋԍԏԑԓ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖև';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'աբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆև';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẖẗẘẙẚẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕẖẗẘẙẚạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ΩKÅ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ωkå';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ΩKÅ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ωkå';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
/*
|
|
||||||
mb_strtolower does not work for these strings.
|
|
||||||
|
|
||||||
$string = 'ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯↃ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻⅼⅽⅾⅿↄ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ⰀⰁⰂⰃⰄⰅⰆⰇⰈⰉⰊⰋⰌⰍⰎⰏⰐⰑⰒⰓⰔⰕⰖⰗⰘⰙⰚⰛⰜⰝⰞⰟⰠⰡⰢⰣⰤⰥⰦⰧⰨⰩⰪⰫⰬⰭⰮ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ⰰⰱⰲⰳⰴⰵⰶⰷⰸⰹⰺⰻⰼⰽⰾⰿⱀⱁⱂⱃⱄⱅⱆⱇⱈⱉⱊⱋⱌⱍⱎⱏⱐⱑⱒⱓⱔⱕⱖⱗⱘⱙⱚⱛⱜⱝⱞ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢ';
|
|
||||||
$result = mb_strtolower($string);
|
|
||||||
$expected = 'ⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
*/
|
|
||||||
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
||||||
$result = mb_strtolower($string);
|
$result = mb_strtolower($string);
|
||||||
$expected = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
$expected = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
||||||
|
@ -7696,29 +7643,6 @@ mb_strtolower does not work for these strings.
|
||||||
$expected = 'ΩKÅ';
|
$expected = 'ΩKÅ';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
/*
|
|
||||||
mb_strtoupper does not work for these strings.
|
|
||||||
|
|
||||||
$string = 'ⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻⅼⅽⅾⅿↄ';
|
|
||||||
$result = mb_strtoupper($string);
|
|
||||||
$expected = 'ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯↃ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ';
|
|
||||||
$result = mb_strtoupper($string);
|
|
||||||
$expected = 'ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ⰰⰱⰲⰳⰴⰵⰶⰷⰸⰹⰺⰻⰼⰽⰾⰿⱀⱁⱂⱃⱄⱅⱆⱇⱈⱉⱊⱋⱌⱍⱎⱏⱐⱑⱒⱓⱔⱕⱖⱗⱘⱙⱚⱛⱜⱝⱞ';
|
|
||||||
$result = mb_strtoupper($string);
|
|
||||||
$expected = 'ⰀⰁⰂⰃⰄⰅⰆⰇⰈⰉⰊⰋⰌⰍⰎⰏⰐⰑⰒⰓⰔⰕⰖⰗⰘⰙⰚⰛⰜⰝⰞⰟⰠⰡⰢⰣⰤⰥⰦⰧⰨⰩⰪⰫⰬⰭⰮ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
|
|
||||||
$string = 'ⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣ';
|
|
||||||
$result = mb_strtoupper($string);
|
|
||||||
$expected = 'ⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢ';
|
|
||||||
$this->assertEquals($expected, $result);
|
|
||||||
*/
|
|
||||||
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
||||||
$result = mb_strtoupper($string);
|
$result = mb_strtoupper($string);
|
||||||
$expected = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
$expected = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
|
||||||
|
|
|
@ -198,6 +198,7 @@ class DbAroUserTest extends CakeTestModel {
|
||||||
return array('DbAroTest' => array('DbAroTest.model' => 'AuthUser', 'DbAroTest.foreign_key' => 2));
|
return array('DbAroTest' => array('DbAroTest.model' => 'AuthUser', 'DbAroTest.foreign_key' => 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,6 +219,7 @@ class TestDbAcl extends DbAcl {
|
||||||
$this->Aco = new DbAcoTest();
|
$this->Aco = new DbAcoTest();
|
||||||
$this->Aro->Permission = new DbPermissionTest();
|
$this->Aro->Permission = new DbPermissionTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -332,7 +334,6 @@ class AclNodeTest extends CakeTestCase {
|
||||||
$result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
|
$result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
|
||||||
$expected = array(4, 2, 1);
|
$expected = array(4, 2, 1);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,10 +27,10 @@ App::uses('DbAcl', 'Model');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Person class - self joined model
|
* Test Person class - self joined model
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Case.Model.Behavior
|
* @package Cake.Test.Case.Model.Behavior
|
||||||
*/
|
*/
|
||||||
class AclPerson extends CakeTestModel {
|
class AclPerson extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,13 +98,14 @@ class AclPerson extends CakeTestModel {
|
||||||
return array('AclPerson' => array('id' => $motherId));
|
return array('AclPerson' => array('id' => $motherId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AclUser class
|
* AclUser class
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Case.Model.Behavior
|
* @package Cake.Test.Case.Model.Behavior
|
||||||
*/
|
*/
|
||||||
class AclUser extends CakeTestModel {
|
class AclUser extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,13 +136,14 @@ class AclUser extends CakeTestModel {
|
||||||
public function parentNode() {
|
public function parentNode() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AclPost class
|
* AclPost class
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Case.Model.Behavior
|
* @package Cake.Test.Case.Model.Behavior
|
||||||
*/
|
*/
|
||||||
class AclPost extends CakeTestModel {
|
class AclPost extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,13 +174,14 @@ class AclPost extends CakeTestModel {
|
||||||
public function parentNode() {
|
public function parentNode() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AclBehaviorTest class
|
* AclBehaviorTest class
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Case.Model.Behavior
|
* @package Cake.Test.Case.Model.Behavior
|
||||||
*/
|
*/
|
||||||
class AclBehaviorTest extends CakeTestCase {
|
class AclBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -342,7 +345,7 @@ class AclBehaviorTest extends CakeTestCase {
|
||||||
$this->assertEquals($result['Aro']['parent_id'], 7);
|
$this->assertEquals($result['Aro']['parent_id'], 7);
|
||||||
|
|
||||||
$node = $Person->node(array('model' => 'AclPerson', 'foreign_key' => 8), 'Aro');
|
$node = $Person->node(array('model' => 'AclPerson', 'foreign_key' => 8), 'Aro');
|
||||||
$this->assertEquals(sizeof($node), 2);
|
$this->assertEquals(count($node), 2);
|
||||||
$this->assertEquals($node[0]['Aro']['parent_id'], 7);
|
$this->assertEquals($node[0]['Aro']['parent_id'], 7);
|
||||||
$this->assertEquals($node[1]['Aro']['parent_id'], null);
|
$this->assertEquals($node[1]['Aro']['parent_id'], null);
|
||||||
}
|
}
|
||||||
|
@ -362,7 +365,6 @@ class AclBehaviorTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->Aro->save($aroData);
|
$this->Aro->save($aroData);
|
||||||
|
|
||||||
|
|
||||||
$acoData = array(
|
$acoData = array(
|
||||||
'Aco' => array(
|
'Aco' => array(
|
||||||
'model' => 'AclPerson',
|
'model' => 'AclPerson',
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
|
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContainableTest class
|
* ContainableTest class
|
||||||
|
@ -3553,8 +3553,10 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->skipIf(
|
$this->skipIf(
|
||||||
!isset($config->test) || !isset($config->test2),
|
!isset($config->test) || !isset($config->test2),
|
||||||
'Primary and secondary test databases not configured, skipping cross-database join tests.'
|
'Primary and secondary test databases not configured, ' .
|
||||||
. ' To run these tests, you must define $test and $test2 in your database configuration.'
|
'skipping cross-database join tests. ' .
|
||||||
|
' To run these tests, you must define $test and $test2 ' .
|
||||||
|
'in your database configuration.'
|
||||||
);
|
);
|
||||||
|
|
||||||
$db = ConnectionManager::getDataSource('test2');
|
$db = ConnectionManager::getDataSource('test2');
|
||||||
|
|
|
@ -22,7 +22,7 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
|
||||||
|
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
|
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TranslateBehaviorTest class
|
* TranslateBehaviorTest class
|
||||||
|
@ -351,7 +351,6 @@ class TranslateBehaviorTest extends CakeTestCase {
|
||||||
$TestModel = new TranslatedItem();
|
$TestModel = new TranslatedItem();
|
||||||
$TestModel->locale = array('deu', 'eng', 'cze');
|
$TestModel->locale = array('deu', 'eng', 'cze');
|
||||||
|
|
||||||
|
|
||||||
$result = $TestModel->read(null, 1);
|
$result = $TestModel->read(null, 1);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'TranslatedItem' => array(
|
'TranslatedItem' => array(
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
|
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
|
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TreeBehaviorNumberTest class
|
* TreeBehaviorNumberTest class
|
||||||
|
@ -42,7 +42,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $settings = array(
|
public $settings = array(
|
||||||
'modelClass' => 'NumberTree',
|
'modelClass' => 'NumberTree',
|
||||||
'leftField' => 'lft',
|
'leftField' => 'lft',
|
||||||
'rightField' => 'rght',
|
'rightField' => 'rght',
|
||||||
|
@ -410,7 +410,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
|
|
||||||
$validTree = $this->Tree->verify();
|
$validTree = $this->Tree->verify();
|
||||||
$this->assertSame($validTree, true);
|
$this->assertSame($validTree, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testMovePromote method
|
* testMovePromote method
|
||||||
|
@ -424,12 +424,12 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->saveField($parentField, $parent_id);
|
$this->Tree->saveField($parentField, $parentId);
|
||||||
$direct = $this->Tree->children($parent_id, true, array('id', 'name', $parentField, $leftField, $rightField));
|
$direct = $this->Tree->children($parentId, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||||
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 5)),
|
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 5)),
|
||||||
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 6, $rightField => 11)),
|
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 6, $rightField => 11)),
|
||||||
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 1, $leftField => 12, $rightField => 13)));
|
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 1, $leftField => 12, $rightField => 13)));
|
||||||
|
@ -450,14 +450,14 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||||
$this->Tree->id = $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->whitelist = array($parentField, 'name', 'description');
|
$this->Tree->whitelist = array($parentField, 'name', 'description');
|
||||||
$this->Tree->saveField($parentField, $parent_id);
|
$this->Tree->saveField($parentField, $parentId);
|
||||||
|
|
||||||
$result = $this->Tree->children($parent_id, true, array('id', 'name', $parentField, $leftField, $rightField));
|
$result = $this->Tree->children($parentId, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||||
$expected = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 5)),
|
$expected = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 5)),
|
||||||
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 6, $rightField => 11)),
|
array($modelClass => array('id' => 5, 'name' => '1.2', $parentField => 1, $leftField => 6, $rightField => 11)),
|
||||||
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 1, $leftField => 12, $rightField => 13)));
|
array($modelClass => array('id' => 3, 'name' => '1.1.1', $parentField => 1, $leftField => 12, $rightField => 13)));
|
||||||
|
@ -495,13 +495,13 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.1')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.1')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.2')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.2')));
|
||||||
$this->Tree->id = $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->saveField($parentField, $parent_id);
|
$this->Tree->saveField($parentField, $parentId);
|
||||||
|
|
||||||
$result = $this->Tree->children($parent_id, true, array('name'));
|
$result = $this->Tree->children($parentId, true, array('name'));
|
||||||
$expects = array(array($modelClass => array('name' => '1.1.1')),
|
$expects = array(array($modelClass => array('name' => '1.1.1')),
|
||||||
array($modelClass => array('name' => '1.1.2')),
|
array($modelClass => array('name' => '1.1.2')),
|
||||||
array($modelClass => array('name' => '1.2')));
|
array($modelClass => array('name' => '1.2')));
|
||||||
|
@ -523,13 +523,13 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data= $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
||||||
$this->Tree->id = $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->saveField($parentField, $parent_id);
|
$this->Tree->saveField($parentField, $parentId);
|
||||||
|
|
||||||
$result = $this->Tree->children($parent_id, true, array('name'));
|
$result = $this->Tree->children($parentId, true, array('name'));
|
||||||
$expects = array(array($modelClass => array('name' => '1.2.1')),
|
$expects = array(array($modelClass => array('name' => '1.2.1')),
|
||||||
array($modelClass => array('name' => '1.2.2')),
|
array($modelClass => array('name' => '1.2.2')),
|
||||||
array($modelClass => array('name' => '1.1')));
|
array($modelClass => array('name' => '1.1')));
|
||||||
|
@ -551,15 +551,14 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||||
|
|
||||||
$expects = $this->Tree->find('all');
|
$expects = $this->Tree->find('all');
|
||||||
$before = $this->Tree->read(null, $data[$modelClass]['id']);
|
$before = $this->Tree->read(null, $data[$modelClass]['id']);
|
||||||
|
|
||||||
$this->Tree->id = $parent_id;
|
$this->Tree->id = $parentId;
|
||||||
//$this->expectError('Trying to save a node under itself in TreeBehavior::beforeSave');
|
|
||||||
$this->Tree->saveField($parentField, $data[$modelClass]['id']);
|
$this->Tree->saveField($parentField, $data[$modelClass]['id']);
|
||||||
|
|
||||||
$results = $this->Tree->find('all');
|
$results = $this->Tree->find('all');
|
||||||
|
@ -584,13 +583,11 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$initialCount = $this->Tree->find('count');
|
$initialCount = $this->Tree->find('count');
|
||||||
$data= $this->Tree->findByName('1.1');
|
$data = $this->Tree->findByName('1.1');
|
||||||
|
|
||||||
//$this->expectError('Trying to save a node under a none-existant node in TreeBehavior::beforeSave');
|
|
||||||
$this->Tree->id = $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->saveField($parentField, 999999);
|
$this->Tree->saveField($parentField, 999999);
|
||||||
|
|
||||||
//$this->assertSame($saveSuccess, false);
|
|
||||||
$laterCount = $this->Tree->find('count');
|
$laterCount = $this->Tree->find('count');
|
||||||
$this->assertSame($initialCount, $laterCount);
|
$this->assertSame($initialCount, $laterCount);
|
||||||
|
|
||||||
|
@ -610,9 +607,8 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$initialCount = $this->Tree->find('count');
|
$initialCount = $this->Tree->find('count');
|
||||||
$data= $this->Tree->findByName('1.1');
|
$data = $this->Tree->findByName('1.1');
|
||||||
|
|
||||||
//$this->expectError('Trying to set a node to be the parent of itself in TreeBehavior::beforeSave');
|
|
||||||
$this->Tree->id = $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$saveSuccess = $this->Tree->saveField($parentField, $this->Tree->id);
|
$saveSuccess = $this->Tree->saveField($parentField, $this->Tree->id);
|
||||||
|
|
||||||
|
@ -902,11 +898,11 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$laterCount = $this->Tree->find('count');
|
$laterCount = $this->Tree->find('count');
|
||||||
$this->assertEquals($initialCount - 1, $laterCount);
|
$this->assertEquals($initialCount - 1, $laterCount);
|
||||||
|
|
||||||
$validTree= $this->Tree->verify();
|
$validTree = $this->Tree->verify();
|
||||||
$this->assertSame($validTree, true);
|
$this->assertSame($validTree, true);
|
||||||
|
|
||||||
$initialCount = $this->Tree->find('count');
|
$initialCount = $this->Tree->find('count');
|
||||||
$result= $this->Tree->findByName('1.1');
|
$result = $this->Tree->findByName('1.1');
|
||||||
|
|
||||||
$return = $this->Tree->delete($result[$modelClass]['id']);
|
$return = $this->Tree->delete($result[$modelClass]['id']);
|
||||||
$this->assertEquals($return, true);
|
$this->assertEquals($return, true);
|
||||||
|
@ -1033,12 +1029,14 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->removeFromTree($result[$modelClass]['id'], true);
|
$this->Tree->removeFromTree($result[$modelClass]['id'], true);
|
||||||
|
|
||||||
$laterCount = $this->Tree->find('count');
|
$laterCount = $this->Tree->find('count');
|
||||||
$this->assertEquals($initialCount-1, $laterCount);
|
$this->assertEquals($initialCount - 1, $laterCount);
|
||||||
|
|
||||||
$children = $this->Tree->children($result[$modelClass][$parentField], true, array('name'), $leftField . ' asc');
|
$children = $this->Tree->children($result[$modelClass][$parentField], true, array('name'), $leftField . ' asc');
|
||||||
$expects= array(array($modelClass => array('name' => '1.1.1')),
|
$expects = array(
|
||||||
|
array($modelClass => array('name' => '1.1.1')),
|
||||||
array($modelClass => array('name' => '1.1.2')),
|
array($modelClass => array('name' => '1.1.2')),
|
||||||
array($modelClass => array('name' => '1.2')));
|
array($modelClass => array('name' => '1.2'))
|
||||||
|
);
|
||||||
$this->assertEquals($children, $expects);
|
$this->assertEquals($children, $expects);
|
||||||
|
|
||||||
$topNodes = $this->Tree->children(false, true,array('name'));
|
$topNodes = $this->Tree->children(false, true,array('name'));
|
||||||
|
@ -1092,7 +1090,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->initialize(2, 2);
|
$this->Tree->initialize(2, 2);
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
|
|
||||||
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
|
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||||
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 7)),
|
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 7)),
|
||||||
|
@ -1147,7 +1145,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->initialize(2, 2);
|
$this->Tree->initialize(2, 2);
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
|
|
||||||
$result = $this->Tree->getParentNode(null, array('name'));
|
$result = $this->Tree->getParentNode(null, array('name'));
|
||||||
$expects = array($modelClass => array('name' => '1.2'));
|
$expects = array($modelClass => array('name' => '1.2'));
|
||||||
|
@ -1165,7 +1163,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->initialize(2, 2);
|
$this->Tree->initialize(2, 2);
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
|
|
||||||
$result = $this->Tree->getPath(null, array('name'));
|
$result = $this->Tree->getPath(null, array('name'));
|
||||||
$expects = array(array($modelClass => array('name' => '1. Root')),
|
$expects = array(array($modelClass => array('name' => '1. Root')),
|
||||||
|
@ -1187,7 +1185,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
||||||
$this->Tree->initialize(2, 2);
|
$this->Tree->initialize(2, 2);
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
|
|
||||||
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
|
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||||
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 7)),
|
$expects = array(array($modelClass => array('id' => 2, 'name' => '1.1', $parentField => 1, $leftField => 2, $rightField => 7)),
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
|
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TreeBehaviorScopedTest class
|
* TreeBehaviorScopedTest class
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
App::uses('Model', 'Model');
|
App::uses('Model', 'Model');
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
|
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TreeBehaviorUuidTest class
|
* TreeBehaviorUuidTest class
|
||||||
|
@ -68,12 +68,12 @@ class TreeBehaviorUuidTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||||
$this->Tree->id= $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->saveField($parentField, $parent_id);
|
$this->Tree->saveField($parentField, $parentId);
|
||||||
$direct = $this->Tree->children($parent_id, true, array('name', $leftField, $rightField));
|
$direct = $this->Tree->children($parentId, true, array('name', $leftField, $rightField));
|
||||||
$expects = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 5)),
|
$expects = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 5)),
|
||||||
array($modelClass => array('name' => '1.2', $leftField => 6, $rightField => 11)),
|
array($modelClass => array('name' => '1.2', $leftField => 6, $rightField => 11)),
|
||||||
array($modelClass => array('name' => '1.1.1', $leftField => 12, $rightField => 13)));
|
array($modelClass => array('name' => '1.1.1', $leftField => 12, $rightField => 13)));
|
||||||
|
@ -94,14 +94,14 @@ class TreeBehaviorUuidTest extends CakeTestCase {
|
||||||
$this->Tree->id = null;
|
$this->Tree->id = null;
|
||||||
|
|
||||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||||
$parent_id = $parent[$modelClass]['id'];
|
$parentId = $parent[$modelClass]['id'];
|
||||||
|
|
||||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||||
$this->Tree->id = $data[$modelClass]['id'];
|
$this->Tree->id = $data[$modelClass]['id'];
|
||||||
$this->Tree->whitelist = array($parentField, 'name', 'description');
|
$this->Tree->whitelist = array($parentField, 'name', 'description');
|
||||||
$this->Tree->saveField($parentField, $parent_id);
|
$this->Tree->saveField($parentField, $parentId);
|
||||||
|
|
||||||
$result = $this->Tree->children($parent_id, true, array('name', $leftField, $rightField));
|
$result = $this->Tree->children($parentId, true, array('name', $leftField, $rightField));
|
||||||
$expected = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 5)),
|
$expected = array(array($modelClass => array('name' => '1.1', $leftField => 2, $rightField => 5)),
|
||||||
array($modelClass => array('name' => '1.2', $leftField => 6, $rightField => 11)),
|
array($modelClass => array('name' => '1.2', $leftField => 6, $rightField => 11)),
|
||||||
array($modelClass => array('name' => '1.1.1', $leftField => 12, $rightField => 13)));
|
array($modelClass => array('name' => '1.1.1', $leftField => 12, $rightField => 13)));
|
||||||
|
|
|
@ -320,6 +320,7 @@ class TestBehavior extends ModelBehavior {
|
||||||
$query = preg_replace('/^in\s+/', 'Location.name = \'', $query);
|
$query = preg_replace('/^in\s+/', 'Location.name = \'', $query);
|
||||||
return $method . '\' AND ' . $query . '\'';
|
return $method . '\' AND ' . $query . '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -328,15 +329,15 @@ class TestBehavior extends ModelBehavior {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Test2Behavior extends TestBehavior {
|
class Test2Behavior extends TestBehavior {
|
||||||
|
|
||||||
public $mapMethods = array('/mappingRobot(\w+)/' => 'mapped');
|
public $mapMethods = array('/mappingRobot(\w+)/' => 'mapped');
|
||||||
|
|
||||||
public function resolveMethod(Model $model, $stuff) {
|
public function resolveMethod(Model $model, $stuff) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mapped(Model $model, $method, $query) {
|
public function mapped(Model $model, $method, $query) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -353,11 +354,13 @@ class Test3Behavior extends TestBehavior{
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Test4Behavior extends ModelBehavior{
|
class Test4Behavior extends ModelBehavior{
|
||||||
|
|
||||||
public function setup(Model $model, $config = null) {
|
public function setup(Model $model, $config = null) {
|
||||||
$model->bindModel(
|
$model->bindModel(
|
||||||
array('hasMany' => array('Comment'))
|
array('hasMany' => array('Comment'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -366,11 +369,13 @@ class Test4Behavior extends ModelBehavior{
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Test5Behavior extends ModelBehavior{
|
class Test5Behavior extends ModelBehavior{
|
||||||
|
|
||||||
public function setup(Model $model, $config = null) {
|
public function setup(Model $model, $config = null) {
|
||||||
$model->bindModel(
|
$model->bindModel(
|
||||||
array('belongsTo' => array('User'))
|
array('belongsTo' => array('User'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -379,11 +384,13 @@ class Test5Behavior extends ModelBehavior{
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Test6Behavior extends ModelBehavior{
|
class Test6Behavior extends ModelBehavior{
|
||||||
|
|
||||||
public function setup(Model $model, $config = null) {
|
public function setup(Model $model, $config = null) {
|
||||||
$model->bindModel(
|
$model->bindModel(
|
||||||
array('hasAndBelongsToMany' => array('Tag'))
|
array('hasAndBelongsToMany' => array('Tag'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -392,11 +399,13 @@ class Test6Behavior extends ModelBehavior{
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Test7Behavior extends ModelBehavior{
|
class Test7Behavior extends ModelBehavior{
|
||||||
|
|
||||||
public function setup(Model $model, $config = null) {
|
public function setup(Model $model, $config = null) {
|
||||||
$model->bindModel(
|
$model->bindModel(
|
||||||
array('hasOne' => array('Attachment'))
|
array('hasOne' => array('Attachment'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -693,14 +702,12 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
|
|
||||||
$Apple->Child->Behaviors->attach('Test', array('before' => 'modify'));
|
$Apple->Child->Behaviors->attach('Test', array('before' => 'modify'));
|
||||||
$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
|
$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
|
||||||
//$this->assertEquals($expected, $result2);
|
|
||||||
|
|
||||||
$Apple->Child->Behaviors->disable('Test');
|
$Apple->Child->Behaviors->disable('Test');
|
||||||
$result = $Apple->find('all');
|
$result = $Apple->find('all');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$Apple->Child->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
|
$Apple->Child->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
|
||||||
//$this->assertSame($Apple->find('all'), array());
|
|
||||||
|
|
||||||
$Apple->Child->Behaviors->attach('Test', array('after' => 'off'));
|
$Apple->Child->Behaviors->attach('Test', array('after' => 'off'));
|
||||||
$this->assertEquals($Apple->find('all'), $expected);
|
$this->assertEquals($Apple->find('all'), $expected);
|
||||||
|
@ -710,21 +717,9 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
|
|
||||||
$Apple->Child->Behaviors->attach('Test', array('after' => 'test2'));
|
$Apple->Child->Behaviors->attach('Test', array('after' => 'test2'));
|
||||||
$this->assertEquals($Apple->find('all'), $expected);
|
$this->assertEquals($Apple->find('all'), $expected);
|
||||||
|
|
||||||
$Apple->Child->Behaviors->attach('Test', array('after' => 'modify'));
|
|
||||||
$expected = array(
|
|
||||||
array('id' => '1', 'apple_id' => '2', 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '2', 'apple_id' => '1', 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '3', 'apple_id' => '2', 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '4', 'apple_id' => '2', 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '5', 'apple_id' => '5', 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '6', 'apple_id' => '4', 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '7', 'apple_id' => '6', 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
|
|
||||||
);
|
|
||||||
//$this->assertEquals($Apple->find('all'), $expected);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* testBehaviorHasOneFindCallbacks method
|
* testBehaviorHasOneFindCallbacks method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -746,32 +741,10 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
$Apple->Sample->Behaviors->attach('Test', array('before' => 'test'));
|
$Apple->Sample->Behaviors->attach('Test', array('before' => 'test'));
|
||||||
$this->assertSame($Apple->find('all'), $expected);
|
$this->assertSame($Apple->find('all'), $expected);
|
||||||
|
|
||||||
$Apple->Sample->Behaviors->attach('Test', array('before' => 'modify'));
|
|
||||||
$expected2 = array(
|
|
||||||
array(
|
|
||||||
'Apple' => array('id' => 1),
|
|
||||||
'Child' => array(
|
|
||||||
array('id' => 2, 'name' => 'Bright Red Apple', 'mytime' => '22:57:17'))),
|
|
||||||
array(
|
|
||||||
'Apple' => array('id' => 2),
|
|
||||||
'Child' => array(
|
|
||||||
array('id' => 1, 'name' => 'Red Apple 1', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => 3, 'name' => 'green blue', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => 4, 'name' => 'Test Name', 'mytime' => '22:57:17'))),
|
|
||||||
array(
|
|
||||||
'Apple' => array('id' => 3),
|
|
||||||
'Child' => array())
|
|
||||||
);
|
|
||||||
$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
|
|
||||||
//$this->assertEquals($expected, $result2);
|
|
||||||
|
|
||||||
$Apple->Sample->Behaviors->disable('Test');
|
$Apple->Sample->Behaviors->disable('Test');
|
||||||
$result = $Apple->find('all');
|
$result = $Apple->find('all');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$Apple->Sample->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
|
|
||||||
//$this->assertSame($Apple->find('all'), array());
|
|
||||||
|
|
||||||
$Apple->Sample->Behaviors->attach('Test', array('after' => 'off'));
|
$Apple->Sample->Behaviors->attach('Test', array('after' => 'off'));
|
||||||
$this->assertEquals($Apple->find('all'), $expected);
|
$this->assertEquals($Apple->find('all'), $expected);
|
||||||
|
|
||||||
|
@ -780,18 +753,6 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
|
|
||||||
$Apple->Sample->Behaviors->attach('Test', array('after' => 'test2'));
|
$Apple->Sample->Behaviors->attach('Test', array('after' => 'test2'));
|
||||||
$this->assertEquals($Apple->find('all'), $expected);
|
$this->assertEquals($Apple->find('all'), $expected);
|
||||||
|
|
||||||
$Apple->Sample->Behaviors->attach('Test', array('after' => 'modify'));
|
|
||||||
$expected = array(
|
|
||||||
array('id' => '1', 'apple_id' => '2', 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '2', 'apple_id' => '1', 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '3', 'apple_id' => '2', 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '4', 'apple_id' => '2', 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '5', 'apple_id' => '5', 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '6', 'apple_id' => '4', 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '7', 'apple_id' => '6', 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
|
|
||||||
);
|
|
||||||
//$this->assertEquals($Apple->find('all'), $expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -848,18 +809,6 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
|
|
||||||
$Apple->Parent->Behaviors->attach('Test', array('after' => 'test2'));
|
$Apple->Parent->Behaviors->attach('Test', array('after' => 'test2'));
|
||||||
$this->assertEquals($Apple->find('all'), $expected);
|
$this->assertEquals($Apple->find('all'), $expected);
|
||||||
|
|
||||||
$Apple->Parent->Behaviors->attach('Test', array('after' => 'modify'));
|
|
||||||
$expected = array(
|
|
||||||
array('id' => '1', 'apple_id' => '2', 'color' => 'Red 1', 'name' => 'Red Apple 1', 'created' => '2006-11-22 10:38:58', 'date' => '1951-01-04', 'modified' => '2006-12-01 13:31:26', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '2', 'apple_id' => '1', 'color' => 'Bright Red 1', 'name' => 'Bright Red Apple', 'created' => '2006-11-22 10:43:13', 'date' => '2014-01-01', 'modified' => '2006-11-30 18:38:10', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '3', 'apple_id' => '2', 'color' => 'blue green', 'name' => 'green blue', 'created' => '2006-12-25 05:13:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:24', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '4', 'apple_id' => '2', 'color' => 'Blue Green', 'name' => 'Test Name', 'created' => '2006-12-25 05:23:36', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:23:36', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '5', 'apple_id' => '5', 'color' => 'Green', 'name' => 'Blue Green', 'created' => '2006-12-25 05:24:06', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:16', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '6', 'apple_id' => '4', 'color' => 'My new appleOrange', 'name' => 'My new apple', 'created' => '2006-12-25 05:29:39', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:29:39', 'mytime' => '22:57:17'),
|
|
||||||
array('id' => '7', 'apple_id' => '6', 'color' => 'Some wierd color', 'name' => 'Some odd color', 'created' => '2006-12-25 05:34:21', 'date' => '2006-12-25', 'modified' => '2006-12-25 05:34:21', 'mytime' => '22:57:17')
|
|
||||||
);
|
|
||||||
//$this->assertEquals($Apple->find('all'), $expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -968,7 +917,6 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
$this->assertSame(trim(ob_get_clean()), 'beforeDelete success');
|
$this->assertSame(trim(ob_get_clean()), 'beforeDelete success');
|
||||||
$this->assertSame($results, true);
|
$this->assertSame($results, true);
|
||||||
|
|
||||||
|
|
||||||
$Apple->Behaviors->attach('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on'));
|
$Apple->Behaviors->attach('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on'));
|
||||||
ob_start();
|
ob_start();
|
||||||
$results = $Apple->delete(2, false);
|
$results = $Apple->delete(2, false);
|
||||||
|
@ -1190,5 +1138,4 @@ class BehaviorCollectionTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,7 @@ class MyAppSchema extends CakeSchema {
|
||||||
}
|
}
|
||||||
return $this->$var;
|
return $this->$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,6 +220,7 @@ class TestAppSchema extends CakeSchema {
|
||||||
*/
|
*/
|
||||||
public function teardown($version) {
|
public function teardown($version) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -434,6 +436,7 @@ class SchemaCrossDatabaseFixture extends CakeTestFixture {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class SchemaPrefixAuthUser extends CakeTestModel {
|
class SchemaPrefixAuthUser extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name property
|
* name property
|
||||||
*
|
*
|
||||||
|
@ -493,8 +496,8 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function tearDown() {
|
public function tearDown() {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
if (file_exists(TMP . 'tests' . DS .'schema.php')) {
|
if (file_exists(TMP . 'tests' . DS . 'schema.php')) {
|
||||||
unlink(TMP . 'tests' . DS .'schema.php');
|
unlink(TMP . 'tests' . DS . 'schema.php');
|
||||||
}
|
}
|
||||||
unset($this->Schema);
|
unset($this->Schema);
|
||||||
CakePlugin::unload();
|
CakePlugin::unload();
|
||||||
|
@ -570,20 +573,20 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSchemaReadWithAppModel method
|
* testSchemaReadWithAppModel method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSchemaReadWithAppModel() {
|
public function testSchemaReadWithAppModel() {
|
||||||
$connections = ConnectionManager::enumConnectionObjects();
|
$connections = ConnectionManager::enumConnectionObjects();
|
||||||
ConnectionManager::drop('default');
|
ConnectionManager::drop('default');
|
||||||
ConnectionManager::create('default', $connections['test']);
|
ConnectionManager::create('default', $connections['test']);
|
||||||
try {
|
try {
|
||||||
$read = $this->Schema->read(array(
|
$read = $this->Schema->read(array(
|
||||||
'connection' => 'default',
|
'connection' => 'default',
|
||||||
'name' => 'TestApp',
|
'name' => 'TestApp',
|
||||||
'models' => array('AppModel')
|
'models' => array('AppModel')
|
||||||
));
|
));
|
||||||
} catch(MissingTableException $mte) {
|
} catch(MissingTableException $mte) {
|
||||||
ConnectionManager::drop('default');
|
ConnectionManager::drop('default');
|
||||||
|
@ -632,7 +635,6 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
));
|
));
|
||||||
unset($read['tables']['missing']);
|
unset($read['tables']['missing']);
|
||||||
$this->assertTrue(isset($read['tables']['auth_users']), 'auth_users key missing %s');
|
$this->assertTrue(isset($read['tables']['auth_users']), 'auth_users key missing %s');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -699,14 +701,15 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
$config = ConnectionManager::enumConnectionObjects();
|
$config = ConnectionManager::enumConnectionObjects();
|
||||||
$this->skipIf(
|
$this->skipIf(
|
||||||
!isset($config['test']) || !isset($config['test2']),
|
!isset($config['test']) || !isset($config['test2']),
|
||||||
'Primary and secondary test databases not configured, skipping cross-database join tests.'
|
'Primary and secondary test databases not configured, ' .
|
||||||
. ' To run these tests, you must define $test and $test2 in your database configuration.'
|
'skipping cross-database join tests. ' .
|
||||||
|
'To run these tests, you must define $test and $test2 in your database configuration.'
|
||||||
);
|
);
|
||||||
|
|
||||||
$db2 = ConnectionManager::getDataSource('test2');
|
$db = ConnectionManager::getDataSource('test2');
|
||||||
$fixture = new SchemaCrossDatabaseFixture();
|
$fixture = new SchemaCrossDatabaseFixture();
|
||||||
$fixture->create($db2);
|
$fixture->create($db);
|
||||||
$fixture->insert($db2);
|
$fixture->insert($db);
|
||||||
|
|
||||||
$read = $this->Schema->read(array(
|
$read = $this->Schema->read(array(
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
|
@ -726,7 +729,7 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
$this->assertFalse(isset($read['tables']['posts']), 'Posts should not appear');
|
$this->assertFalse(isset($read['tables']['posts']), 'Posts should not appear');
|
||||||
$this->assertTrue(isset($read['tables']['cross_database']));
|
$this->assertTrue(isset($read['tables']['cross_database']));
|
||||||
|
|
||||||
$fixture->drop($db2);
|
$fixture->drop($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -755,11 +758,15 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testSchemaWrite() {
|
public function testSchemaWrite() {
|
||||||
$write = $this->Schema->write(array('name' => 'MyOtherApp', 'tables' => $this->Schema->tables, 'path' => TMP . 'tests'));
|
$write = $this->Schema->write(array(
|
||||||
$file = file_get_contents(TMP . 'tests' . DS .'schema.php');
|
'name' => 'MyOtherApp',
|
||||||
|
'tables' => $this->Schema->tables,
|
||||||
|
'path' => TMP . 'tests'
|
||||||
|
));
|
||||||
|
$file = file_get_contents(TMP . 'tests' . DS . 'schema.php');
|
||||||
$this->assertEquals($write, $file);
|
$this->assertEquals($write, $file);
|
||||||
|
|
||||||
require_once( TMP . 'tests' . DS .'schema.php');
|
require_once TMP . 'tests' . DS . 'schema.php';
|
||||||
$OtherSchema = new MyOtherAppSchema();
|
$OtherSchema = new MyOtherAppSchema();
|
||||||
$this->assertEquals($this->Schema->tables, $OtherSchema->tables);
|
$this->assertEquals($this->Schema->tables, $OtherSchema->tables);
|
||||||
}
|
}
|
||||||
|
@ -807,21 +814,21 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
$tables = array(
|
$tables = array(
|
||||||
'missing' => array(
|
'missing' => array(
|
||||||
'categories' => array(
|
'categories' => array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
|
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
||||||
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
|
'modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
||||||
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100),
|
'name' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100),
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||||
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
|
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'ratings' => array(
|
'ratings' => array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL),
|
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => null),
|
||||||
'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL),
|
'model' => array('type' => 'varchar', 'null' => false, 'default' => null),
|
||||||
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL),
|
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => null),
|
||||||
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
|
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
||||||
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
|
'modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||||
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
|
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
|
||||||
)
|
)
|
||||||
|
@ -830,12 +837,12 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'ratings' => array(
|
'ratings' => array(
|
||||||
'add' => array(
|
'add' => array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'after' => 'id'),
|
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => null, 'after' => 'id'),
|
||||||
'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL, 'after' => 'foreign_key'),
|
'model' => array('type' => 'varchar', 'null' => false, 'default' => null, 'after' => 'foreign_key'),
|
||||||
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL, 'after' => 'model'),
|
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => null, 'after' => 'model'),
|
||||||
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL, 'after' => 'value'),
|
'created' => array('type' => 'datetime', 'null' => false, 'default' => null, 'after' => 'value'),
|
||||||
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL, 'after' => 'created'),
|
'modified' => array('type' => 'datetime', 'null' => false, 'default' => null, 'after' => 'created'),
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
|
||||||
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
|
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
|
||||||
)
|
)
|
||||||
|
@ -852,13 +859,13 @@ class CakeSchemaTest extends CakeTestCase {
|
||||||
public function testCompareEmptyStringAndNull() {
|
public function testCompareEmptyStringAndNull() {
|
||||||
$One = new CakeSchema(array(
|
$One = new CakeSchema(array(
|
||||||
'posts' => array(
|
'posts' => array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'null' => false, 'default' => '')
|
'name' => array('type' => 'string', 'null' => false, 'default' => '')
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$Two = new CakeSchema(array(
|
$Two = new CakeSchema(array(
|
||||||
'posts' => array(
|
'posts' => array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'null' => false, 'default' => null)
|
'name' => array('type' => 'string', 'null' => false, 'default' => null)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
|
@ -208,8 +208,8 @@ class ConnectionManagerTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testLoadDataSource() {
|
public function testLoadDataSource() {
|
||||||
$connections = array(
|
$connections = array(
|
||||||
array('classname' => 'Mysql', 'filename' => 'Mysql', 'package' => 'Database'),
|
array('classname' => 'Mysql', 'filename' => 'Mysql', 'package' => 'Database'),
|
||||||
array('classname' => 'Postgres', 'filename' => 'Postgres', 'package' => 'Database'),
|
array('classname' => 'Postgres', 'filename' => 'Postgres', 'package' => 'Database'),
|
||||||
array('classname' => 'Sqlite', 'filename' => 'Sqlite', 'package' => 'Database'),
|
array('classname' => 'Sqlite', 'filename' => 'Sqlite', 'package' => 'Database'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ require_once dirname(dirname(dirname(__FILE__))) . DS . 'models.php';
|
||||||
* @package Cake.Test.Case.Model.Datasource.Database
|
* @package Cake.Test.Case.Model.Datasource.Database
|
||||||
*/
|
*/
|
||||||
class MysqlTest extends CakeTestCase {
|
class MysqlTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* autoFixtures property
|
* autoFixtures property
|
||||||
*
|
*
|
||||||
|
@ -267,7 +268,6 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Dbo->rawQuery('DROP TABLE ' . $name);
|
$this->Dbo->rawQuery('DROP TABLE ' . $name);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$name = $this->Dbo->fullTableName('with_a_key');
|
$name = $this->Dbo->fullTableName('with_a_key');
|
||||||
$this->Dbo->rawQuery('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id), KEY `pointless_bool` ( `bool` ));');
|
$this->Dbo->rawQuery('CREATE TABLE ' . $name . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id), KEY `pointless_bool` ( `bool` ));');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -370,8 +370,8 @@ class MysqlTest extends CakeTestCase {
|
||||||
'Column_name' => 'id',
|
'Column_name' => 'id',
|
||||||
'Collation' => 'A',
|
'Collation' => 'A',
|
||||||
'Cardinality' => '0',
|
'Cardinality' => '0',
|
||||||
'Sub_part' => NULL,
|
'Sub_part' => null,
|
||||||
'Packed' => NULL,
|
'Packed' => null,
|
||||||
'Null' => '',
|
'Null' => '',
|
||||||
'Index_type' => 'BTREE',
|
'Index_type' => 'BTREE',
|
||||||
'Comment' => ''
|
'Comment' => ''
|
||||||
|
@ -383,9 +383,9 @@ class MysqlTest extends CakeTestCase {
|
||||||
'Seq_in_index' => '1',
|
'Seq_in_index' => '1',
|
||||||
'Column_name' => 'bool',
|
'Column_name' => 'bool',
|
||||||
'Collation' => 'A',
|
'Collation' => 'A',
|
||||||
'Cardinality' => NULL,
|
'Cardinality' => null,
|
||||||
'Sub_part' => NULL,
|
'Sub_part' => null,
|
||||||
'Packed' => NULL,
|
'Packed' => null,
|
||||||
'Null' => 'YES',
|
'Null' => 'YES',
|
||||||
'Index_type' => 'BTREE',
|
'Index_type' => 'BTREE',
|
||||||
'Comment' => ''
|
'Comment' => ''
|
||||||
|
@ -397,9 +397,9 @@ class MysqlTest extends CakeTestCase {
|
||||||
'Seq_in_index' => '1',
|
'Seq_in_index' => '1',
|
||||||
'Column_name' => 'small_int',
|
'Column_name' => 'small_int',
|
||||||
'Collation' => 'A',
|
'Collation' => 'A',
|
||||||
'Cardinality' => NULL,
|
'Cardinality' => null,
|
||||||
'Sub_part' => NULL,
|
'Sub_part' => null,
|
||||||
'Packed' => NULL,
|
'Packed' => null,
|
||||||
'Null' => 'YES',
|
'Null' => 'YES',
|
||||||
'Index_type' => 'BTREE',
|
'Index_type' => 'BTREE',
|
||||||
'Comment' => ''
|
'Comment' => ''
|
||||||
|
@ -411,9 +411,9 @@ class MysqlTest extends CakeTestCase {
|
||||||
'Seq_in_index' => '1',
|
'Seq_in_index' => '1',
|
||||||
'Column_name' => 'bool',
|
'Column_name' => 'bool',
|
||||||
'Collation' => 'A',
|
'Collation' => 'A',
|
||||||
'Cardinality' => NULL,
|
'Cardinality' => null,
|
||||||
'Sub_part' => NULL,
|
'Sub_part' => null,
|
||||||
'Packed' => NULL,
|
'Packed' => null,
|
||||||
'Null' => 'YES',
|
'Null' => 'YES',
|
||||||
'Index_type' => 'BTREE',
|
'Index_type' => 'BTREE',
|
||||||
'Comment' => ''
|
'Comment' => ''
|
||||||
|
@ -425,9 +425,9 @@ class MysqlTest extends CakeTestCase {
|
||||||
'Seq_in_index' => '2',
|
'Seq_in_index' => '2',
|
||||||
'Column_name' => 'small_int',
|
'Column_name' => 'small_int',
|
||||||
'Collation' => 'A',
|
'Collation' => 'A',
|
||||||
'Cardinality' => NULL,
|
'Cardinality' => null,
|
||||||
'Sub_part' => NULL,
|
'Sub_part' => null,
|
||||||
'Packed' => NULL,
|
'Packed' => null,
|
||||||
'Null' => 'YES',
|
'Null' => 'YES',
|
||||||
'Index_type' => 'BTREE',
|
'Index_type' => 'BTREE',
|
||||||
'Comment' => ''
|
'Comment' => ''
|
||||||
|
@ -442,7 +442,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
->will($this->returnValue($resultMock));
|
->will($this->returnValue($resultMock));
|
||||||
|
|
||||||
foreach ($columnData as $i => $data) {
|
foreach ($columnData as $i => $data) {
|
||||||
$resultMock->expects($this->at($i))->method('fetch')->will($this->returnValue((object) $data));
|
$resultMock->expects($this->at($i))->method('fetch')->will($this->returnValue((object)$data));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $mockDbo->index($name, false);
|
$result = $mockDbo->index($name, false);
|
||||||
|
@ -512,7 +512,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Dbo->cacheSources = $this->Dbo->testing = false;
|
$this->Dbo->cacheSources = $this->Dbo->testing = false;
|
||||||
$table = $this->Dbo->fullTableName('altertest');
|
$table = $this->Dbo->fullTableName('altertest');
|
||||||
|
|
||||||
$schema1 = new CakeSchema(array(
|
$schemaA = new CakeSchema(array(
|
||||||
'name' => 'AlterTest1',
|
'name' => 'AlterTest1',
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
'altertest' => array(
|
'altertest' => array(
|
||||||
|
@ -521,7 +521,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
'group1' => array('type' => 'integer', 'null' => true),
|
'group1' => array('type' => 'integer', 'null' => true),
|
||||||
'group2' => array('type' => 'integer', 'null' => true)
|
'group2' => array('type' => 'integer', 'null' => true)
|
||||||
)));
|
)));
|
||||||
$result = $this->Dbo->createSchema($schema1);
|
$result = $this->Dbo->createSchema($schemaA);
|
||||||
$this->assertContains('`id` int(11) DEFAULT 0 NOT NULL,', $result);
|
$this->assertContains('`id` int(11) DEFAULT 0 NOT NULL,', $result);
|
||||||
$this->assertContains('`name` varchar(50) NOT NULL,', $result);
|
$this->assertContains('`name` varchar(50) NOT NULL,', $result);
|
||||||
$this->assertContains('`group1` int(11) DEFAULT NULL', $result);
|
$this->assertContains('`group1` int(11) DEFAULT NULL', $result);
|
||||||
|
@ -531,7 +531,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$query = $this->Dbo->getConnection()->prepare($result);
|
$query = $this->Dbo->getConnection()->prepare($result);
|
||||||
$this->assertEquals($result, $query->queryString);
|
$this->assertEquals($result, $query->queryString);
|
||||||
|
|
||||||
$schema2 = new CakeSchema(array(
|
$schemaB = new CakeSchema(array(
|
||||||
'name' => 'AlterTest2',
|
'name' => 'AlterTest2',
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
'altertest' => array(
|
'altertest' => array(
|
||||||
|
@ -546,7 +546,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
'PRIMARY' => array('column' => 'id', 'unique' => 1))
|
'PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$result = $this->Dbo->alterSchema($schema2->compare($schema1));
|
$result = $this->Dbo->alterSchema($schemaB->compare($schemaA));
|
||||||
$this->assertContains("ALTER TABLE $table", $result);
|
$this->assertContains("ALTER TABLE $table", $result);
|
||||||
$this->assertContains('ADD KEY name_idx (`name`),', $result);
|
$this->assertContains('ADD KEY name_idx (`name`),', $result);
|
||||||
$this->assertContains('ADD KEY group_idx (`group1`),', $result);
|
$this->assertContains('ADD KEY group_idx (`group1`),', $result);
|
||||||
|
@ -558,7 +558,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertEquals($result, $query->queryString);
|
$this->assertEquals($result, $query->queryString);
|
||||||
|
|
||||||
// Change three indexes, delete one and add another one
|
// Change three indexes, delete one and add another one
|
||||||
$schema3 = new CakeSchema(array(
|
$schemaC = new CakeSchema(array(
|
||||||
'name' => 'AlterTest3',
|
'name' => 'AlterTest3',
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
'altertest' => array(
|
'altertest' => array(
|
||||||
|
@ -573,7 +573,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
'id_name_idx' => array('column' => array('id', 'name'), 'unique' => 0))
|
'id_name_idx' => array('column' => array('id', 'name'), 'unique' => 0))
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$result = $this->Dbo->alterSchema($schema3->compare($schema2));
|
$result = $this->Dbo->alterSchema($schemaC->compare($schemaB));
|
||||||
$this->assertContains("ALTER TABLE $table", $result);
|
$this->assertContains("ALTER TABLE $table", $result);
|
||||||
$this->assertContains('DROP PRIMARY KEY,', $result);
|
$this->assertContains('DROP PRIMARY KEY,', $result);
|
||||||
$this->assertContains('DROP KEY name_idx,', $result);
|
$this->assertContains('DROP KEY name_idx,', $result);
|
||||||
|
@ -588,10 +588,10 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertEquals($result, $query->queryString);
|
$this->assertEquals($result, $query->queryString);
|
||||||
|
|
||||||
// Compare us to ourself.
|
// Compare us to ourself.
|
||||||
$this->assertEquals($schema3->compare($schema3), array());
|
$this->assertEquals($schemaC->compare($schemaC), array());
|
||||||
|
|
||||||
// Drop the indexes
|
// Drop the indexes
|
||||||
$result = $this->Dbo->alterSchema($schema1->compare($schema3));
|
$result = $this->Dbo->alterSchema($schemaA->compare($schemaC));
|
||||||
|
|
||||||
$this->assertContains("ALTER TABLE $table", $result);
|
$this->assertContains("ALTER TABLE $table", $result);
|
||||||
$this->assertContains('DROP KEY name_idx,', $result);
|
$this->assertContains('DROP KEY name_idx,', $result);
|
||||||
|
@ -628,7 +628,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
public function testAlteringTableParameters() {
|
public function testAlteringTableParameters() {
|
||||||
$this->Dbo->cacheSources = $this->Dbo->testing = false;
|
$this->Dbo->cacheSources = $this->Dbo->testing = false;
|
||||||
|
|
||||||
$schema1 = new CakeSchema(array(
|
$schemaA = new CakeSchema(array(
|
||||||
'name' => 'AlterTest1',
|
'name' => 'AlterTest1',
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
'altertest' => array(
|
'altertest' => array(
|
||||||
|
@ -641,8 +641,8 @@ class MysqlTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$this->Dbo->rawQuery($this->Dbo->createSchema($schema1));
|
$this->Dbo->rawQuery($this->Dbo->createSchema($schemaA));
|
||||||
$schema2 = new CakeSchema(array(
|
$schemaB = new CakeSchema(array(
|
||||||
'name' => 'AlterTest1',
|
'name' => 'AlterTest1',
|
||||||
'connection' => 'test',
|
'connection' => 'test',
|
||||||
'altertest' => array(
|
'altertest' => array(
|
||||||
|
@ -655,7 +655,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$result = $this->Dbo->alterSchema($schema2->compare($schema1));
|
$result = $this->Dbo->alterSchema($schemaB->compare($schemaA));
|
||||||
$this->assertContains('DEFAULT CHARSET=utf8', $result);
|
$this->assertContains('DEFAULT CHARSET=utf8', $result);
|
||||||
$this->assertContains('ENGINE=InnoDB', $result);
|
$this->assertContains('ENGINE=InnoDB', $result);
|
||||||
$this->assertContains('COLLATE=utf8_general_ci', $result);
|
$this->assertContains('COLLATE=utf8_general_ci', $result);
|
||||||
|
@ -666,7 +666,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertEquals($result['Engine'], 'InnoDB');
|
$this->assertEquals($result['Engine'], 'InnoDB');
|
||||||
$this->assertEquals($result['charset'], 'utf8');
|
$this->assertEquals($result['charset'], 'utf8');
|
||||||
|
|
||||||
$this->Dbo->rawQuery($this->Dbo->dropSchema($schema1));
|
$this->Dbo->rawQuery($this->Dbo->dropSchema($schemaA));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -828,7 +828,6 @@ class MysqlTest extends CakeTestCase {
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
$this->Dbo->execute($this->Dbo->createSchema($schema));
|
$this->Dbo->execute($this->Dbo->createSchema($schema));
|
||||||
$model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
|
$model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
|
||||||
$result = $model->getDataSource()->describe($model);
|
$result = $model->getDataSource()->describe($model);
|
||||||
|
@ -932,7 +931,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertEquals($result, array('`Article`.`id`'));
|
$this->assertEquals($result, array('`Article`.`id`'));
|
||||||
|
|
||||||
$test->expects($this->at(0))->method('execute')
|
$test->expects($this->at(0))->method('execute')
|
||||||
->with('SELECT `Article`.`id` FROM ' . $test->fullTableName('articles'). ' AS `Article` WHERE 1 = 1');
|
->with('SELECT `Article`.`id` FROM ' . $test->fullTableName('articles') . ' AS `Article` WHERE 1 = 1');
|
||||||
|
|
||||||
$result = $test->read($this->Model, array(
|
$result = $test->read($this->Model, array(
|
||||||
'fields' => $this->Model->escapeField(),
|
'fields' => $this->Model->escapeField(),
|
||||||
|
@ -1097,7 +1096,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function _scrubQueryData($data) {
|
protected function _scrubQueryData($data) {
|
||||||
static $base = null;
|
static $base = null;
|
||||||
if ($base === null) {
|
if ($base === null) {
|
||||||
$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
|
$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
|
||||||
|
@ -1243,7 +1242,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Featured2, $null, null, null, null, $queryData, false, $null);
|
$result = $this->Dbo->generateAssociationQuery($this->Featured2, $null, null, null, null, $queryData, false, $null);
|
||||||
|
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+'.
|
'/^SELECT\s+`Featured2`\.`id`, `Featured2`\.`article_id`, `Featured2`\.`category_id`, `Featured2`\.`name`,\s+' .
|
||||||
'`ArticleFeatured2`\.`id`, `ArticleFeatured2`\.`title`, `ArticleFeatured2`\.`user_id`, `ArticleFeatured2`\.`published`\s+' .
|
'`ArticleFeatured2`\.`id`, `ArticleFeatured2`\.`title`, `ArticleFeatured2`\.`user_id`, `ArticleFeatured2`\.`published`\s+' .
|
||||||
'FROM\s+\S+`featured2` AS `Featured2`\s+LEFT JOIN\s+\S+`article_featured` AS `ArticleFeatured2`' .
|
'FROM\s+\S+`featured2` AS `Featured2`\s+LEFT JOIN\s+\S+`article_featured` AS `ArticleFeatured2`' .
|
||||||
'\s+ON\s+\(`ArticleFeatured2`.`published` = \'Y\'\s+AND\s+`Featured2`\.`article_featured2_id` = `ArticleFeatured2`\.`id`\)' .
|
'\s+ON\s+\(`ArticleFeatured2`.`published` = \'Y\'\s+AND\s+`Featured2`\.`article_featured2_id` = `ArticleFeatured2`\.`id`\)' .
|
||||||
|
@ -1336,7 +1335,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
|
|
||||||
$testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true);
|
$testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true);
|
||||||
$result = $this->Dbo->buildJoinStatement($queryData['joins'][0]);
|
$result = $this->Dbo->buildJoinStatement($queryData['joins'][0]);
|
||||||
$expected = ' LEFT JOIN ' .$testModel4Table. ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
|
$expected = ' LEFT JOIN ' . $testModel4Table . ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
|
||||||
$this->assertEquals(trim($result), trim($expected));
|
$this->assertEquals(trim($result), trim($expected));
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
||||||
|
@ -1368,7 +1367,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
|
|
||||||
$testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true);
|
$testModel4Table = $this->Dbo->fullTableName($this->Model->TestModel4, true, true);
|
||||||
$result = $this->Dbo->buildJoinStatement($queryData['joins'][0]);
|
$result = $this->Dbo->buildJoinStatement($queryData['joins'][0]);
|
||||||
$expected = ' LEFT JOIN ' .$testModel4Table. ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
|
$expected = ' LEFT JOIN ' . $testModel4Table . ' AS `TestModel4` ON (`TestModel5`.`test_model4_id` = `TestModel4`.`id`)';
|
||||||
$this->assertEquals(trim($result), trim($expected));
|
$this->assertEquals(trim($result), trim($expected));
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
||||||
|
@ -1429,19 +1428,19 @@ class MysqlTest extends CakeTestCase {
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet);
|
$result = $this->Dbo->generateAssociationQuery($this->Model, $params['linkModel'], $params['type'], $params['assoc'], $params['assocData'], $queryData, $params['external'], $resultSet);
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^SELECT\s+' .
|
'/^SELECT\s+' .
|
||||||
'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+'.
|
'`TestModel6`\.`id`, `TestModel6`\.`test_model5_id`, `TestModel6`\.`name`, `TestModel6`\.`created`, `TestModel6`\.`updated`\s+' .
|
||||||
'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' .
|
'FROM\s+\S+`test_model6` AS `TestModel6`\s+WHERE\s+' .
|
||||||
'`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)\s*'.
|
'`TestModel6`.`test_model5_id`\s+=\s+\({\$__cakeID__\$}\)\s*' .
|
||||||
'LIMIT \d*'.
|
'LIMIT \d*' .
|
||||||
'\s*$/', $result
|
'\s*$/', $result
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
$result = $this->Dbo->generateAssociationQuery($this->Model, $null, null, null, null, $queryData, false, $null);
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
'/^SELECT\s+'.
|
'/^SELECT\s+' .
|
||||||
'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+'.
|
'`TestModel5`\.`id`, `TestModel5`\.`test_model4_id`, `TestModel5`\.`name`, `TestModel5`\.`created`, `TestModel5`\.`updated`\s+' .
|
||||||
'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+'.
|
'FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+' .
|
||||||
'(?:\()?\s*1 = 1\s*(?:\))?'.
|
'(?:\()?\s*1 = 1\s*(?:\))?' .
|
||||||
'\s*$/', $result
|
'\s*$/', $result
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1484,7 +1483,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
$this->_buildRelatedModels($this->Model);
|
$this->_buildRelatedModels($this->Model);
|
||||||
|
|
||||||
$__backup = $this->Model->hasMany['TestModel6'];
|
$backup = $this->Model->hasMany['TestModel6'];
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6']['offset'] = 2;
|
$this->Model->hasMany['TestModel6']['offset'] = 2;
|
||||||
$this->Model->hasMany['TestModel6']['limit'] = 5;
|
$this->Model->hasMany['TestModel6']['limit'] = 5;
|
||||||
|
@ -1508,7 +1507,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
||||||
$this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
$this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6'] = $__backup;
|
$this->Model->hasMany['TestModel6'] = $backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1521,7 +1520,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
$this->_buildRelatedModels($this->Model);
|
$this->_buildRelatedModels($this->Model);
|
||||||
|
|
||||||
$__backup = $this->Model->hasMany['TestModel6'];
|
$backup = $this->Model->hasMany['TestModel6'];
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6']['page'] = 2;
|
$this->Model->hasMany['TestModel6']['page'] = 2;
|
||||||
$this->Model->hasMany['TestModel6']['limit'] = 5;
|
$this->Model->hasMany['TestModel6']['limit'] = 5;
|
||||||
|
@ -1544,7 +1543,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
$this->assertRegExp('/\s+FROM\s+\S+`test_model5` AS `TestModel5`\s+WHERE\s+/', $result);
|
||||||
$this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
$this->assertRegExp('/\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasMany['TestModel6'] = $__backup;
|
$this->Model->hasMany['TestModel6'] = $backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1763,7 +1762,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
$this->_buildRelatedModels($this->Model);
|
$this->_buildRelatedModels($this->Model);
|
||||||
|
|
||||||
$__backup = $this->Model->hasAndBelongsToMany['TestModel7'];
|
$backup = $this->Model->hasAndBelongsToMany['TestModel7'];
|
||||||
|
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2;
|
$this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2;
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
||||||
|
@ -1786,7 +1785,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
$this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7'] = $__backup;
|
$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1799,7 +1798,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Model->schema();
|
$this->Model->schema();
|
||||||
$this->_buildRelatedModels($this->Model);
|
$this->_buildRelatedModels($this->Model);
|
||||||
|
|
||||||
$__backup = $this->Model->hasAndBelongsToMany['TestModel7'];
|
$backup = $this->Model->hasAndBelongsToMany['TestModel7'];
|
||||||
|
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2;
|
$this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2;
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
$this->Model->hasAndBelongsToMany['TestModel7']['limit'] = 5;
|
||||||
|
@ -1822,7 +1821,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
$this->assertRegExp('/^SELECT\s+`TestModel4`\.`id`, `TestModel4`\.`name`, `TestModel4`\.`created`, `TestModel4`\.`updated`\s+/', $result);
|
||||||
$this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
$this->assertRegExp('/\s+FROM\s+\S+`test_model4` AS `TestModel4`\s+WHERE\s+(?:\()?1\s+=\s+1(?:\))?\s*$/', $result);
|
||||||
|
|
||||||
$this->Model->hasAndBelongsToMany['TestModel7'] = $__backup;
|
$this->Model->hasAndBelongsToMany['TestModel7'] = $backup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1976,7 +1975,6 @@ class MysqlTest extends CakeTestCase {
|
||||||
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\' AND `Member`.`user` LIKE \'mariano.iglesias%\'';
|
$expected = ' WHERE `Member`.`email` = \'mariano@cricava.com\' AND `Member`.`user` LIKE \'mariano.iglesias%\'';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
|
$result = $this->Dbo->conditions('Member.email = "mariano@cricava.com" AND Member.user LIKE "mariano.iglesias%"');
|
||||||
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
|
$expected = ' WHERE `Member`.`email` = "mariano@cricava.com" AND `Member`.`user` LIKE "mariano.iglesias%"';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
@ -2125,7 +2123,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$expected = " WHERE MAX(`Post`.`rating`) > '50'";
|
$expected = " WHERE MAX(`Post`.`rating`) > '50'";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $this->Dbo->conditions(array('lower(Article.title)' => 'secrets'));
|
$result = $this->Dbo->conditions(array('lower(Article.title)' => 'secrets'));
|
||||||
$expected = " WHERE lower(`Article`.`title`) = 'secrets'";
|
$expected = " WHERE lower(`Article`.`title`) = 'secrets'";
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
@ -2943,13 +2941,12 @@ class MysqlTest extends CakeTestCase {
|
||||||
|
|
||||||
$modelTable = $this->Dbo->fullTableName($this->Model);
|
$modelTable = $this->Dbo->fullTableName($this->Model);
|
||||||
$this->Dbo->expects($this->at(1))->method('execute')
|
$this->Dbo->expects($this->at(1))->method('execute')
|
||||||
->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' .$modelTable. ' AS `TestModel` WHERE `TestModel`.`name` = \'harry\'');
|
->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' . $modelTable . ' AS `TestModel` WHERE `TestModel`.`name` = \'harry\'');
|
||||||
$this->Dbo->expects($this->at(2))->method('execute')
|
$this->Dbo->expects($this->at(2))->method('execute')
|
||||||
->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' .$modelTable. ' AS `TestModel` WHERE 1 = 1');
|
->with('SELECT COUNT(`TestModel`.`id`) AS count FROM ' . $modelTable . ' AS `TestModel` WHERE 1 = 1');
|
||||||
|
|
||||||
$this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry'));
|
$this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry'));
|
||||||
$this->Dbo->hasAny($this->Model, array());
|
$this->Dbo->hasAny($this->Model, array());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3205,7 +3202,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
|
|
||||||
$conditions = array('comment_count >' => 2);
|
$conditions = array('comment_count >' => 2);
|
||||||
$query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
|
$query = 'SELECT ' . join(',', $this->Dbo->fields($Article, null, array('id', 'comment_count'))) .
|
||||||
' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
|
' FROM ' . $this->Dbo->fullTableName($Article) . ' Article ' . $this->Dbo->conditions($conditions, true, true, $Article);
|
||||||
$result = $this->Dbo->fetchAll($query);
|
$result = $this->Dbo->fetchAll($query);
|
||||||
$expected = array(array(
|
$expected = array(array(
|
||||||
'Article' => array('id' => 1, 'comment_count' => 4)
|
'Article' => array('id' => 1, 'comment_count' => 4)
|
||||||
|
@ -3308,8 +3305,7 @@ class MysqlTest extends CakeTestCase {
|
||||||
$data = array(2, 2.2);
|
$data = array(2, 2.2);
|
||||||
$this->assertEquals($this->Dbo->introspectType($data), 'integer');
|
$this->assertEquals($this->Dbo->introspectType($data), 'integer');
|
||||||
|
|
||||||
|
// null
|
||||||
// NULL
|
|
||||||
$result = $this->Dbo->value(null, 'boolean');
|
$result = $this->Dbo->value(null, 'boolean');
|
||||||
$this->assertEquals($result, 'NULL');
|
$this->assertEquals($result, 'NULL');
|
||||||
|
|
||||||
|
@ -3317,7 +3313,6 @@ class MysqlTest extends CakeTestCase {
|
||||||
$result = $this->Dbo->value('', 'boolean');
|
$result = $this->Dbo->value('', 'boolean');
|
||||||
$this->assertEquals($result, "'0'");
|
$this->assertEquals($result, "'0'");
|
||||||
|
|
||||||
|
|
||||||
// BOOLEAN
|
// BOOLEAN
|
||||||
$result = $this->Dbo->value('true', 'boolean');
|
$result = $this->Dbo->value('true', 'boolean');
|
||||||
$this->assertEquals($result, "'1'");
|
$this->assertEquals($result, "'1'");
|
||||||
|
@ -3519,7 +3514,6 @@ class MysqlTest extends CakeTestCase {
|
||||||
$this->Dbo->update($Article, array('field1'), array('value1'));
|
$this->Dbo->update($Article, array('field1'), array('value1'));
|
||||||
$this->Dbo->update($Article, array('field1'), array('2'), '2=2');
|
$this->Dbo->update($Article, array('field1'), array('2'), '2=2');
|
||||||
$this->Dbo->update($Article, array('field1'), array("'value'"), array('index' => 'val'));
|
$this->Dbo->update($Article, array('field1'), array("'value'"), array('index' => 'val'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,6 +56,7 @@ class DboPostgresTestDb extends Postgres {
|
||||||
public function getLastQuery() {
|
public function getLastQuery() {
|
||||||
return $this->simulated[count($this->simulated) - 1];
|
return $this->simulated[count($this->simulated) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,26 +124,27 @@ class PostgresTestModel extends Model {
|
||||||
*/
|
*/
|
||||||
public function schema($field = false) {
|
public function schema($field = false) {
|
||||||
return array(
|
return array(
|
||||||
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
|
||||||
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
|
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
|
||||||
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
|
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
|
||||||
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,13 +175,14 @@ class PostgresClientTestModel extends Model {
|
||||||
*/
|
*/
|
||||||
public function schema($field = false) {
|
public function schema($field = false) {
|
||||||
return array(
|
return array(
|
||||||
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -523,7 +526,7 @@ class PostgresTest extends CakeTestCase {
|
||||||
$db1 = ConnectionManager::getDataSource('test');
|
$db1 = ConnectionManager::getDataSource('test');
|
||||||
$db1->cacheSources = false;
|
$db1->cacheSources = false;
|
||||||
|
|
||||||
$db1->rawQuery('CREATE TABLE ' . $db1->fullTableName('datatype_tests') . ' (
|
$db1->rawQuery('CREATE TABLE ' . $db1->fullTableName('datatype_tests') . ' (
|
||||||
id serial NOT NULL,
|
id serial NOT NULL,
|
||||||
"varchar" character varying(40) NOT NULL,
|
"varchar" character varying(40) NOT NULL,
|
||||||
"full_length" character varying NOT NULL,
|
"full_length" character varying NOT NULL,
|
||||||
|
@ -541,12 +544,10 @@ class PostgresTest extends CakeTestCase {
|
||||||
$schema->tables = array('datatype_tests' => $result['tables']['missing']['datatype_tests']);
|
$schema->tables = array('datatype_tests' => $result['tables']['missing']['datatype_tests']);
|
||||||
$result = $db1->createSchema($schema, 'datatype_tests');
|
$result = $db1->createSchema($schema, 'datatype_tests');
|
||||||
|
|
||||||
|
|
||||||
$this->assertNotRegExp('/timestamp DEFAULT/', $result);
|
$this->assertNotRegExp('/timestamp DEFAULT/', $result);
|
||||||
$this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
|
$this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
|
||||||
$this->assertRegExp('/timestamp\s*,/', $result);
|
$this->assertRegExp('/timestamp\s*,/', $result);
|
||||||
|
|
||||||
|
|
||||||
$db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests'));
|
$db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests'));
|
||||||
|
|
||||||
$db1->query($result);
|
$db1->query($result);
|
||||||
|
@ -731,7 +732,7 @@ class PostgresTest extends CakeTestCase {
|
||||||
$this->Dbo->query($this->Dbo->dropSchema($schema1));
|
$this->Dbo->query($this->Dbo->dropSchema($schema1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Test it is possible to use virtual field with postgresql
|
* Test it is possible to use virtual field with postgresql
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -783,8 +784,11 @@ class PostgresTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test it is possible to do a SELECT COUNT(DISTINCT Model.field) query in postgres and it gets correctly quoted
|
* Test it is possible to do a SELECT COUNT(DISTINCT Model.field)
|
||||||
*/
|
* query in postgres and it gets correctly quoted
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function testQuoteDistinctInFunction() {
|
public function testQuoteDistinctInFunction() {
|
||||||
$this->loadFixtures('Article');
|
$this->loadFixtures('Article');
|
||||||
$Article = new Article;
|
$Article = new Article;
|
||||||
|
@ -860,16 +864,16 @@ class PostgresTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testEncoding() {
|
public function testEncoding() {
|
||||||
$result = $this->Dbo->setEncoding('UTF8');
|
$result = $this->Dbo->setEncoding('UTF8');
|
||||||
$this->assertTrue($result) ;
|
$this->assertTrue($result);
|
||||||
|
|
||||||
$result = $this->Dbo->getEncoding();
|
$result = $this->Dbo->getEncoding();
|
||||||
$this->assertEquals('UTF8', $result) ;
|
$this->assertEquals('UTF8', $result);
|
||||||
|
|
||||||
$result = $this->Dbo->setEncoding('EUC_JP'); /* 'EUC_JP' is right character code name in PostgreSQL */
|
$result = $this->Dbo->setEncoding('EUC_JP'); /* 'EUC_JP' is right character code name in PostgreSQL */
|
||||||
$this->assertTrue($result) ;
|
$this->assertTrue($result);
|
||||||
|
|
||||||
$result = $this->Dbo->getEncoding();
|
$result = $this->Dbo->getEncoding();
|
||||||
$this->assertEquals('EUC_JP', $result) ;
|
$this->assertEquals('EUC_JP', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,6 +55,7 @@ class DboSqliteTestDb extends Sqlite {
|
||||||
public function getLastQuery() {
|
public function getLastQuery() {
|
||||||
return $this->simulated[count($this->simulated) - 1];
|
return $this->simulated[count($this->simulated) - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -104,6 +104,7 @@ class SqlserverTestDb extends Sqlserver {
|
||||||
public function describe($model) {
|
public function describe($model) {
|
||||||
return empty($this->describe) ? parent::describe($model) : $this->describe;
|
return empty($this->describe) ? parent::describe($model) : $this->describe;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,24 +134,24 @@ class SqlserverTestModel extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $_schema = array(
|
protected $_schema = array(
|
||||||
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8', 'key' => 'primary'),
|
||||||
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
|
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
|
||||||
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
|
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
|
||||||
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,6 +177,7 @@ class SqlserverTestModel extends CakeTestModel {
|
||||||
public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
|
public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
|
||||||
return $conditions;
|
return $conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,6 +186,7 @@ class SqlserverTestModel extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model.Datasource.Database
|
* @package Cake.Test.Case.Model.Datasource.Database
|
||||||
*/
|
*/
|
||||||
class SqlserverClientTestModel extends CakeTestModel {
|
class SqlserverClientTestModel extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name property
|
* name property
|
||||||
*
|
*
|
||||||
|
@ -218,12 +221,14 @@ class SqlserverClientTestModel extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model.Datasource.Database
|
* @package Cake.Test.Case.Model.Datasource.Database
|
||||||
*/
|
*/
|
||||||
class SqlserverTestResultIterator extends ArrayIterator {
|
class SqlserverTestResultIterator extends ArrayIterator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* closeCursor method
|
* closeCursor method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function closeCursor() {}
|
public function closeCursor() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch method
|
* fetch method
|
||||||
|
@ -238,6 +243,7 @@ class SqlserverTestResultIterator extends ArrayIterator {
|
||||||
$this->next();
|
$this->next();
|
||||||
return $current;
|
return $current;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -408,7 +414,7 @@ class SqlserverTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testDescribe() {
|
public function testDescribe() {
|
||||||
$SqlserverTableDescription = new SqlserverTestResultIterator(array(
|
$SqlserverTableDescription = new SqlserverTestResultIterator(array(
|
||||||
(object) array(
|
(object)array(
|
||||||
'Default' => '((0))',
|
'Default' => '((0))',
|
||||||
'Field' => 'count',
|
'Field' => 'count',
|
||||||
'Key' => 0,
|
'Key' => 0,
|
||||||
|
@ -416,7 +422,7 @@ class SqlserverTest extends CakeTestCase {
|
||||||
'Null' => 'NO',
|
'Null' => 'NO',
|
||||||
'Type' => 'integer'
|
'Type' => 'integer'
|
||||||
),
|
),
|
||||||
(object) array(
|
(object)array(
|
||||||
'Default' => '',
|
'Default' => '',
|
||||||
'Field' => 'body',
|
'Field' => 'body',
|
||||||
'Key' => 0,
|
'Key' => 0,
|
||||||
|
@ -424,7 +430,7 @@ class SqlserverTest extends CakeTestCase {
|
||||||
'Null' => 'YES',
|
'Null' => 'YES',
|
||||||
'Type' => 'nvarchar'
|
'Type' => 'nvarchar'
|
||||||
),
|
),
|
||||||
(object) array(
|
(object)array(
|
||||||
'Default' => '',
|
'Default' => '',
|
||||||
'Field' => 'published',
|
'Field' => 'published',
|
||||||
'Key' => 0,
|
'Key' => 0,
|
||||||
|
@ -433,7 +439,7 @@ class SqlserverTest extends CakeTestCase {
|
||||||
'Null' => 'YES',
|
'Null' => 'YES',
|
||||||
'Size' => ''
|
'Size' => ''
|
||||||
),
|
),
|
||||||
(object) array(
|
(object)array(
|
||||||
'Default' => '',
|
'Default' => '',
|
||||||
'Field' => 'id',
|
'Field' => 'id',
|
||||||
'Key' => 1,
|
'Key' => 1,
|
||||||
|
|
|
@ -27,6 +27,7 @@ class MockPDO extends PDO {
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockDataSource extends DataSource {
|
class MockDataSource extends DataSource {
|
||||||
|
@ -49,6 +50,7 @@ class DboTestSource extends DboSource {
|
||||||
public function setConnection($conn) {
|
public function setConnection($conn) {
|
||||||
$this->_connection = $conn;
|
$this->_connection = $conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +111,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
unset($this->Model);
|
unset($this->Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that booleans and null make logical condition strings.
|
* test that booleans and null make logical condition strings.
|
||||||
*
|
*
|
||||||
|
@ -420,7 +421,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$this->assertEquals($data, $expected);
|
$this->assertEquals($data, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testMagicMethodQuerying method
|
* testMagicMethodQuerying method
|
||||||
*
|
*
|
||||||
|
@ -492,7 +492,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$result = $this->db->query('directCall', array(), $this->Model);
|
$result = $this->db->query('directCall', array(), $this->Model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testValue method
|
* testValue method
|
||||||
*
|
*
|
||||||
|
@ -659,7 +658,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$expected = array('query' => 'Error 1', 'affected' => '', 'numRows' => '', 'took' => '');
|
$expected = array('query' => 'Error 1', 'affected' => '', 'numRows' => '', 'took' => '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test getting the query log as an array, setting bind params.
|
* test getting the query log as an array, setting bind params.
|
||||||
*
|
*
|
||||||
|
@ -676,7 +674,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$this->assertEquals($log['log'][1], $expected);
|
$this->assertEquals($log['log'][1], $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that query() returns boolean values from operations like CREATE TABLE
|
* test that query() returns boolean values from operations like CREATE TABLE
|
||||||
*
|
*
|
||||||
|
@ -693,7 +690,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$this->assertTrue($result, 'Query did not return a boolean');
|
$this->assertTrue($result, 'Query did not return a boolean');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test order to generate query order clause for virtual fields
|
* test order to generate query order clause for virtual fields
|
||||||
*
|
*
|
||||||
|
@ -716,8 +712,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test the permutations of fullTableName()
|
* test the permutations of fullTableName()
|
||||||
*
|
*
|
||||||
|
@ -784,7 +778,6 @@ class DboSourceTest extends CakeTestCase {
|
||||||
$this->assertTrue(empty(DboTestSource::$methodCache['fields']), 'Cache not empty');
|
$this->assertTrue(empty(DboTestSource::$methodCache['fields']), 'Cache not empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that group works without a model
|
* Test that group works without a model
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,8 +23,11 @@ App::uses('DatabaseSession', 'Model/Datasource/Session');
|
||||||
class_exists('CakeSession');
|
class_exists('CakeSession');
|
||||||
|
|
||||||
class SessionTestModel extends Model {
|
class SessionTestModel extends Model {
|
||||||
|
|
||||||
public $name = 'SessionTestModel';
|
public $name = 'SessionTestModel';
|
||||||
|
|
||||||
public $useTable = 'sessions';
|
public $useTable = 'sessions';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,4 +185,4 @@ class DatabaseSessionTest extends CakeTestCase {
|
||||||
$storage->gc();
|
$storage->gc();
|
||||||
$this->assertFalse($storage->read('foo'));
|
$this->assertFalse($storage->read('foo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,9 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
|
||||||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
||||||
$this->skipIf(
|
$this->skipIf(
|
||||||
!isset($config['test']) || !isset($config['test2']),
|
!isset($config['test']) || !isset($config['test2']),
|
||||||
'Primary and secondary test databases not configured, skipping cross-database join tests.'
|
'Primary and secondary test databases not configured, ' .
|
||||||
. ' To run these tests, you must define $test and $test2 in your database configuration.'
|
'skipping cross-database join tests.' .
|
||||||
|
' To run these tests, you must define $test and $test2 in your database configuration.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +177,9 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
|
||||||
$config = ConnectionManager::enumConnectionObjects();
|
$config = ConnectionManager::enumConnectionObjects();
|
||||||
$this->skipIf(
|
$this->skipIf(
|
||||||
!isset($config['test']) || !isset($config['test2']) || !isset($config['test_database_three']),
|
!isset($config['test']) || !isset($config['test2']) || !isset($config['test_database_three']),
|
||||||
'Primary, secondary, and tertiary test databases not configured, skipping test.'
|
'Primary, secondary, and tertiary test databases not configured,' .
|
||||||
. ' To run these tests, you must define $test, $test2, and $test_database_three in your database configuration.'
|
' skipping test. To run these tests, you must define ' .
|
||||||
|
'$test, $test2, and $test_database_three in your database configuration.'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->loadFixtures('Player', 'Guild', 'GuildsPlayer', 'Armor', 'ArmorsPlayer');
|
$this->loadFixtures('Player', 'Guild', 'GuildsPlayer', 'Armor', 'ArmorsPlayer');
|
||||||
|
|
|
@ -260,7 +260,6 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that delete() updates the correct records counterCache() records.
|
* test that delete() updates the correct records counterCache() records.
|
||||||
*
|
*
|
||||||
|
@ -688,7 +687,6 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() {
|
public function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() {
|
||||||
|
|
||||||
$this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
|
$this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
|
||||||
$ThePaper = new ThePaper();
|
$ThePaper = new ThePaper();
|
||||||
$ThePaper->id = 1;
|
$ThePaper->id = 1;
|
||||||
|
@ -792,25 +790,26 @@ class ModelDeleteTest extends BaseModelTest {
|
||||||
$this->assertEquals(count($before[0]['Tag']), 2, 'Tag count for Article.id = 1 is incorrect, should be 2 %s');
|
$this->assertEquals(count($before[0]['Tag']), 2, 'Tag count for Article.id = 1 is incorrect, should be 2 %s');
|
||||||
|
|
||||||
// From now on, Tag #1 is only associated with Post #1
|
// From now on, Tag #1 is only associated with Post #1
|
||||||
$submitted_data = array(
|
$submittedData = array(
|
||||||
"Tag" => array("id" => 1, 'tag' => 'tag1'),
|
"Tag" => array("id" => 1, 'tag' => 'tag1'),
|
||||||
"Article" => array(
|
"Article" => array(
|
||||||
"Article" => array(1)
|
"Article" => array(1)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$Tag->save($submitted_data);
|
$Tag->save($submittedData);
|
||||||
|
|
||||||
// One more submission (The other way around) to make sure the reverse save looks good.
|
// One more submission (The other way around) to make sure the reverse save looks good.
|
||||||
$submitted_data = array(
|
$submittedData = array(
|
||||||
"Article" => array("id" => 2, 'title' => 'second article'),
|
"Article" => array("id" => 2, 'title' => 'second article'),
|
||||||
"Tag" => array(
|
"Tag" => array(
|
||||||
"Tag" => array(2, 3)
|
"Tag" => array(2, 3)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// ERROR:
|
// ERROR:
|
||||||
// Postgresql: DELETE FROM "articles_tags" WHERE tag_id IN ('1', '3')
|
// Postgresql: DELETE FROM "articles_tags" WHERE tag_id IN ('1', '3')
|
||||||
// MySQL: DELETE `ArticlesTag` FROM `articles_tags` AS `ArticlesTag` WHERE `ArticlesTag`.`article_id` = 2 AND `ArticlesTag`.`tag_id` IN (1, 3)
|
// MySQL: DELETE `ArticlesTag` FROM `articles_tags` AS `ArticlesTag` WHERE `ArticlesTag`.`article_id` = 2 AND `ArticlesTag`.`tag_id` IN (1, 3)
|
||||||
$Article->save($submitted_data);
|
$Article->save($submittedData);
|
||||||
|
|
||||||
// Want to make sure Article #1 has Tag #1 and Tag #2 still.
|
// Want to make sure Article #1 has Tag #1 and Tag #2 still.
|
||||||
$after = $Article->find("all", array(
|
$after = $Article->find("all", array(
|
||||||
|
|
|
@ -27,18 +27,19 @@ App::uses('DboSource', 'Model/Datasource');
|
||||||
class DboMock extends DboSource {
|
class DboMock extends DboSource {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the $field without modifications
|
* Returns the $field without modifications
|
||||||
*/
|
*/
|
||||||
public function name($field) {
|
public function name($field) {
|
||||||
return $field;
|
return $field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true to fake a database connection
|
* Returns true to fake a database connection
|
||||||
*/
|
*/
|
||||||
public function connect() {
|
public function connect() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -149,8 +150,8 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
*/
|
*/
|
||||||
public function testPkInHabtmLinkModelArticleB() {
|
public function testPkInHabtmLinkModelArticleB() {
|
||||||
$this->loadFixtures('Article', 'Tag', 'ArticlesTag');
|
$this->loadFixtures('Article', 'Tag', 'ArticlesTag');
|
||||||
$TestModel2 = new ArticleB();
|
$TestModel = new ArticleB();
|
||||||
$this->assertEquals($TestModel2->ArticlesTag->primaryKey, 'article_id');
|
$this->assertEquals($TestModel->ArticlesTag->primaryKey, 'article_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +177,7 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
/**
|
/**
|
||||||
* testPkInHabtmLinkModel method
|
* testPkInHabtmLinkModel method
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testPkInHabtmLinkModel() {
|
public function testPkInHabtmLinkModel() {
|
||||||
//Test Nonconformant Models
|
//Test Nonconformant Models
|
||||||
|
@ -186,18 +187,17 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
|
|
||||||
//test conformant models with no PK in the join table
|
//test conformant models with no PK in the join table
|
||||||
$this->loadFixtures('Article', 'Tag');
|
$this->loadFixtures('Article', 'Tag');
|
||||||
$TestModel2 = new Article();
|
$TestModel = new Article();
|
||||||
$this->assertEquals($TestModel2->ArticlesTag->primaryKey, 'article_id');
|
$this->assertEquals($TestModel->ArticlesTag->primaryKey, 'article_id');
|
||||||
|
|
||||||
//test conformant models with PK in join table
|
//test conformant models with PK in join table
|
||||||
$TestModel3 = new Portfolio();
|
$TestModel = new Portfolio();
|
||||||
$this->assertEquals($TestModel3->ItemsPortfolio->primaryKey, 'id');
|
$this->assertEquals($TestModel->ItemsPortfolio->primaryKey, 'id');
|
||||||
|
|
||||||
//test conformant models with PK in join table - join table contains extra field
|
//test conformant models with PK in join table - join table contains extra field
|
||||||
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB');
|
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB');
|
||||||
$TestModel4 = new JoinA();
|
$TestModel = new JoinA();
|
||||||
$this->assertEquals($TestModel4->JoinAsJoinB->primaryKey, 'id');
|
$this->assertEquals($TestModel->JoinAsJoinB->primaryKey, 'id');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -645,7 +645,6 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$expected = 3; // 3 domains belonging to cakephp
|
$expected = 3; // 3 domains belonging to cakephp
|
||||||
$this->assertEquals($expected, count($results['Domain']));
|
$this->assertEquals($expected, count($results['Domain']));
|
||||||
|
|
||||||
|
|
||||||
$Site->id = 2;
|
$Site->id = 2;
|
||||||
$results = $Site->read();
|
$results = $Site->read();
|
||||||
$expected = 2; // 2 domains belonging to markstory
|
$expected = 2; // 2 domains belonging to markstory
|
||||||
|
@ -710,6 +709,102 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
$this->assertEquals($activated['DomainsSite'], $results['Domain'][0]['DomainsSite']);
|
$this->assertEquals($activated['DomainsSite'], $results['Domain'][0]['DomainsSite']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testHABTMKeepExistingAlternateDataFormat
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testHABTMKeepExistingAlternateDataFormat() {
|
||||||
|
$this->loadFixtures('Site', 'Domain', 'DomainsSite');
|
||||||
|
|
||||||
|
$Site = new Site();
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'DomainsSite' => array(
|
||||||
|
'id' => 1,
|
||||||
|
'site_id' => 1,
|
||||||
|
'domain_id' => 1,
|
||||||
|
'active' => true,
|
||||||
|
'created' => '2007-03-17 01:16:23'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'DomainsSite' => array(
|
||||||
|
'id' => 2,
|
||||||
|
'site_id' => 1,
|
||||||
|
'domain_id' => 2,
|
||||||
|
'active' => true,
|
||||||
|
'created' => '2007-03-17 01:16:23'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result = $Site->DomainsSite->find('all', array(
|
||||||
|
'conditions' => array('DomainsSite.site_id' => 1),
|
||||||
|
'fields' => array(
|
||||||
|
'DomainsSite.id',
|
||||||
|
'DomainsSite.site_id',
|
||||||
|
'DomainsSite.domain_id',
|
||||||
|
'DomainsSite.active',
|
||||||
|
'DomainsSite.created'
|
||||||
|
),
|
||||||
|
'order' => 'DomainsSite.id'
|
||||||
|
));
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$time = date('Y-m-d H:i:s');
|
||||||
|
$data = array(
|
||||||
|
'Site' => array(
|
||||||
|
'id' => 1
|
||||||
|
),
|
||||||
|
'Domain' => array(
|
||||||
|
array(
|
||||||
|
'site_id' => 1,
|
||||||
|
'domain_id' => 3,
|
||||||
|
'created' => $time,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'id' => 2,
|
||||||
|
'site_id' => 1,
|
||||||
|
'domain_id' => 2
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$Site->save($data);
|
||||||
|
$expected = array(
|
||||||
|
array(
|
||||||
|
'DomainsSite' => array(
|
||||||
|
'id' => 2,
|
||||||
|
'site_id' => 1,
|
||||||
|
'domain_id' => 2,
|
||||||
|
'active' => true,
|
||||||
|
'created' => '2007-03-17 01:16:23'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'DomainsSite' => array(
|
||||||
|
'id' => 7,
|
||||||
|
'site_id' => 1,
|
||||||
|
'domain_id' => 3,
|
||||||
|
'active' => false,
|
||||||
|
'created' => $time
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$result = $Site->DomainsSite->find('all', array(
|
||||||
|
'conditions' => array('DomainsSite.site_id' => 1),
|
||||||
|
'fields' => array(
|
||||||
|
'DomainsSite.id',
|
||||||
|
'DomainsSite.site_id',
|
||||||
|
'DomainsSite.domain_id',
|
||||||
|
'DomainsSite.active',
|
||||||
|
'DomainsSite.created'
|
||||||
|
),
|
||||||
|
'order' => 'DomainsSite.id'
|
||||||
|
));
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test HABM operations without clobbering existing records #275
|
* test HABM operations without clobbering existing records #275
|
||||||
*
|
*
|
||||||
|
@ -2249,7 +2344,6 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testMultischemaFixture() {
|
public function testMultischemaFixture() {
|
||||||
|
|
||||||
$config = ConnectionManager::enumConnectionObjects();
|
$config = ConnectionManager::enumConnectionObjects();
|
||||||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
||||||
$this->skipIf(!isset($config['test']) || !isset($config['test2']),
|
$this->skipIf(!isset($config['test']) || !isset($config['test2']),
|
||||||
|
@ -2279,7 +2373,6 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testMultischemaFixtureWithThreeDatabases() {
|
public function testMultischemaFixtureWithThreeDatabases() {
|
||||||
|
|
||||||
$config = ConnectionManager::enumConnectionObjects();
|
$config = ConnectionManager::enumConnectionObjects();
|
||||||
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
|
||||||
$this->skipIf(
|
$this->skipIf(
|
||||||
|
|
|
@ -68,7 +68,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$Something->JoinThing->create($joinThingData);
|
$Something->JoinThing->create($joinThingData);
|
||||||
$Something->JoinThing->save();
|
$Something->JoinThing->save();
|
||||||
|
|
||||||
|
@ -347,7 +346,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$result = $this->db->getQueryCache($query, $params);
|
$result = $this->db->getQueryCache($query, $params);
|
||||||
$this->assertFalse($result === false);
|
$this->assertFalse($result === false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6199,17 +6197,20 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'conditions' => array(
|
'conditions' => array(
|
||||||
'user' => 'larry'),
|
'user' => 'larry'
|
||||||
'fields' => NULL,
|
),
|
||||||
|
'fields' => null,
|
||||||
'joins' => array(),
|
'joins' => array(),
|
||||||
'limit' => NULL,
|
'limit' => null,
|
||||||
'offset' => NULL,
|
'offset' => null,
|
||||||
'order' => array(
|
'order' => array(
|
||||||
0 => NULL),
|
0 => null
|
||||||
|
),
|
||||||
'page' => 1,
|
'page' => 1,
|
||||||
'group' => NULL,
|
'group' => null,
|
||||||
'callbacks' => true,
|
'callbacks' => true,
|
||||||
'returnQuery' => true);
|
'returnQuery' => true
|
||||||
|
);
|
||||||
$result = $TestModel->buildQuery('all', array('returnQuery' => true, 'conditions' => array('user' => 'larry')));
|
$result = $TestModel->buildQuery('all', array('returnQuery' => true, 'conditions' => array('user' => 'larry')));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -7736,7 +7737,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEquals($result, $expectation);
|
$this->assertEquals($result, $expectation);
|
||||||
|
|
||||||
|
|
||||||
$Author = ClassRegistry::init('Author');
|
$Author = ClassRegistry::init('Author');
|
||||||
$Author->virtualFields = array(
|
$Author->virtualFields = array(
|
||||||
'full_name' => 'CONCAT(Author.user, " ", Author.id)'
|
'full_name' => 'CONCAT(Author.user, " ", Author.id)'
|
||||||
|
@ -7804,7 +7804,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
$this->assertEquals($Post->getVirtualField('Post.other_field'), $Post->virtualFields['other_field']);
|
$this->assertEquals($Post->getVirtualField('Post.other_field'), $Post->virtualFields['other_field']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that checks for error when NOT condition passed in key and a 1 element array value
|
* test that checks for error when NOT condition passed in key and a 1 element array value
|
||||||
*
|
*
|
||||||
|
@ -7823,9 +7822,8 @@ class ModelReadTest extends BaseModelTest {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertTrue(is_array($result) && !empty($result));
|
$this->assertTrue(is_array($result) && !empty($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test custom find method
|
* test custom find method
|
||||||
|
@ -7845,5 +7843,6 @@ class ModelReadTest extends BaseModelTest {
|
||||||
|
|
||||||
$result = $Article->find('unPublished');
|
$result = $Article->find('unPublished');
|
||||||
$this->assertEquals(1, count($result));
|
$this->assertEquals(1, count($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
'required' => true
|
'required' => true
|
||||||
),
|
),
|
||||||
'or' => true,
|
'or' => true,
|
||||||
'ignore_on_same' => 'id'
|
'ignoreOnSame' => 'id'
|
||||||
);
|
);
|
||||||
$this->assertEquals($TestModel->validatorParams, $expected);
|
$this->assertEquals($TestModel->validatorParams, $expected);
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
|
|
||||||
$this->assertEquals($testResult['Article']['title'], $data['Article']['title']);
|
$this->assertEquals($testResult['Article']['title'], $data['Article']['title']);
|
||||||
$this->assertEquals($testResult['Article']['created'], '2008-01-01 00:00:00');
|
$this->assertEquals($testResult['Article']['created'], '2008-01-01 00:00:00');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -403,7 +402,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$column = '';
|
$column = '';
|
||||||
}
|
}
|
||||||
$column .= $this->db->buildColumn(array('name' => 'child_count', 'type' => 'integer'));
|
$column .= $this->db->buildColumn(array('name' => 'child_count', 'type' => 'integer'));
|
||||||
$this->db->query('ALTER TABLE '. $this->db->fullTableName('category_threads') . ' ADD ' . $column);
|
$this->db->query('ALTER TABLE ' . $this->db->fullTableName('category_threads') . ' ADD ' . $column);
|
||||||
$this->db->flushMethodCache();
|
$this->db->flushMethodCache();
|
||||||
$Category = new CategoryThread();
|
$Category = new CategoryThread();
|
||||||
$result = $Category->updateAll(array('CategoryThread.name' => "'updated'"), array('CategoryThread.parent_id' => 5));
|
$result = $Category->updateAll(array('CategoryThread.name' => "'updated'"), array('CategoryThread.parent_id' => 5));
|
||||||
|
@ -617,7 +616,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = $TestModel->saveField('title', '', true);
|
$result = $TestModel->saveField('title', '', true);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
|
|
||||||
|
|
||||||
$TestModel->recursive = -1;
|
$TestModel->recursive = -1;
|
||||||
$TestModel->id = 1;
|
$TestModel->id = 1;
|
||||||
$result = $TestModel->saveField('user_id', 9999);
|
$result = $TestModel->saveField('user_id', 9999);
|
||||||
|
@ -630,7 +628,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
));
|
));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$this->loadFixtures('Node', 'Dependency');
|
$this->loadFixtures('Node', 'Dependency');
|
||||||
$Node = new Node();
|
$Node = new Node();
|
||||||
$Node->set('id', 1);
|
$Node->set('id', 1);
|
||||||
|
@ -1512,12 +1509,16 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
),
|
),
|
||||||
'Tag' => array(
|
'Tag' => array(
|
||||||
'Tag' => array(1, 2, 3)
|
'Tag' => array(1, 2, 3)
|
||||||
));
|
)
|
||||||
$result = $TestModel->create()
|
);
|
||||||
|
$result = $TestModel->create()
|
||||||
&& $TestModel->save($data, true, array('user_id', 'title', 'published'));
|
&& $TestModel->save($data, true, array('user_id', 'title', 'published'));
|
||||||
$this->assertFalse(empty($result));
|
$this->assertFalse(empty($result));
|
||||||
|
|
||||||
$TestModel->unbindModel(array('belongsTo' => array('User'), 'hasMany' => array('Comment')));
|
$TestModel->unbindModel(array(
|
||||||
|
'belongsTo' => array('User'),
|
||||||
|
'hasMany' => array('Comment')
|
||||||
|
));
|
||||||
$result = $TestModel->read();
|
$result = $TestModel->read();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'Article' => array(
|
'Article' => array(
|
||||||
|
@ -1550,7 +1551,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$this->loadFixtures('JoinA', 'JoinC', 'JoinAC', 'JoinB', 'JoinAB');
|
$this->loadFixtures('JoinA', 'JoinC', 'JoinAC', 'JoinB', 'JoinAB');
|
||||||
$TestModel = new JoinA();
|
$TestModel = new JoinA();
|
||||||
$TestModel->hasBelongsToMany = array('JoinC' => array('unique' => true));
|
$TestModel->hasBelongsToMany = array('JoinC' => array('unique' => true));
|
||||||
|
@ -2133,7 +2133,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
'id' => 3,
|
'id' => 3,
|
||||||
'title' => 'Third Article'
|
'title' => 'Third Article'
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$this->assertEquals($expected, $articles);
|
$this->assertEquals($expected, $articles);
|
||||||
|
|
||||||
$comments = $Comment->find('all', array(
|
$comments = $Comment->find('all', array(
|
||||||
|
@ -2754,7 +2753,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
unset($result[6]['Comment']['created'], $result[6]['Comment']['updated']);
|
unset($result[6]['Comment']['created'], $result[6]['Comment']['updated']);
|
||||||
$this->assertEquals($result[6]['Comment'], $expected);
|
$this->assertEquals($result[6]['Comment'], $expected);
|
||||||
|
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'id' => '2',
|
'id' => '2',
|
||||||
'comment_id' => '7',
|
'comment_id' => '7',
|
||||||
|
@ -2878,7 +2876,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
|
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
|
||||||
$data = array(
|
$data = array(
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
|
@ -4545,7 +4542,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = Set::extract('/Comment/article_id', $result);
|
$result = Set::extract('/Comment/article_id', $result);
|
||||||
$this->assertEquals($result[0], 4);
|
$this->assertEquals($result[0], 4);
|
||||||
|
|
||||||
|
|
||||||
$model->deleteAll(true);
|
$model->deleteAll(true);
|
||||||
$data = array(
|
$data = array(
|
||||||
'Article' => array(
|
'Article' => array(
|
||||||
|
@ -4801,7 +4797,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
unset($result[6]['Comment']['updated'], $result[6]['Comment']['created']);
|
unset($result[6]['Comment']['updated'], $result[6]['Comment']['created']);
|
||||||
$this->assertEquals($result[6]['Comment'], $expected);
|
$this->assertEquals($result[6]['Comment'], $expected);
|
||||||
|
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'id' => '2',
|
'id' => '2',
|
||||||
'comment_id' => '7',
|
'comment_id' => '7',
|
||||||
|
@ -4985,7 +4980,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
)));
|
)));
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
||||||
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
|
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
|
||||||
$data = array(
|
$data = array(
|
||||||
'Comment' => array(
|
'Comment' => array(
|
||||||
|
@ -5155,7 +5149,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
), array('validate' => true, 'atomic' => false));
|
), array('validate' => true, 'atomic' => false));
|
||||||
|
|
||||||
$this->assertSame($result, array(true, false));
|
$this->assertSame($result, array(true, false));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5850,7 +5843,6 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$result = Set::extract('/Comment/article_id', $result);
|
$result = Set::extract('/Comment/article_id', $result);
|
||||||
$this->assertEquals($result[0], 4);
|
$this->assertEquals($result[0], 4);
|
||||||
|
|
||||||
|
|
||||||
$model->deleteAll(true);
|
$model->deleteAll(true);
|
||||||
$data = array(
|
$data = array(
|
||||||
'Article' => array(
|
'Article' => array(
|
||||||
|
@ -6335,7 +6327,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
'id' => '4',
|
'id' => '4',
|
||||||
'author_id' => '5',
|
'author_id' => '5',
|
||||||
'title' => 'Post without body',
|
'title' => 'Post without body',
|
||||||
'body' => NULL,
|
'body' => null,
|
||||||
'published' => 'N',
|
'published' => 'N',
|
||||||
'created' => $ts,
|
'created' => $ts,
|
||||||
'updated' => $ts,
|
'updated' => $ts,
|
||||||
|
@ -6343,7 +6335,7 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
'Author' => array (
|
'Author' => array (
|
||||||
'id' => '5',
|
'id' => '5',
|
||||||
'user' => 'bob',
|
'user' => 'bob',
|
||||||
'password' => NULL,
|
'password' => null,
|
||||||
'created' => $ts,
|
'created' => $ts,
|
||||||
'updated' => $ts,
|
'updated' => $ts,
|
||||||
'test' => 'working',
|
'test' => 'working',
|
||||||
|
@ -6560,4 +6552,56 @@ class ModelWriteTest extends BaseModelTest {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSaveAllDeepHasManyBelongsTo method
|
||||||
|
*
|
||||||
|
* return @void
|
||||||
|
*/
|
||||||
|
public function testSaveAllDeepHasManyBelongsTo() {
|
||||||
|
$this->loadFixtures('Article', 'Comment', 'User');
|
||||||
|
$TestModel = new Article();
|
||||||
|
$TestModel->belongsTo = $TestModel->hasAndBelongsToMany = array();
|
||||||
|
|
||||||
|
$this->db->truncate($TestModel);
|
||||||
|
$this->db->truncate(new Comment());
|
||||||
|
|
||||||
|
$result = $TestModel->saveAll(array(
|
||||||
|
'Article' => array('id' => 2, 'title' => 'I will not save'),
|
||||||
|
'Comment' => array(
|
||||||
|
array('comment' => 'First new comment', 'published' => 'Y', 'user_id' => 1),
|
||||||
|
array(
|
||||||
|
'comment' => 'belongsto', 'published' => 'Y',
|
||||||
|
'User' => array('user' => 'findme', 'password' => 'somepass')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
), array('deep' => true));
|
||||||
|
|
||||||
|
$result = $TestModel->Comment->User->find('first', array(
|
||||||
|
'conditions' => array('User.user' => 'findme'),
|
||||||
|
'fields' => array('id', 'user', 'password')
|
||||||
|
));
|
||||||
|
$expected = array(
|
||||||
|
'User' => array(
|
||||||
|
'id' => 5,
|
||||||
|
'user' => 'findme',
|
||||||
|
'password' => 'somepass',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$result = $TestModel->Comment->find('first', array(
|
||||||
|
'conditions' => array('Comment.user_id' => 5),
|
||||||
|
'fields' => array('id', 'comment', 'published', 'user_id')
|
||||||
|
));
|
||||||
|
$expected = array(
|
||||||
|
'Comment' => array(
|
||||||
|
'id' => 2,
|
||||||
|
'comment' => 'belongsto',
|
||||||
|
'published' => 'Y',
|
||||||
|
'user_id' => 5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,14 @@ class AppModel extends Model {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function _findPublished($state, $query, $results = array()) {
|
protected function _findPublished($state, $query, $results = array()) {
|
||||||
if ($state === 'before') {
|
if ($state === 'before') {
|
||||||
$query['conditions']['published'] = 'Y';
|
$query['conditions']['published'] = 'Y';
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,6 +89,7 @@ class Test extends CakeTestModel {
|
||||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,6 +192,7 @@ class TestValidate extends CakeTestModel {
|
||||||
public function validateTitle($value) {
|
public function validateTitle($value) {
|
||||||
return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0);
|
return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,7 +220,8 @@ class User extends CakeTestModel {
|
||||||
* beforeFind() callback used to run ContainableBehaviorTest::testLazyLoad()
|
* beforeFind() callback used to run ContainableBehaviorTest::testLazyLoad()
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
* @throws Exception
|
||||||
|
*/
|
||||||
public function beforeFind($queryData) {
|
public function beforeFind($queryData) {
|
||||||
if (!empty($queryData['lazyLoad'])) {
|
if (!empty($queryData['lazyLoad'])) {
|
||||||
if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) {
|
if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) {
|
||||||
|
@ -226,6 +230,7 @@ class User extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,12 +297,13 @@ class Article extends CakeTestModel {
|
||||||
* @param mixed $title
|
* @param mixed $title
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static function titleDuplicate($title) {
|
public static function titleDuplicate($title) {
|
||||||
if ($title === 'My Article Title') {
|
if ($title === 'My Article Title') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -307,6 +313,7 @@ class Article extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class BeforeDeleteComment extends CakeTestModel {
|
class BeforeDeleteComment extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'BeforeDeleteComment';
|
public $name = 'BeforeDeleteComment';
|
||||||
|
|
||||||
public $useTable = 'comments';
|
public $useTable = 'comments';
|
||||||
|
@ -316,6 +323,7 @@ class BeforeDeleteComment extends CakeTestModel {
|
||||||
$db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3)));
|
$db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -338,6 +346,7 @@ class NumericArticle extends CakeTestModel {
|
||||||
* @var string 'numeric_articles'
|
* @var string 'numeric_articles'
|
||||||
*/
|
*/
|
||||||
public $useTable = 'numeric_articles';
|
public $useTable = 'numeric_articles';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,6 +376,7 @@ class Article10 extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $hasMany = array('Comment' => array('dependent' => true, 'exclusive' => true));
|
public $hasMany = array('Comment' => array('dependent' => true, 'exclusive' => true));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -417,6 +427,7 @@ class ArticleFeatured extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $validate = array('user_id' => 'numeric', 'title' => 'notEmpty', 'body' => 'notEmpty');
|
public $validate = array('user_id' => 'numeric', 'title' => 'notEmpty', 'body' => 'notEmpty');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -554,6 +565,7 @@ class ModifiedComment extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -595,6 +607,7 @@ class AgainModifiedComment extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -885,6 +898,7 @@ class Post extends CakeTestModel {
|
||||||
$this->useDbConfig = 'test';
|
$this->useDbConfig = 'test';
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -918,6 +932,7 @@ class Author extends CakeTestModel {
|
||||||
$results[0]['Author']['test'] = 'working';
|
$results[0]['Author']['test'] = 'working';
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -946,6 +961,7 @@ class ModifiedAuthor extends Author {
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1064,7 +1080,6 @@ class BiddingMessage extends CakeTestModel {
|
||||||
*/
|
*/
|
||||||
public $primaryKey = 'bidding';
|
public $primaryKey = 'bidding';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* belongsTo property
|
* belongsTo property
|
||||||
*
|
*
|
||||||
|
@ -1164,6 +1179,7 @@ class NodeAfterFind extends CakeTestModel {
|
||||||
public function afterFind($results, $primary = false) {
|
public function afterFind($results, $primary = false) {
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1943,25 +1959,30 @@ class Callback extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class CallbackPostTestModel extends CakeTestModel {
|
class CallbackPostTestModel extends CakeTestModel {
|
||||||
|
|
||||||
public $useTable = 'posts';
|
public $useTable = 'posts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variable to control return of beforeValidate
|
* variable to control return of beforeValidate
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $beforeValidateReturn = true;
|
public $beforeValidateReturn = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variable to control return of beforeSave
|
* variable to control return of beforeSave
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $beforeSaveReturn = true;
|
public $beforeSaveReturn = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variable to control return of beforeDelete
|
* variable to control return of beforeDelete
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $beforeDeleteReturn = true;
|
public $beforeDeleteReturn = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beforeSave callback
|
* beforeSave callback
|
||||||
*
|
*
|
||||||
|
@ -1970,6 +1991,7 @@ class CallbackPostTestModel extends CakeTestModel {
|
||||||
public function beforeSave($options = array()) {
|
public function beforeSave($options = array()) {
|
||||||
return $this->beforeSaveReturn;
|
return $this->beforeSaveReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beforeValidate callback
|
* beforeValidate callback
|
||||||
*
|
*
|
||||||
|
@ -1978,6 +2000,7 @@ class CallbackPostTestModel extends CakeTestModel {
|
||||||
public function beforeValidate($options = array()) {
|
public function beforeValidate($options = array()) {
|
||||||
return $this->beforeValidateReturn;
|
return $this->beforeValidateReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* beforeDelete callback
|
* beforeDelete callback
|
||||||
*
|
*
|
||||||
|
@ -1986,6 +2009,7 @@ class CallbackPostTestModel extends CakeTestModel {
|
||||||
public function beforeDelete($cascade = true) {
|
public function beforeDelete($cascade = true) {
|
||||||
return $this->beforeDeleteReturn;
|
return $this->beforeDeleteReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2098,7 +2122,7 @@ class ValidationTest1 extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function customValidatorWithParams($data, $validator, $or = true, $ignore_on_same = 'id') {
|
public function customValidatorWithParams($data, $validator, $or = true, $ignoreOnSame = 'id') {
|
||||||
$this->validatorParams = get_defined_vars();
|
$this->validatorParams = get_defined_vars();
|
||||||
unset($this->validatorParams['this']);
|
unset($this->validatorParams['this']);
|
||||||
return true;
|
return true;
|
||||||
|
@ -2112,6 +2136,7 @@ class ValidationTest1 extends CakeTestModel {
|
||||||
public function customValidatorWithMessage($data) {
|
public function customValidatorWithMessage($data) {
|
||||||
return 'This field will *never* validate! Muhahaha!';
|
return 'This field will *never* validate! Muhahaha!';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test validation with many parameters
|
* Test validation with many parameters
|
||||||
*
|
*
|
||||||
|
@ -2122,6 +2147,7 @@ class ValidationTest1 extends CakeTestModel {
|
||||||
unset($this->validatorParams['this']);
|
unset($this->validatorParams['this']);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2178,6 +2204,7 @@ class ValidationTest2 extends CakeTestModel {
|
||||||
public function schema($field = false) {
|
public function schema($field = false) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2200,12 +2227,15 @@ class Person extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $belongsTo = array(
|
public $belongsTo = array(
|
||||||
'Mother' => array(
|
'Mother' => array(
|
||||||
'className' => 'Person',
|
'className' => 'Person',
|
||||||
'foreignKey' => 'mother_id'),
|
'foreignKey' => 'mother_id'
|
||||||
'Father' => array(
|
),
|
||||||
'className' => 'Person',
|
'Father' => array(
|
||||||
'foreignKey' => 'father_id'));
|
'className' => 'Person',
|
||||||
|
'foreignKey' => 'father_id'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2293,7 +2323,14 @@ class Cd extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $hasOne = array('OverallFavorite' => array('foreignKey' => 'model_id', 'dependent' => true, 'conditions' => array('model_type' => 'Cd')));
|
public $hasOne = array(
|
||||||
|
'OverallFavorite' => array(
|
||||||
|
'foreignKey' => 'model_id',
|
||||||
|
'dependent' => true,
|
||||||
|
'conditions' => array('model_type' => 'Cd')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2315,7 +2352,14 @@ class Book extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $hasOne = array('OverallFavorite' => array('foreignKey' => 'model_id', 'dependent' => true, 'conditions' => 'OverallFavorite.model_type = \'Book\''));
|
public $hasOne = array(
|
||||||
|
'OverallFavorite' => array(
|
||||||
|
'foreignKey' => 'model_id',
|
||||||
|
'dependent' => true,
|
||||||
|
'conditions' => 'OverallFavorite.model_type = \'Book\''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2462,8 +2506,8 @@ class NumberTree extends CakeTestModel {
|
||||||
* @param bool $hierachial
|
* @param bool $hierachial
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parent_id = null, $prefix = '1', $hierachial = true) {
|
public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierachial = true) {
|
||||||
if (!$parent_id) {
|
if (!$parentId) {
|
||||||
$db = ConnectionManager::getDataSource($this->useDbConfig);
|
$db = ConnectionManager::getDataSource($this->useDbConfig);
|
||||||
$db->truncate($this->table);
|
$db->truncate($this->table);
|
||||||
$this->save(array($this->name => array('name' => '1. Root')));
|
$this->save(array($this->name => array('name' => '1. Root')));
|
||||||
|
@ -2482,15 +2526,16 @@ class NumberTree extends CakeTestModel {
|
||||||
|
|
||||||
if ($hierachial) {
|
if ($hierachial) {
|
||||||
if ($this->name == 'UnconventionalTree') {
|
if ($this->name == 'UnconventionalTree') {
|
||||||
$data[$this->name]['join'] = $parent_id;
|
$data[$this->name]['join'] = $parentId;
|
||||||
} else {
|
} else {
|
||||||
$data[$this->name]['parent_id'] = $parent_id;
|
$data[$this->name]['parent_id'] = $parentId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->save($data);
|
$this->save($data);
|
||||||
$this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierachial);
|
$this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierachial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2543,6 +2588,7 @@ class UnconventionalTree extends NumberTree {
|
||||||
* @var string 'FlagTree'
|
* @var string 'FlagTree'
|
||||||
*/
|
*/
|
||||||
public $name = 'UnconventionalTree';
|
public $name = 'UnconventionalTree';
|
||||||
|
|
||||||
public $actsAs = array(
|
public $actsAs = array(
|
||||||
'Tree' => array(
|
'Tree' => array(
|
||||||
'parent' => 'join',
|
'parent' => 'join',
|
||||||
|
@ -2550,6 +2596,7 @@ class UnconventionalTree extends NumberTree {
|
||||||
'right' => 'right'
|
'right' => 'right'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2644,6 +2691,7 @@ class AfterTree extends NumberTree {
|
||||||
$this->data['AfterTree']['name'] = 'Six and One Half Changed in AfterTree::afterSave() but not in database';
|
$this->data['AfterTree']['name'] = 'Six and One Half Changed in AfterTree::afterSave() but not in database';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2746,7 +2794,9 @@ class ContentAccount extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class FilmFile extends CakeTestModel {
|
class FilmFile extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'FilmFile';
|
public $name = 'FilmFile';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2755,6 +2805,7 @@ class FilmFile extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Basket extends CakeTestModel {
|
class Basket extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'Basket';
|
public $name = 'Basket';
|
||||||
|
|
||||||
public $belongsTo = array(
|
public $belongsTo = array(
|
||||||
|
@ -2766,6 +2817,7 @@ class Basket extends CakeTestModel {
|
||||||
'order' => ''
|
'order' => ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2941,25 +2993,30 @@ class TranslateTestModel extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class TranslateWithPrefix extends CakeTestModel {
|
class TranslateWithPrefix extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name property
|
* name property
|
||||||
*
|
*
|
||||||
* @var string 'TranslateTestModel'
|
* @var string 'TranslateTestModel'
|
||||||
*/
|
*/
|
||||||
public $name = 'TranslateWithPrefix';
|
public $name = 'TranslateWithPrefix';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tablePrefix property
|
* tablePrefix property
|
||||||
*
|
*
|
||||||
* @var string 'i18n'
|
* @var string 'i18n'
|
||||||
*/
|
*/
|
||||||
public $tablePrefix = 'i18n_';
|
public $tablePrefix = 'i18n_';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* displayField property
|
* displayField property
|
||||||
*
|
*
|
||||||
* @var string 'field'
|
* @var string 'field'
|
||||||
*/
|
*/
|
||||||
public $displayField = 'field';
|
public $displayField = 'field';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TranslatedItem class.
|
* TranslatedItem class.
|
||||||
*
|
*
|
||||||
|
@ -2994,6 +3051,7 @@ class TranslatedItem extends CakeTestModel {
|
||||||
* @var string 'TranslateTestModel'
|
* @var string 'TranslateTestModel'
|
||||||
*/
|
*/
|
||||||
public $translateModel = 'TranslateTestModel';
|
public $translateModel = 'TranslateTestModel';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3002,31 +3060,37 @@ class TranslatedItem extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class TranslatedItem2 extends CakeTestModel {
|
class TranslatedItem2 extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name property
|
* name property
|
||||||
*
|
*
|
||||||
* @var string 'TranslatedItem'
|
* @var string 'TranslatedItem'
|
||||||
*/
|
*/
|
||||||
public $name = 'TranslatedItem';
|
public $name = 'TranslatedItem';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cacheQueries property
|
* cacheQueries property
|
||||||
*
|
*
|
||||||
* @var bool false
|
* @var bool false
|
||||||
*/
|
*/
|
||||||
public $cacheQueries = false;
|
public $cacheQueries = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* actsAs property
|
* actsAs property
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $actsAs = array('Translate' => array('content', 'title'));
|
public $actsAs = array('Translate' => array('content', 'title'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* translateModel property
|
* translateModel property
|
||||||
*
|
*
|
||||||
* @var string 'TranslateTestModel'
|
* @var string 'TranslateTestModel'
|
||||||
*/
|
*/
|
||||||
public $translateModel = 'TranslateWithPrefix';
|
public $translateModel = 'TranslateWithPrefix';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TranslatedItemWithTable class.
|
* TranslatedItemWithTable class.
|
||||||
*
|
*
|
||||||
|
@ -3075,6 +3139,7 @@ class TranslatedItemWithTable extends CakeTestModel {
|
||||||
* @var string 'another_i18n'
|
* @var string 'another_i18n'
|
||||||
*/
|
*/
|
||||||
public $translateTable = 'another_i18n';
|
public $translateTable = 'another_i18n';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3104,6 +3169,7 @@ class TranslateArticleModel extends CakeTestModel {
|
||||||
* @var string 'field'
|
* @var string 'field'
|
||||||
*/
|
*/
|
||||||
public $displayField = 'field';
|
public $displayField = 'field';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3147,55 +3213,79 @@ class TranslatedArticle extends CakeTestModel {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $belongsTo = array('User');
|
public $belongsTo = array('User');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CounterCacheUser extends CakeTestModel {
|
class CounterCacheUser extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'CounterCacheUser';
|
public $name = 'CounterCacheUser';
|
||||||
|
|
||||||
public $alias = 'User';
|
public $alias = 'User';
|
||||||
|
|
||||||
public $hasMany = array('Post' => array(
|
public $hasMany = array(
|
||||||
'className' => 'CounterCachePost',
|
'Post' => array(
|
||||||
'foreignKey' => 'user_id'
|
'className' => 'CounterCachePost',
|
||||||
));
|
'foreignKey' => 'user_id'
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CounterCachePost extends CakeTestModel {
|
class CounterCachePost extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'CounterCachePost';
|
public $name = 'CounterCachePost';
|
||||||
|
|
||||||
public $alias = 'Post';
|
public $alias = 'Post';
|
||||||
|
|
||||||
public $belongsTo = array('User' => array(
|
public $belongsTo = array(
|
||||||
'className' => 'CounterCacheUser',
|
'User' => array(
|
||||||
'foreignKey' => 'user_id',
|
'className' => 'CounterCacheUser',
|
||||||
'counterCache' => true
|
'foreignKey' => 'user_id',
|
||||||
));
|
'counterCache' => true
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
|
class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'CounterCacheUserNonstandardPrimaryKey';
|
public $name = 'CounterCacheUserNonstandardPrimaryKey';
|
||||||
|
|
||||||
public $alias = 'User';
|
public $alias = 'User';
|
||||||
|
|
||||||
public $primaryKey = 'uid';
|
public $primaryKey = 'uid';
|
||||||
|
|
||||||
public $hasMany = array('Post' => array(
|
public $hasMany = array(
|
||||||
'className' => 'CounterCachePostNonstandardPrimaryKey',
|
'Post' => array(
|
||||||
'foreignKey' => 'uid'
|
'className' => 'CounterCachePostNonstandardPrimaryKey',
|
||||||
));
|
'foreignKey' => 'uid'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
|
class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'CounterCachePostNonstandardPrimaryKey';
|
public $name = 'CounterCachePostNonstandardPrimaryKey';
|
||||||
|
|
||||||
public $alias = 'Post';
|
public $alias = 'Post';
|
||||||
|
|
||||||
public $primaryKey = 'pid';
|
public $primaryKey = 'pid';
|
||||||
|
|
||||||
public $belongsTo = array('User' => array(
|
public $belongsTo = array(
|
||||||
'className' => 'CounterCacheUserNonstandardPrimaryKey',
|
'User' => array(
|
||||||
'foreignKey' => 'uid',
|
'className' => 'CounterCacheUserNonstandardPrimaryKey',
|
||||||
'counterCache' => true
|
'foreignKey' => 'uid',
|
||||||
));
|
'counterCache' => true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ArticleB extends CakeTestModel {
|
class ArticleB extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'ArticleB';
|
public $name = 'ArticleB';
|
||||||
|
|
||||||
public $useTable = 'articles';
|
public $useTable = 'articles';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'TagB' => array(
|
'TagB' => array(
|
||||||
'className' => 'TagB',
|
'className' => 'TagB',
|
||||||
|
@ -3204,11 +3294,15 @@ class ArticleB extends CakeTestModel {
|
||||||
'associationForeignKey' => 'tag_id'
|
'associationForeignKey' => 'tag_id'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TagB extends CakeTestModel {
|
class TagB extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'TagB';
|
public $name = 'TagB';
|
||||||
|
|
||||||
public $useTable = 'tags';
|
public $useTable = 'tags';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'ArticleB' => array(
|
'ArticleB' => array(
|
||||||
'className' => 'ArticleB',
|
'className' => 'ArticleB',
|
||||||
|
@ -3217,10 +3311,13 @@ class TagB extends CakeTestModel {
|
||||||
'associationForeignKey' => 'article_id'
|
'associationForeignKey' => 'article_id'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Fruit extends CakeTestModel {
|
class Fruit extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'Fruit';
|
public $name = 'Fruit';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'UuidTag' => array(
|
'UuidTag' => array(
|
||||||
'className' => 'UuidTag',
|
'className' => 'UuidTag',
|
||||||
|
@ -3230,11 +3327,15 @@ class Fruit extends CakeTestModel {
|
||||||
'with' => 'FruitsUuidTag'
|
'with' => 'FruitsUuidTag'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FruitsUuidTag extends CakeTestModel {
|
class FruitsUuidTag extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'FruitsUuidTag';
|
public $name = 'FruitsUuidTag';
|
||||||
|
|
||||||
public $primaryKey = false;
|
public $primaryKey = false;
|
||||||
|
|
||||||
public $belongsTo = array(
|
public $belongsTo = array(
|
||||||
'UuidTag' => array(
|
'UuidTag' => array(
|
||||||
'className' => 'UuidTag',
|
'className' => 'UuidTag',
|
||||||
|
@ -3245,10 +3346,13 @@ class FruitsUuidTag extends CakeTestModel {
|
||||||
'foreignKey' => 'fruit_id',
|
'foreignKey' => 'fruit_id',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UuidTag extends CakeTestModel {
|
class UuidTag extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'UuidTag';
|
public $name = 'UuidTag';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'Fruit' => array(
|
'Fruit' => array(
|
||||||
'className' => 'Fruit',
|
'className' => 'Fruit',
|
||||||
|
@ -3258,11 +3362,15 @@ class UuidTag extends CakeTestModel {
|
||||||
'with' => 'FruitsUuidTag'
|
'with' => 'FruitsUuidTag'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FruitNoWith extends CakeTestModel {
|
class FruitNoWith extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'Fruit';
|
public $name = 'Fruit';
|
||||||
|
|
||||||
public $useTable = 'fruits';
|
public $useTable = 'fruits';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'UuidTag' => array(
|
'UuidTag' => array(
|
||||||
'className' => 'UuidTagNoWith',
|
'className' => 'UuidTagNoWith',
|
||||||
|
@ -3271,11 +3379,15 @@ class FruitNoWith extends CakeTestModel {
|
||||||
'associationForeignKey' => 'uuid_tag_id',
|
'associationForeignKey' => 'uuid_tag_id',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UuidTagNoWith extends CakeTestModel {
|
class UuidTagNoWith extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'UuidTag';
|
public $name = 'UuidTag';
|
||||||
|
|
||||||
public $useTable = 'uuid_tags';
|
public $useTable = 'uuid_tags';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'Fruit' => array(
|
'Fruit' => array(
|
||||||
'className' => 'FruitNoWith',
|
'className' => 'FruitNoWith',
|
||||||
|
@ -3284,21 +3396,29 @@ class UuidTagNoWith extends CakeTestModel {
|
||||||
'associationForeignKey' => 'fruit_id',
|
'associationForeignKey' => 'fruit_id',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProductUpdateAll extends CakeTestModel {
|
class ProductUpdateAll extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'ProductUpdateAll';
|
public $name = 'ProductUpdateAll';
|
||||||
|
|
||||||
public $useTable = 'product_update_all';
|
public $useTable = 'product_update_all';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupUpdateAll extends CakeTestModel {
|
class GroupUpdateAll extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'GroupUpdateAll';
|
public $name = 'GroupUpdateAll';
|
||||||
|
|
||||||
public $useTable = 'group_update_all';
|
public $useTable = 'group_update_all';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransactionTestModel extends CakeTestModel {
|
class TransactionTestModel extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'TransactionTestModel';
|
public $name = 'TransactionTestModel';
|
||||||
|
|
||||||
public $useTable = 'samples';
|
public $useTable = 'samples';
|
||||||
|
|
||||||
public function afterSave($created) {
|
public function afterSave($created) {
|
||||||
|
@ -3307,10 +3427,13 @@ class TransactionTestModel extends CakeTestModel {
|
||||||
);
|
);
|
||||||
$this->saveAll($data, array('atomic' => true, 'callbacks' => false));
|
$this->saveAll($data, array('atomic' => true, 'callbacks' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransactionManyTestModel extends CakeTestModel {
|
class TransactionManyTestModel extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'TransactionManyTestModel';
|
public $name = 'TransactionManyTestModel';
|
||||||
|
|
||||||
public $useTable = 'samples';
|
public $useTable = 'samples';
|
||||||
|
|
||||||
public function afterSave($created) {
|
public function afterSave($created) {
|
||||||
|
@ -3319,24 +3442,29 @@ class TransactionManyTestModel extends CakeTestModel {
|
||||||
);
|
);
|
||||||
$this->saveMany($data, array('atomic' => true, 'callbacks' => false));
|
$this->saveMany($data, array('atomic' => true, 'callbacks' => false));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Site extends CakeTestModel {
|
class Site extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'Site';
|
public $name = 'Site';
|
||||||
|
|
||||||
public $useTable = 'sites';
|
public $useTable = 'sites';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'Domain' => array('unique' => 'keepExisting'),
|
'Domain' => array('unique' => 'keepExisting'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Domain extends CakeTestModel {
|
class Domain extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'Domain';
|
public $name = 'Domain';
|
||||||
|
|
||||||
public $useTable = 'domains';
|
public $useTable = 'domains';
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'Site' => array('unique' => 'keepExisting'),
|
'Site' => array('unique' => 'keepExisting'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3411,6 +3539,7 @@ class TestModel extends CakeTestModel {
|
||||||
public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
|
public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
|
||||||
return $conditions;
|
return $conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3538,6 +3667,7 @@ class TestModel4 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3582,6 +3712,7 @@ class TestModel4TestModel7 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3649,6 +3780,7 @@ class TestModel5 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3684,10 +3816,12 @@ class TestModel6 extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $belongsTo = array('TestModel5' => array(
|
public $belongsTo = array(
|
||||||
'className' => 'TestModel5',
|
'TestModel5' => array(
|
||||||
'foreignKey' => 'test_model5_id'
|
'className' => 'TestModel5',
|
||||||
));
|
'foreignKey' => 'test_model5_id'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schema method
|
* schema method
|
||||||
|
@ -3706,6 +3840,7 @@ class TestModel6 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3752,6 +3887,7 @@ class TestModel7 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3812,6 +3948,7 @@ class TestModel8 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3847,11 +3984,13 @@ class TestModel9 extends CakeTestModel {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $belongsTo = array('TestModel8' => array(
|
public $belongsTo = array(
|
||||||
'className' => 'TestModel8',
|
'TestModel8' => array(
|
||||||
'foreignKey' => 'test_model8_id',
|
'className' => 'TestModel8',
|
||||||
'conditions' => 'TestModel8.name != \'larry\''
|
'foreignKey' => 'test_model8_id',
|
||||||
));
|
'conditions' => 'TestModel8.name != \'larry\''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* schema method
|
* schema method
|
||||||
|
@ -3870,6 +4009,7 @@ class TestModel9 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3928,6 +4068,7 @@ class Level extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4059,6 +4200,7 @@ class User2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4141,6 +4283,7 @@ class Category2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4212,6 +4355,7 @@ class Article2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4259,6 +4403,7 @@ class CategoryFeatured2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4316,6 +4461,7 @@ class Featured2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4369,6 +4515,7 @@ class Comment2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4448,6 +4595,7 @@ class ArticleFeatured2 extends CakeTestModel {
|
||||||
}
|
}
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4504,26 +4652,27 @@ class MysqlTestModel extends Model {
|
||||||
*/
|
*/
|
||||||
public function schema($field = false) {
|
public function schema($field = false) {
|
||||||
return array(
|
return array(
|
||||||
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
|
'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'),
|
||||||
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
|
'client_id' => array('type' => 'integer', 'null' => '', 'default' => '0', 'length' => '11'),
|
||||||
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
'login' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'),
|
||||||
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'passwd' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'addr_1' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
|
'addr_2' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '25'),
|
||||||
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'zip_code' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'city' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'country' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'phone' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'fax' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
'url' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '255'),
|
||||||
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
'email' => array('type' => 'string', 'null' => '1', 'default' => '', 'length' => '155'),
|
||||||
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
'comments' => array('type' => 'text', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'last_login'=> array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
'last_login' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
|
||||||
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4532,9 +4681,13 @@ class MysqlTestModel extends Model {
|
||||||
*/
|
*/
|
||||||
class PrefixTestModel extends CakeTestModel {
|
class PrefixTestModel extends CakeTestModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrefixTestUseTableModel extends CakeTestModel {
|
class PrefixTestUseTableModel extends CakeTestModel {
|
||||||
|
|
||||||
public $name = 'PrefixTest';
|
public $name = 'PrefixTest';
|
||||||
|
|
||||||
public $useTable = 'prefix_tests';
|
public $useTable = 'prefix_tests';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4574,6 +4727,7 @@ class ScaffoldMock extends CakeTestModel {
|
||||||
'foreignKey' => 'article_id',
|
'foreignKey' => 'article_id',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hasAndBelongsToMany property
|
* hasAndBelongsToMany property
|
||||||
*
|
*
|
||||||
|
@ -4587,6 +4741,7 @@ class ScaffoldMock extends CakeTestModel {
|
||||||
'joinTable' => 'join_things'
|
'joinTable' => 'join_things'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4649,12 +4804,14 @@ class ScaffoldComment extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Controller
|
* @package Cake.Test.Case.Controller
|
||||||
*/
|
*/
|
||||||
class ScaffoldTag extends CakeTestModel {
|
class ScaffoldTag extends CakeTestModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* useTable property
|
* useTable property
|
||||||
*
|
*
|
||||||
* @var string 'posts'
|
* @var string 'posts'
|
||||||
*/
|
*/
|
||||||
public $useTable = 'tags';
|
public $useTable = 'tags';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4663,12 +4820,14 @@ class ScaffoldTag extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Player extends CakeTestModel {
|
class Player extends CakeTestModel {
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'Guild' => array(
|
'Guild' => array(
|
||||||
'with' => 'GuildsPlayer',
|
'with' => 'GuildsPlayer',
|
||||||
'unique' => true,
|
'unique' => true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4677,12 +4836,14 @@ class Player extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class Guild extends CakeTestModel {
|
class Guild extends CakeTestModel {
|
||||||
|
|
||||||
public $hasAndBelongsToMany = array(
|
public $hasAndBelongsToMany = array(
|
||||||
'Player' => array(
|
'Player' => array(
|
||||||
'with' => 'GuildsPlayer',
|
'with' => 'GuildsPlayer',
|
||||||
'unique' => true,
|
'unique' => true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4731,6 +4892,7 @@ class ArmorsPlayer extends CakeTestModel {
|
||||||
* @package Cake.Test.Case.Model
|
* @package Cake.Test.Case.Model
|
||||||
*/
|
*/
|
||||||
class CustomArticle extends AppModel {
|
class CustomArticle extends AppModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* useTable property
|
* useTable property
|
||||||
*
|
*
|
||||||
|
@ -4750,12 +4912,12 @@ class CustomArticle extends AppModel {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function _findUnPublished($state, $query, $results = array()) {
|
protected function _findUnPublished($state, $query, $results = array()) {
|
||||||
if ($state === 'before') {
|
if ($state === 'before') {
|
||||||
$query['conditions']['published'] = 'N';
|
$query['conditions']['published'] = 'N';
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ App::uses('Xml', 'Utility');
|
||||||
App::uses('CakeRequest', 'Network');
|
App::uses('CakeRequest', 'Network');
|
||||||
|
|
||||||
class CakeRequestTest extends CakeTestCase {
|
class CakeRequestTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setup callback
|
* setup callback
|
||||||
*
|
*
|
||||||
|
@ -106,7 +107,6 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$expected = array('one' => 'something', 'two' => 'else');
|
$expected = array('one' => 'something', 'two' => 'else');
|
||||||
$this->assertEquals($expected, $request->query);
|
$this->assertEquals($expected, $request->query);
|
||||||
$this->assertEquals('some/path?one=something&two=else', $request->url);
|
$this->assertEquals('some/path?one=something&two=else', $request->url);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +161,6 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$this->assertFalse(isset($request->random));
|
$this->assertFalse(isset($request->random));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test parsing POST data into the object.
|
* test parsing POST data into the object.
|
||||||
*
|
*
|
||||||
|
@ -437,7 +436,6 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertEquals($request->data, $expected);
|
$this->assertEquals($request->data, $expected);
|
||||||
|
|
||||||
|
|
||||||
$_FILES = array(
|
$_FILES = array(
|
||||||
'data' => array(
|
'data' => array(
|
||||||
'name' => array('birth_cert' => 'born on.txt'),
|
'name' => array('birth_cert' => 'born on.txt'),
|
||||||
|
@ -471,7 +469,6 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$request = new CakeRequest('some/path');
|
$request = new CakeRequest('some/path');
|
||||||
$this->assertEquals($request->params['form'], $_FILES);
|
$this->assertEquals($request->params['form'], $_FILES);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -682,7 +679,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
* @expectedException CakeException
|
* @expectedException CakeException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function test__callExceptionOnUnknownMethod() {
|
public function testMagicCallExceptionOnUnknownMethod() {
|
||||||
$request = new CakeRequest('some/path');
|
$request = new CakeRequest('some/path');
|
||||||
$request->IamABanana();
|
$request->IamABanana();
|
||||||
}
|
}
|
||||||
|
@ -725,7 +722,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function test__get() {
|
public function testMagicget() {
|
||||||
$request = new CakeRequest('some/path');
|
$request = new CakeRequest('some/path');
|
||||||
$request->params = array('controller' => 'posts', 'action' => 'view', 'plugin' => 'blogs');
|
$request->params = array('controller' => 'posts', 'action' => 'view', 'plugin' => 'blogs');
|
||||||
|
|
||||||
|
@ -740,7 +737,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function test__isset() {
|
public function testMagicisset() {
|
||||||
$request = new CakeRequest('some/path');
|
$request = new CakeRequest('some/path');
|
||||||
$request->params = array(
|
$request->params = array(
|
||||||
'controller' => 'posts',
|
'controller' => 'posts',
|
||||||
|
@ -800,7 +797,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
|
|
||||||
$_SERVER['TEST_VAR'] = 'wrong';
|
$_SERVER['TEST_VAR'] = 'wrong';
|
||||||
$this->assertFalse($request->is('compare'), 'Value mis-match failed.');
|
$this->assertFalse($request->is('compare'), 'Value mis-match failed.');
|
||||||
|
|
||||||
$request->addDetector('compareCamelCase', array('env' => 'TEST_VAR', 'value' => 'foo'));
|
$request->addDetector('compareCamelCase', array('env' => 'TEST_VAR', 'value' => 'foo'));
|
||||||
|
|
||||||
$_SERVER['TEST_VAR'] = 'foo';
|
$_SERVER['TEST_VAR'] = 'foo';
|
||||||
|
@ -945,7 +942,6 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$this->assertEquals($request->webroot, '/1.2.x.x/');
|
$this->assertEquals($request->webroot, '/1.2.x.x/');
|
||||||
$this->assertEquals($request->url, 'posts/view/1');
|
$this->assertEquals($request->url, 'posts/view/1');
|
||||||
|
|
||||||
|
|
||||||
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/app/webroot';
|
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/app/webroot';
|
||||||
$_SERVER['PHP_SELF'] = '/index.php';
|
$_SERVER['PHP_SELF'] = '/index.php';
|
||||||
$_SERVER['PATH_INFO'] = '/posts/add';
|
$_SERVER['PATH_INFO'] = '/posts/add';
|
||||||
|
@ -962,7 +958,6 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
$this->assertEquals('', $request->base);
|
$this->assertEquals('', $request->base);
|
||||||
$this->assertEquals('/', $request->webroot);
|
$this->assertEquals('/', $request->webroot);
|
||||||
|
|
||||||
|
|
||||||
$_SERVER['DOCUMENT_ROOT'] = '/some/apps/where';
|
$_SERVER['DOCUMENT_ROOT'] = '/some/apps/where';
|
||||||
$_SERVER['PHP_SELF'] = '/app/webroot/index.php';
|
$_SERVER['PHP_SELF'] = '/app/webroot/index.php';
|
||||||
$request = new CakeRequest();
|
$request = new CakeRequest();
|
||||||
|
@ -1704,7 +1699,6 @@ XML;
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test is('requested') and isRequested()
|
* Test is('requested') and isRequested()
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,9 +40,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the request object constructor
|
* Tests the request object constructor
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testConstruct() {
|
public function testConstruct() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$this->assertNull($response->body());
|
$this->assertNull($response->body());
|
||||||
|
@ -64,9 +64,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the body method
|
* Tests the body method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testBody() {
|
public function testBody() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$this->assertNull($response->body());
|
$this->assertNull($response->body());
|
||||||
|
@ -76,9 +76,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the charset method
|
* Tests the charset method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testCharset() {
|
public function testCharset() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$this->assertEquals($response->charset(), 'UTF-8');
|
$this->assertEquals($response->charset(), 'UTF-8');
|
||||||
|
@ -88,10 +88,10 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the statusCode method
|
* Tests the statusCode method
|
||||||
*
|
*
|
||||||
* @expectedException CakeException
|
* @expectedException CakeException
|
||||||
*/
|
*/
|
||||||
public function testStatusCode() {
|
public function testStatusCode() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$this->assertEquals($response->statusCode(), 200);
|
$this->assertEquals($response->statusCode(), 200);
|
||||||
|
@ -104,9 +104,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the type method
|
* Tests the type method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testType() {
|
public function testType() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$this->assertEquals($response->type(), 'text/html');
|
$this->assertEquals($response->type(), 'text/html');
|
||||||
|
@ -125,9 +125,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the header method
|
* Tests the header method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testHeader() {
|
public function testHeader() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$headers = array();
|
$headers = array();
|
||||||
|
@ -169,9 +169,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the send method
|
* Tests the send method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSend() {
|
public function testSend() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
||||||
$response->header(array(
|
$response->header(array(
|
||||||
|
@ -195,9 +195,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the send method and changing the content type
|
* Tests the send method and changing the content type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSendChangingContentYype() {
|
public function testSendChangingContentYype() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
||||||
$response->type('mp3');
|
$response->type('mp3');
|
||||||
|
@ -214,9 +214,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the send method and changing the content type
|
* Tests the send method and changing the content type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSendChangingContentType() {
|
public function testSendChangingContentType() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
||||||
$response->type('mp3');
|
$response->type('mp3');
|
||||||
|
@ -233,9 +233,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the send method and changing the content type
|
* Tests the send method and changing the content type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSendWithLocation() {
|
public function testSendWithLocation() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent', '_setCookies'));
|
||||||
$response->header('Location', 'http://www.example.com');
|
$response->header('Location', 'http://www.example.com');
|
||||||
|
@ -245,14 +245,14 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
$response->expects($this->at(2))
|
$response->expects($this->at(2))
|
||||||
->method('_sendHeader')->with('Location', 'http://www.example.com');
|
->method('_sendHeader')->with('Location', 'http://www.example.com');
|
||||||
$response->expects($this->at(3))
|
$response->expects($this->at(3))
|
||||||
->method('_sendHeader')->with('Content-Type', 'text/html; charset=UTF-8');
|
->method('_sendHeader')->with('Content-Type', 'text/html; charset=UTF-8');
|
||||||
$response->send();
|
$response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the disableCache method
|
* Tests the disableCache method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testDisableCache() {
|
public function testDisableCache() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -265,9 +265,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the cache method
|
* Tests the cache method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testCache() {
|
public function testCache() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$since = time();
|
$since = time();
|
||||||
|
@ -336,15 +336,15 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the httpCodes method
|
* Tests the httpCodes method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testHttpCodes() {
|
public function testHttpCodes() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$result = $response->httpCodes();
|
$result = $response->httpCodes();
|
||||||
$this->assertEquals(count($result), 39);
|
$this->assertEquals(count($result), 39);
|
||||||
|
|
||||||
$result = $response->httpCodes(100);
|
$result = $response->httpCodes(100);
|
||||||
$expected = array(100 => 'Continue');
|
$expected = array(100 => 'Continue');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
1729 => 'Hardy-Ramanujan Located'
|
1729 => 'Hardy-Ramanujan Located'
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $response->httpCodes($codes);
|
$result = $response->httpCodes($codes);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
$this->assertEquals(count($response->httpCodes()), 41);
|
$this->assertEquals(count($response->httpCodes()), 41);
|
||||||
|
|
||||||
|
@ -372,9 +372,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the download method
|
* Tests the download method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testDownload() {
|
public function testDownload() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -385,9 +385,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the mapType method
|
* Tests the mapType method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testMapType() {
|
public function testMapType() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
$this->assertEquals('wav', $response->mapType('audio/x-wav'));
|
$this->assertEquals('wav', $response->mapType('audio/x-wav'));
|
||||||
|
@ -401,9 +401,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the outputCompressed method
|
* Tests the outputCompressed method
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testOutputCompressed() {
|
public function testOutputCompressed() {
|
||||||
$response = new CakeResponse();
|
$response = new CakeResponse();
|
||||||
|
|
||||||
|
@ -438,9 +438,9 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the send and setting of Content-Length
|
* Tests the send and setting of Content-Length
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function testSendContentLength() {
|
public function testSendContentLength() {
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
|
||||||
$response->body('the response body');
|
$response->body('the response body');
|
||||||
|
@ -479,7 +479,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
$response->header('Content-Length', 1);
|
$response->header('Content-Length', 1);
|
||||||
$response->expects($this->never())->method('outputCompressed');
|
$response->expects($this->never())->method('outputCompressed');
|
||||||
$response->expects($this->once())->method('_sendContent')->with($body);
|
$response->expects($this->once())->method('_sendContent')->with($body);
|
||||||
$response->expects($this->at(1))
|
$response->expects($this->at(1))
|
||||||
->method('_sendHeader')->with('Content-Length', 1);
|
->method('_sendHeader')->with('Content-Length', 1);
|
||||||
$response->send();
|
$response->send();
|
||||||
|
|
||||||
|
@ -652,7 +652,6 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
->method('_sendHeader')->with('Cache-Control', 'public');
|
->method('_sendHeader')->with('Cache-Control', 'public');
|
||||||
$response->send();
|
$response->send();
|
||||||
|
|
||||||
|
|
||||||
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
|
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
|
||||||
$response->sharable(false);
|
$response->sharable(false);
|
||||||
$headers = $response->header();
|
$headers = $response->header();
|
||||||
|
@ -765,7 +764,6 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
$response->expects($this->at(1))
|
$response->expects($this->at(1))
|
||||||
->method('_sendHeader')->with('Cache-Control', 's-maxage=3600, must-revalidate');
|
->method('_sendHeader')->with('Cache-Control', 's-maxage=3600, must-revalidate');
|
||||||
$response->send();
|
$response->send();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -835,7 +833,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
**/
|
**/
|
||||||
public function testCheckNotModifiedByEtagStar() {
|
public function testCheckNotModifiedByEtagStar() {
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] = '*';
|
$_SERVER['HTTP_IF_NONE_MATCH'] = '*';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->etag('something');
|
$response->etag('something');
|
||||||
$response->expects($this->once())->method('notModified');
|
$response->expects($this->once())->method('notModified');
|
||||||
$response->checkNotModified(new CakeRequest);
|
$response->checkNotModified(new CakeRequest);
|
||||||
|
@ -848,7 +846,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
**/
|
**/
|
||||||
public function testCheckNotModifiedByEtagExact() {
|
public function testCheckNotModifiedByEtagExact() {
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->etag('something', true);
|
$response->etag('something', true);
|
||||||
$response->expects($this->once())->method('notModified');
|
$response->expects($this->once())->method('notModified');
|
||||||
$this->assertTrue($response->checkNotModified(new CakeRequest));
|
$this->assertTrue($response->checkNotModified(new CakeRequest));
|
||||||
|
@ -862,7 +860,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
public function testCheckNotModifiedByEtagAndTime() {
|
public function testCheckNotModifiedByEtagAndTime() {
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
||||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->etag('something', true);
|
$response->etag('something', true);
|
||||||
$response->modified('2012-01-01 00:00:00');
|
$response->modified('2012-01-01 00:00:00');
|
||||||
$response->expects($this->once())->method('notModified');
|
$response->expects($this->once())->method('notModified');
|
||||||
|
@ -877,7 +875,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
public function testCheckNotModifiedByEtagAndTimeMismatch() {
|
public function testCheckNotModifiedByEtagAndTimeMismatch() {
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
||||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->etag('something', true);
|
$response->etag('something', true);
|
||||||
$response->modified('2012-01-01 00:00:01');
|
$response->modified('2012-01-01 00:00:01');
|
||||||
$response->expects($this->never())->method('notModified');
|
$response->expects($this->never())->method('notModified');
|
||||||
|
@ -892,14 +890,13 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
public function testCheckNotModifiedByEtagMismatch() {
|
public function testCheckNotModifiedByEtagMismatch() {
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something-else", "other"';
|
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something-else", "other"';
|
||||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->etag('something', true);
|
$response->etag('something', true);
|
||||||
$response->modified('2012-01-01 00:00:00');
|
$response->modified('2012-01-01 00:00:00');
|
||||||
$response->expects($this->never())->method('notModified');
|
$response->expects($this->never())->method('notModified');
|
||||||
$this->assertFalse($response->checkNotModified(new CakeRequest));
|
$this->assertFalse($response->checkNotModified(new CakeRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test checkNotModified method
|
* Test checkNotModified method
|
||||||
*
|
*
|
||||||
|
@ -907,7 +904,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
**/
|
**/
|
||||||
public function testCheckNotModifiedByTime() {
|
public function testCheckNotModifiedByTime() {
|
||||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->modified('2012-01-01 00:00:00');
|
$response->modified('2012-01-01 00:00:00');
|
||||||
$response->expects($this->once())->method('notModified');
|
$response->expects($this->once())->method('notModified');
|
||||||
$this->assertTrue($response->checkNotModified(new CakeRequest));
|
$this->assertTrue($response->checkNotModified(new CakeRequest));
|
||||||
|
@ -921,7 +918,7 @@ class CakeResponseTest extends CakeTestCase {
|
||||||
public function testCheckNotModifiedNoHints() {
|
public function testCheckNotModifiedNoHints() {
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
$_SERVER['HTTP_IF_NONE_MATCH'] = 'W/"something", "other"';
|
||||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = '2012-01-01 00:00:00';
|
||||||
$response = $this->getMock('CakeResponse', array('notModified'));
|
$response = $this->getMock('CakeResponse', array('notModified'));
|
||||||
$response->expects($this->never())->method('notModified');
|
$response->expects($this->never())->method('notModified');
|
||||||
$this->assertFalse($response->checkNotModified(new CakeRequest));
|
$this->assertFalse($response->checkNotModified(new CakeRequest));
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ class TestCakeEmail extends CakeEmail {
|
||||||
public function encode($text) {
|
public function encode($text) {
|
||||||
return $this->_encode($text);
|
return $this->_encode($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -110,7 +111,7 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->CakeEmail = new TestCakeEmail();
|
$this->CakeEmail = new TestCakeEmail();
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,12 +309,12 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->assertSame($expected, $result);
|
$this->assertSame($expected, $result);
|
||||||
|
|
||||||
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => '寿限無寿限無五劫の擦り切れ海砂利水魚の水行末雲来末風来末食う寝る処に住む処やぶら小路の藪柑子パイポパイポパイポのシューリンガンシューリンガンのグーリンダイグーリンダイのポンポコピーのポンポコナーの長久命の長助'));
|
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => '寿限無寿限無五劫の擦り切れ海砂利水魚の水行末雲来末風来末食う寝る処に住む処やぶら小路の藪柑子パイポパイポパイポのシューリンガンシューリンガンのグーリンダイグーリンダイのポンポコピーのポンポコナーの長久命の長助'));
|
||||||
$expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n"
|
$expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n"
|
" =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n"
|
" =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n"
|
" =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n"
|
" =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= <cake@cakephp.org>");
|
" =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= <cake@cakephp.org>");
|
||||||
$this->assertSame($expected, $result);
|
$this->assertSame($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,13 +421,12 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->assertSame($this->CakeEmail->subject(), $expected);
|
$this->assertSame($this->CakeEmail->subject(), $expected);
|
||||||
|
|
||||||
$this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?');
|
$this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?');
|
||||||
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n"
|
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n"
|
" =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" .
|
||||||
." =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
|
" =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
|
||||||
$this->assertSame($this->CakeEmail->subject(), $expected);
|
$this->assertSame($this->CakeEmail->subject(), $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testHeaders method
|
* testHeaders method
|
||||||
*
|
*
|
||||||
|
@ -659,7 +659,6 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->CakeEmail->config(array());
|
$this->CakeEmail->config(array());
|
||||||
$this->assertSame($transportClass->config(), array());
|
$this->assertSame($transportClass->config(), array());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -883,7 +882,7 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->assertContains($expected, $result['message']);
|
$this->assertContains($expected, $result['message']);
|
||||||
$this->assertContains('--rel-' . $boundary . '--', $result['message']);
|
$this->assertContains('--rel-' . $boundary . '--', $result['message']);
|
||||||
$this->assertContains('--' . $boundary . '--', $result['message']);
|
$this->assertContains('--' . $boundary . '--', $result['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSendWithLog method
|
* testSendWithLog method
|
||||||
|
@ -1209,7 +1208,6 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
$this->assertTrue($this->checkContentTransferEncoding($message, '7bit'));
|
$this->assertTrue($this->checkContentTransferEncoding($message, '7bit'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testReset method
|
* testReset method
|
||||||
*
|
*
|
||||||
|
@ -1493,9 +1491,9 @@ class CakeEmailTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->CakeEmail->headerCharset = 'ISO-2022-JP';
|
$this->CakeEmail->headerCharset = 'ISO-2022-JP';
|
||||||
$result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?');
|
$result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?');
|
||||||
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n"
|
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" .
|
||||||
. " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n"
|
" =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" .
|
||||||
. " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
|
" =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
|
||||||
$this->assertSame($expected, $result);
|
$this->assertSame($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ class SmtpTestTransport extends SmtpTransport {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _generateSocket() {
|
protected function _generateSocket() {
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -160,8 +160,8 @@ class DigestAuthenticationTest extends CakeTestCase {
|
||||||
$this->assertTrue(strpos($this->HttpSocket->request['header']['Authorization'], 'nc=00000003') > 0);
|
$this->assertTrue(strpos($this->HttpSocket->request['header']['Authorization'], 'nc=00000003') > 0);
|
||||||
$this->assertEquals($auth['nc'], 4);
|
$this->assertEquals($auth['nc'], 4);
|
||||||
$responsePos = strpos($this->HttpSocket->request['header']['Authorization'], 'response=');
|
$responsePos = strpos($this->HttpSocket->request['header']['Authorization'], 'response=');
|
||||||
$response2 = substr($this->HttpSocket->request['header']['Authorization'], $responsePos + 10, 32);
|
$responseB = substr($this->HttpSocket->request['header']['Authorization'], $responsePos + 10, 32);
|
||||||
$this->assertNotEquals($response, $response2);
|
$this->assertNotEquals($response, $responseB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -85,6 +85,7 @@ class TestHttpResponse extends HttpResponse {
|
||||||
* @package Cake.Test.Case.Network.Http
|
* @package Cake.Test.Case.Network.Http
|
||||||
*/
|
*/
|
||||||
class HttpResponseTest extends CakeTestCase {
|
class HttpResponseTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function sets up a HttpResponse
|
* This function sets up a HttpResponse
|
||||||
*
|
*
|
||||||
|
@ -491,7 +492,7 @@ class HttpResponseTest extends CakeTestCase {
|
||||||
$unescapedToken = $this->HttpResponse->unescapeToken($token);
|
$unescapedToken = $this->HttpResponse->unescapeToken($token);
|
||||||
$expectedToken = 'My-special-' . $char . '-Token';
|
$expectedToken = 'My-special-' . $char . '-Token';
|
||||||
|
|
||||||
$this->assertEquals($unescapedToken, $expectedToken, 'Test token unescaping for ASCII '.ord($char));
|
$this->assertEquals($unescapedToken, $expectedToken, 'Test token unescaping for ASCII ' . ord($char));
|
||||||
}
|
}
|
||||||
|
|
||||||
$token = 'Extreme-":"Token-" "-""""@"-test';
|
$token = 'Extreme-":"Token-" "-""""@"-test';
|
||||||
|
@ -519,14 +520,13 @@ class HttpResponseTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->HttpResponse->body = 'This is a test!';
|
$this->HttpResponse->body = 'This is a test!';
|
||||||
$this->HttpResponse->raw = "HTTP/1.1 200 OK\r\nServer: CakePHP\r\nContEnt-Type: text/plain\r\n\r\nThis is a test!";
|
$this->HttpResponse->raw = "HTTP/1.1 200 OK\r\nServer: CakePHP\r\nContEnt-Type: text/plain\r\n\r\nThis is a test!";
|
||||||
|
$expectedOne = "HTTP/1.1 200 OK\r\n";
|
||||||
$expected1 = "HTTP/1.1 200 OK\r\n";
|
$this->assertEquals($this->HttpResponse['raw']['status-line'], $expectedOne);
|
||||||
$this->assertEquals($this->HttpResponse['raw']['status-line'], $expected1);
|
$expectedTwo = "Server: CakePHP\r\nContEnt-Type: text/plain\r\n";
|
||||||
$expected2 = "Server: CakePHP\r\nContEnt-Type: text/plain\r\n";
|
$this->assertEquals($this->HttpResponse['raw']['header'], $expectedTwo);
|
||||||
$this->assertEquals($this->HttpResponse['raw']['header'], $expected2);
|
$expectedThree = 'This is a test!';
|
||||||
$expected3 = 'This is a test!';
|
$this->assertEquals($this->HttpResponse['raw']['body'], $expectedThree);
|
||||||
$this->assertEquals($this->HttpResponse['raw']['body'], $expected3);
|
$expected = $expectedOne . $expectedTwo . "\r\n" . $expectedThree;
|
||||||
$expected = $expected1 . $expected2 . "\r\n" . $expected3;
|
|
||||||
$this->assertEquals($this->HttpResponse['raw']['response'], $expected);
|
$this->assertEquals($this->HttpResponse['raw']['response'], $expected);
|
||||||
|
|
||||||
$expected = 'HTTP/1.1';
|
$expected = 'HTTP/1.1';
|
||||||
|
@ -555,4 +555,4 @@ class HttpResponseTest extends CakeTestCase {
|
||||||
$this->assertSame($this->HttpResponse['raw']['header'], null);
|
$this->assertSame($this->HttpResponse['raw']['header'], null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ class TestHttpSocket extends HttpSocket {
|
||||||
* @param string $token Token to escape
|
* @param string $token Token to escape
|
||||||
* @return string Escaped token
|
* @return string Escaped token
|
||||||
*/
|
*/
|
||||||
public function EscapeToken($token, $chars = null) {
|
public function escapeToken($token, $chars = null) {
|
||||||
return parent::_escapeToken($token, $chars);
|
return parent::_escapeToken($token, $chars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,7 +761,6 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
$this->assertInstanceOf('CustomResponse', $response);
|
$this->assertInstanceOf('CustomResponse', $response);
|
||||||
$this->assertEquals($response->first10, 'HTTP/1.x 2');
|
$this->assertEquals($response->first10, 'HTTP/1.x 2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testRequestWithRedirect method
|
* testRequestWithRedirect method
|
||||||
|
@ -777,11 +776,11 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
$serverResponse2 = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>You have been redirected</h1>";
|
$serverResponse2 = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>You have been redirected</h1>";
|
||||||
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
|
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
|
||||||
$this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
|
$this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
|
||||||
|
|
||||||
$response = $this->Socket->request($request);
|
$response = $this->Socket->request($request);
|
||||||
$this->assertEquals('<h1>You have been redirected</h1>', $response->body());
|
$this->assertEquals('<h1>You have been redirected</h1>', $response->body());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestWithRedirectAsInt() {
|
public function testRequestWithRedirectAsInt() {
|
||||||
$request = array(
|
$request = array(
|
||||||
'uri' => 'http://localhost/oneuri',
|
'uri' => 'http://localhost/oneuri',
|
||||||
|
@ -791,11 +790,11 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
$serverResponse2 = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>You have been redirected</h1>";
|
$serverResponse2 = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>You have been redirected</h1>";
|
||||||
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
|
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
|
||||||
$this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
|
$this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
|
||||||
|
|
||||||
$response = $this->Socket->request($request);
|
$response = $this->Socket->request($request);
|
||||||
$this->assertEquals(1, $this->Socket->request['redirect']);
|
$this->assertEquals(1, $this->Socket->request['redirect']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestWithRedirectAsIntReachingZero() {
|
public function testRequestWithRedirectAsIntReachingZero() {
|
||||||
$request = array(
|
$request = array(
|
||||||
'uri' => 'http://localhost/oneuri',
|
'uri' => 'http://localhost/oneuri',
|
||||||
|
@ -805,13 +804,12 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
$serverResponse2 = "HTTP/1.x 302 Found\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\nLocation: http://localhost/anotheruri\r\n\r\n";
|
$serverResponse2 = "HTTP/1.x 302 Found\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\nLocation: http://localhost/anotheruri\r\n\r\n";
|
||||||
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
|
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse1));
|
||||||
$this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
|
$this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse2));
|
||||||
|
|
||||||
$response = $this->Socket->request($request);
|
$response = $this->Socket->request($request);
|
||||||
$this->assertEquals(0, $this->Socket->request['redirect']);
|
$this->assertEquals(0, $this->Socket->request['redirect']);
|
||||||
$this->assertEquals(302, $response->code);
|
$this->assertEquals(302, $response->code);
|
||||||
$this->assertEquals('http://localhost/anotheruri', $response->getHeader('Location'));
|
$this->assertEquals('http://localhost/anotheruri', $response->getHeader('Location'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testProxy method
|
* testProxy method
|
||||||
|
@ -1496,7 +1494,6 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
|
|
||||||
$r = $this->Socket->buildHeader(array('Test@Field' => "My value"));
|
$r = $this->Socket->buildHeader(array('Test@Field' => "My value"));
|
||||||
$this->assertEquals($r, "Test\"@\"Field: My value\r\n");
|
$this->assertEquals($r, "Test\"@\"Field: My value\r\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1561,7 +1558,7 @@ class HttpSocketTest extends CakeTestCase {
|
||||||
$escapedToken = $this->Socket->escapeToken($token);
|
$escapedToken = $this->Socket->escapeToken($token);
|
||||||
$expectedToken = 'My-special-"' . $char . '"-Token';
|
$expectedToken = 'My-special-"' . $char . '"-Token';
|
||||||
|
|
||||||
$this->assertEquals($escapedToken, $expectedToken, 'Test token escaping for ASCII '.ord($char));
|
$this->assertEquals($escapedToken, $expectedToken, 'Test token escaping for ASCII ' . ord($char));
|
||||||
}
|
}
|
||||||
|
|
||||||
$token = 'Extreme-:Token- -"@-test';
|
$token = 'Extreme-:Token- -"@-test';
|
||||||
|
|
|
@ -256,7 +256,7 @@ class CakeTestCaseTest extends CakeTestCase {
|
||||||
$two = "\nOne\nTwo";
|
$two = "\nOne\nTwo";
|
||||||
$this->assertTextEquals($one, $two);
|
$this->assertTextEquals($one, $two);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test assertTextStartsWith()
|
* test assertTextStartsWith()
|
||||||
*
|
*
|
||||||
|
@ -265,7 +265,7 @@ class CakeTestCaseTest extends CakeTestCase {
|
||||||
public function testAssertTextStartsWith() {
|
public function testAssertTextStartsWith() {
|
||||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||||
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
||||||
|
|
||||||
$this->assertStringStartsWith("some\nstring", $stringDirty);
|
$this->assertStringStartsWith("some\nstring", $stringDirty);
|
||||||
$this->assertStringStartsNotWith("some\r\nstring\r\nwith", $stringDirty);
|
$this->assertStringStartsNotWith("some\r\nstring\r\nwith", $stringDirty);
|
||||||
$this->assertStringStartsNotWith("some\nstring\nwith", $stringDirty);
|
$this->assertStringStartsNotWith("some\nstring\nwith", $stringDirty);
|
||||||
|
@ -282,19 +282,19 @@ class CakeTestCaseTest extends CakeTestCase {
|
||||||
public function testAssertTextStartsNotWith() {
|
public function testAssertTextStartsNotWith() {
|
||||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||||
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
||||||
|
|
||||||
$this->assertTextStartsNotWith("some\nstring\nwithout", $stringDirty);
|
$this->assertTextStartsNotWith("some\nstring\nwithout", $stringDirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test assertTextEndsWith()
|
* test assertTextEndsWith()
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAssertTextEndsWith() {
|
public function testAssertTextEndsWith() {
|
||||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||||
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
||||||
|
|
||||||
$this->assertTextEndsWith("string\nwith\r\ndifferent\rline endings!", $stringDirty);
|
$this->assertTextEndsWith("string\nwith\r\ndifferent\rline endings!", $stringDirty);
|
||||||
$this->assertTextEndsWith("string\r\nwith\ndifferent\nline endings!", $stringDirty);
|
$this->assertTextEndsWith("string\r\nwith\ndifferent\nline endings!", $stringDirty);
|
||||||
}
|
}
|
||||||
|
@ -303,39 +303,40 @@ class CakeTestCaseTest extends CakeTestCase {
|
||||||
* test assertTextEndsNotWith()
|
* test assertTextEndsNotWith()
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAssertTextEndsNotWith() {
|
public function testAssertTextEndsNotWith() {
|
||||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||||
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
||||||
|
|
||||||
$this->assertStringEndsNotWith("different\nline endings", $stringDirty);
|
$this->assertStringEndsNotWith("different\nline endings", $stringDirty);
|
||||||
$this->assertTextEndsNotWith("different\rline endings", $stringDirty);
|
$this->assertTextEndsNotWith("different\rline endings", $stringDirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test assertTextContains()
|
* test assertTextContains()
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAssertTextContains() {
|
public function testAssertTextContains() {
|
||||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||||
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
||||||
|
|
||||||
$this->assertContains("different", $stringDirty);
|
$this->assertContains("different", $stringDirty);
|
||||||
$this->assertNotContains("different\rline", $stringDirty);
|
$this->assertNotContains("different\rline", $stringDirty);
|
||||||
|
|
||||||
$this->assertTextContains("different\rline", $stringDirty);
|
$this->assertTextContains("different\rline", $stringDirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test assertTextNotContains()
|
* test assertTextNotContains()
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAssertTextNotContains() {
|
public function testAssertTextNotContains() {
|
||||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||||
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
$stringClean = "some\nstring\nwith\ndifferent\nline endings!";
|
||||||
|
|
||||||
$this->assertTextNotContains("different\rlines", $stringDirty);
|
$this->assertTextNotContains("different\rlines", $stringDirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,15 +155,23 @@ class CakeTestFixtureDefaultImportFixture extends CakeTestFixture {
|
||||||
* @package Cake.Test.Case.TestSuite
|
* @package Cake.Test.Case.TestSuite
|
||||||
*/
|
*/
|
||||||
class FixtureImportTestModel extends Model {
|
class FixtureImportTestModel extends Model {
|
||||||
|
|
||||||
public $name = 'FixtureImport';
|
public $name = 'FixtureImport';
|
||||||
|
|
||||||
public $useTable = 'fixture_tests';
|
public $useTable = 'fixture_tests';
|
||||||
|
|
||||||
public $useDbConfig = 'test';
|
public $useDbConfig = 'test';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FixturePrefixTest extends Model {
|
class FixturePrefixTest extends Model {
|
||||||
|
|
||||||
public $name = 'FixturePrefix';
|
public $name = 'FixturePrefix';
|
||||||
|
|
||||||
public $useTable = '_tests';
|
public $useTable = '_tests';
|
||||||
|
|
||||||
public $tablePrefix = 'fixture';
|
public $tablePrefix = 'fixture';
|
||||||
|
|
||||||
public $useDbConfig = 'test';
|
public $useDbConfig = 'test';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,9 +226,9 @@ class CakeTestFixtureTest extends CakeTestCase {
|
||||||
$this->assertEquals($Fixture->primaryKey, 'my_random_key');
|
$this->assertEquals($Fixture->primaryKey, 'my_random_key');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that init() correctly sets the fixture table when the connection or model have prefixes defined.
|
* test that init() correctly sets the fixture table when the connection
|
||||||
|
* or model have prefixes defined.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -359,7 +367,6 @@ class CakeTestFixtureTest extends CakeTestCase {
|
||||||
$Source->create($newTestSuiteDb);
|
$Source->create($newTestSuiteDb);
|
||||||
$Source->insert($newTestSuiteDb);
|
$Source->insert($newTestSuiteDb);
|
||||||
|
|
||||||
|
|
||||||
$Fixture = new CakeTestFixtureDefaultImportFixture();
|
$Fixture = new CakeTestFixtureDefaultImportFixture();
|
||||||
$Fixture->fields = $Fixture->records = null;
|
$Fixture->fields = $Fixture->records = null;
|
||||||
$Fixture->import = array(
|
$Fixture->import = array(
|
||||||
|
|
|
@ -20,24 +20,6 @@
|
||||||
*/
|
*/
|
||||||
class CakeTestSuiteTest extends CakeTestCase {
|
class CakeTestSuiteTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
|
||||||
* setUp
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setUp() {
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* tearDown
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function tearDown() {
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testAddTestDirectory
|
* testAddTestDirectory
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,7 +26,6 @@ App::uses('CakeHtmlReporter', 'TestSuite/Reporter');
|
||||||
|
|
||||||
require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php';
|
require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AppController class
|
* AppController class
|
||||||
*
|
*
|
||||||
|
@ -36,9 +35,10 @@ if (!class_exists('AppController', false)) {
|
||||||
/**
|
/**
|
||||||
* AppController class
|
* AppController class
|
||||||
*
|
*
|
||||||
* @package Cake.Test.Case.TestSuite
|
* @package Cake.Test.Case.TestSuite
|
||||||
*/
|
*/
|
||||||
class AppController extends Controller {
|
class AppController extends Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* helpers property
|
* helpers property
|
||||||
*
|
*
|
||||||
|
@ -46,6 +46,7 @@ if (!class_exists('AppController', false)) {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public $helpers = array('Html');
|
public $helpers = array('Html');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uses property
|
* uses property
|
||||||
*
|
*
|
||||||
|
@ -53,6 +54,7 @@ if (!class_exists('AppController', false)) {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public $uses = array('ControllerPost');
|
public $uses = array('ControllerPost');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* components property
|
* components property
|
||||||
*
|
*
|
||||||
|
@ -60,6 +62,7 @@ if (!class_exists('AppController', false)) {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public $components = array('Cookie');
|
public $components = array('Cookie');
|
||||||
|
|
||||||
}
|
}
|
||||||
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
|
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
|
||||||
define('APP_CONTROLLER_EXISTS', true);
|
define('APP_CONTROLLER_EXISTS', true);
|
||||||
|
@ -238,7 +241,6 @@ class ControllerTestCaseTest extends CakeTestCase {
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
$this->assertTrue($Tests->TestPluginComment->save(array()));
|
$this->assertTrue($Tests->TestPluginComment->save(array()));
|
||||||
$this->assertFalse($Tests->TestPluginComment->save(array()));
|
$this->assertFalse($Tests->TestPluginComment->save(array()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -496,7 +498,7 @@ class ControllerTestCaseTest extends CakeTestCase {
|
||||||
$this->assertContains('This is the TestsAppsController index view', $result);
|
$this->assertContains('This is the TestsAppsController index view', $result);
|
||||||
$this->assertContains('first call', $result);
|
$this->assertContains('first call', $result);
|
||||||
$this->assertContains('</html>', $result);
|
$this->assertContains('</html>', $result);
|
||||||
|
|
||||||
$result = $this->Case->testAction('/tests_apps/index', array(
|
$result = $this->Case->testAction('/tests_apps/index', array(
|
||||||
'data' => array('var' => 'second call'),
|
'data' => array('var' => 'second call'),
|
||||||
'method' => 'get',
|
'method' => 'get',
|
||||||
|
|
|
@ -21,6 +21,7 @@ App::uses('HtmlCoverageReport', 'TestSuite/Coverage');
|
||||||
App::uses('CakeBaseReporter', 'TestSuite/Reporter');
|
App::uses('CakeBaseReporter', 'TestSuite/Reporter');
|
||||||
|
|
||||||
class HtmlCoverageReportTest extends CakeTestCase {
|
class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp
|
* setUp
|
||||||
*
|
*
|
||||||
|
@ -127,7 +128,6 @@ class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that coverage works with phpunit 3.6 as the data formats from coverage are totally different.
|
* Test that coverage works with phpunit 3.6 as the data formats from coverage are totally different.
|
||||||
*
|
*
|
||||||
|
@ -198,7 +198,6 @@ class HtmlCoverageReportTest extends CakeTestCase {
|
||||||
5 => -1
|
5 => -1
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
|
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
|
|
|
@ -49,6 +49,7 @@ class CacheTestController extends Controller {
|
||||||
$this->set('batman', 'bruce wayne');
|
$this->set('batman', 'bruce wayne');
|
||||||
$this->set('spiderman', 'peter parker');
|
$this->set('spiderman', 'peter parker');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +85,7 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
Configure::write('Cache.check', true);
|
Configure::write('Cache.check', true);
|
||||||
Configure::write('Cache.disable', false);
|
Configure::write('Cache.disable', false);
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
), App::RESET);
|
), App::RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +381,6 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
|
|
||||||
|
|
||||||
$this->Controller->cache_parsing();
|
$this->Controller->cache_parsing();
|
||||||
$this->Controller->cacheAction = array(
|
$this->Controller->cacheAction = array(
|
||||||
'cache_parsing' => 21600
|
'cache_parsing' => 21600
|
||||||
|
@ -398,7 +398,6 @@ class CacheHelperTest extends CakeTestCase {
|
||||||
$this->assertTrue(file_exists($filename));
|
$this->assertTrue(file_exists($filename));
|
||||||
@unlink($filename);
|
@unlink($filename);
|
||||||
|
|
||||||
|
|
||||||
$this->Controller->cache_parsing();
|
$this->Controller->cache_parsing();
|
||||||
$this->Controller->request->addParams(array(
|
$this->Controller->request->addParams(array(
|
||||||
'controller' => 'cache_test',
|
'controller' => 'cache_test',
|
||||||
|
|
|
@ -182,6 +182,7 @@ class ContactTagsContact extends CakeTestModel {
|
||||||
public function setSchema($schema) {
|
public function setSchema($schema) {
|
||||||
$this->_schema = $schema;
|
$this->_schema = $schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,6 +218,7 @@ class ContactNonStandardPk extends Contact {
|
||||||
unset($this->_schema['id']);
|
unset($this->_schema['id']);
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -369,6 +371,7 @@ class OpenidUrl extends CakeTestModel {
|
||||||
$this->invalidate('openid_not_registered');
|
$this->invalidate('openid_not_registered');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -432,6 +435,7 @@ class ValidateUser extends CakeTestModel {
|
||||||
$this->invalidate('email');
|
$this->invalidate('email');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -505,6 +509,7 @@ class ValidateProfile extends CakeTestModel {
|
||||||
$this->invalidate('city');
|
$this->invalidate('city');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -568,6 +573,7 @@ class ValidateItem extends CakeTestModel {
|
||||||
$this->invalidate('description');
|
$this->invalidate('description');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -675,8 +681,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
Configure::write('Security.salt', $this->oldSalt);
|
Configure::write('Security.salt', $this->oldSalt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testFormCreateWithSecurity method
|
* testFormCreateWithSecurity method
|
||||||
*
|
*
|
||||||
|
@ -975,7 +979,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->assertEquals(array('Address.button'), $result);
|
$this->assertEquals(array('Address.button'), $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that submit inputs created with foo[bar] name attributes are unlocked correctly.
|
* Test that submit inputs created with foo[bar] name attributes are unlocked correctly.
|
||||||
*
|
*
|
||||||
|
@ -1093,6 +1096,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->Form->create('Address');
|
$this->Form->create('Address');
|
||||||
$this->Form->input('Address.primary.1');
|
$this->Form->input('Address.primary.1');
|
||||||
$this->assertEquals('Address.primary', $this->Form->fields[0]);
|
$this->assertEquals('Address.primary', $this->Form->fields[0]);
|
||||||
|
|
||||||
|
$this->Form->input('Address.secondary.1.0');
|
||||||
|
$this->assertEquals('Address.secondary', $this->Form->fields[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1469,7 +1475,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testTagIsInvalid() {
|
public function testTagIsInvalid() {
|
||||||
$Contact = ClassRegistry::getObject('Contact');
|
$Contact = ClassRegistry::getObject('Contact');
|
||||||
$Contact->validationErrors[0]['email'] = array('Please provide an email');
|
$Contact->validationErrors[0]['email'] = array('Please provide an email');
|
||||||
|
|
||||||
$this->Form->setEntity('Contact.0.email');
|
$this->Form->setEntity('Contact.0.email');
|
||||||
$result = $this->Form->tagIsInvalid();
|
$result = $this->Form->tagIsInvalid();
|
||||||
|
@ -1496,7 +1502,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testPasswordValidation() {
|
public function testPasswordValidation() {
|
||||||
$Contact = ClassRegistry::getObject('Contact');
|
$Contact = ClassRegistry::getObject('Contact');
|
||||||
$Contact->validationErrors['password'] = array('Please provide a password');
|
$Contact->validationErrors['password'] = array('Please provide a password');
|
||||||
|
|
||||||
$result = $this->Form->input('Contact.password');
|
$result = $this->Form->input('Contact.password');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -2389,7 +2395,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
|
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
|
||||||
$this->Form->request->data = array('Model' => array('user_id' => 'value'));
|
$this->Form->request->data = array('Model' => array('user_id' => 'value'));
|
||||||
|
|
||||||
|
@ -5271,7 +5276,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->assertContains('label for="ModelDateYear"', $result);
|
$this->assertContains('label for="ModelDateYear"', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testMonth method
|
* testMonth method
|
||||||
*
|
*
|
||||||
|
@ -5613,7 +5617,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = $this->Form->hour('Model.field', true, array('value' => 'now'));
|
$result = $this->Form->hour('Model.field', true, array('value' => 'now'));
|
||||||
$thisHour = date('H');
|
$thisHour = date('H');
|
||||||
$optValue = date('G');
|
$optValue = date('G');
|
||||||
$this->assertRegExp('/<option value="' . $thisHour . '" selected="selected">'. $optValue .'<\/option>/', $result);
|
$this->assertRegExp('/<option value="' . $thisHour . '" selected="selected">' . $optValue . '<\/option>/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5943,7 +5947,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Form->button('No type', array('type' => false));
|
$result = $this->Form->button('No type', array('type' => false));
|
||||||
$this->assertTags($result, array('button' => array(), 'No type', '/button'));
|
$this->assertTags($result, array('button' => array(), 'No type', '/button'));
|
||||||
|
|
||||||
$result = $this->Form->button('Upload Text', array('onClick' => "$('#postAddForm').ajaxSubmit({target: '#postTextUpload', url: '/posts/text'});return false;'", 'escape' => false));
|
$result = $this->Form->button('Upload Text', array('onClick' => "$('#postAddForm').ajaxSubmit({target: '#postTextUpload', url: '/posts/text'});return false;'", 'escape' => false));
|
||||||
$this->assertNotRegExp('/\&039/', $result);
|
$this->assertNotRegExp('/\&039/', $result);
|
||||||
}
|
}
|
||||||
|
@ -6459,7 +6463,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'/div'
|
'/div'
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6572,8 +6575,12 @@ class FormHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testCreateWithInputDefaults() {
|
public function testCreateWithInputDefaults() {
|
||||||
$this->Form->create('User', array(
|
$this->Form->create('User', array(
|
||||||
'inputDefaults' => array('div' => false, 'label' => false, 'error' => array('attributes'=>array('wrap' => 'small', 'class' => 'error')))
|
'inputDefaults' => array(
|
||||||
));
|
'div' => false,
|
||||||
|
'label' => false,
|
||||||
|
'error' => array('attributes' => array('wrap' => 'small', 'class' => 'error'))
|
||||||
|
)
|
||||||
|
));
|
||||||
$result = $this->Form->input('username');
|
$result = $this->Form->input('username');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'input' => array('type' => 'text', 'name' => 'data[User][username]', 'id' => 'UserUsername')
|
'input' => array('type' => 'text', 'name' => 'data[User][username]', 'id' => 'UserUsername')
|
||||||
|
@ -6588,7 +6595,7 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'/div'
|
'/div'
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$User = ClassRegistry::getObject('User');
|
$User = ClassRegistry::getObject('User');
|
||||||
$User->validationErrors['username'] = array('empty');
|
$User->validationErrors['username'] = array('empty');
|
||||||
$result = $this->Form->input('username', array('div' => true, 'label' => 'username', 'error' => array('empty' => __('Required'))));
|
$result = $this->Form->input('username', array('div' => true, 'label' => 'username', 'error' => array('empty' => __('Required'))));
|
||||||
|
@ -7058,7 +7065,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
extract($this->dateRegex);
|
extract($this->dateRegex);
|
||||||
$now = strtotime('now');
|
$now = strtotime('now');
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ class TheHtmlTestController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestHtmlHelper extends HtmlHelper {
|
class TestHtmlHelper extends HtmlHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* expose a method as public
|
* expose a method as public
|
||||||
*
|
*
|
||||||
|
@ -150,7 +151,7 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$this->Html->request->webroot = '';
|
$this->Html->request->webroot = '';
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'. DS)
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
||||||
));
|
));
|
||||||
|
|
||||||
Configure::write('Asset.timestamp', false);
|
Configure::write('Asset.timestamp', false);
|
||||||
|
@ -404,7 +405,7 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$File = new File($testfile, true);
|
$File = new File($testfile, true);
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
Configure::write('Asset.timestamp', true);
|
Configure::write('Asset.timestamp', true);
|
||||||
Configure::write('debug', 1);
|
Configure::write('debug', 1);
|
||||||
|
@ -442,7 +443,7 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testThemeAssetsInMainWebrootPath() {
|
public function testThemeAssetsInMainWebrootPath() {
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
$webRoot = Configure::read('App.www_root');
|
$webRoot = Configure::read('App.www_root');
|
||||||
Configure::write('App.www_root', CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS);
|
Configure::write('App.www_root', CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS);
|
||||||
|
@ -800,10 +801,9 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.2.js', 'defer' => 'defer', 'encoding' => 'utf-8')
|
'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.2.js', 'defer' => 'defer', 'encoding' => 'utf-8')
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that plugin scripts added with uses() are only ever included once.
|
* test that plugin scripts added with uses() are only ever included once.
|
||||||
* test script tag generation with plugin syntax
|
* test script tag generation with plugin syntax
|
||||||
*
|
*
|
||||||
|
@ -933,7 +933,7 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$File = new File($testfile, true);
|
$File = new File($testfile, true);
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->Html->webroot = '/';
|
$this->Html->webroot = '/';
|
||||||
|
@ -987,7 +987,6 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->View->expects($this->at(0))
|
$this->View->expects($this->at(0))
|
||||||
->method('append')
|
->method('append')
|
||||||
->with('script', $this->matchesRegularExpression('/window\.foo\s\=\s2;/'));
|
->with('script', $this->matchesRegularExpression('/window\.foo\s\=\s2;/'));
|
||||||
|
@ -1031,7 +1030,6 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$result = $this->Html->scriptStart(array('safe' => false));
|
$result = $this->Html->scriptStart(array('safe' => false));
|
||||||
$this->assertNull($result);
|
$this->assertNull($result);
|
||||||
echo 'this is some javascript';
|
echo 'this is some javascript';
|
||||||
|
@ -1116,7 +1114,6 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->Html->addCrumb('Fourth', null);
|
$this->Html->addCrumb('Fourth', null);
|
||||||
|
|
||||||
$result = $this->Html->getCrumbs();
|
$result = $this->Html->getCrumbs();
|
||||||
|
@ -1164,6 +1161,18 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
* Test the array form of $startText
|
* Test the array form of $startText
|
||||||
*/
|
*/
|
||||||
public function testGetCrumbFirstLink() {
|
public function testGetCrumbFirstLink() {
|
||||||
|
$result = $this->Html->getCrumbList(null, 'Home');
|
||||||
|
$this->assertTags(
|
||||||
|
$result,
|
||||||
|
array(
|
||||||
|
'<ul',
|
||||||
|
array('li' => array('class' => 'first')),
|
||||||
|
array('a' => array('href' => '/')), 'Home', '/a',
|
||||||
|
'/li',
|
||||||
|
'/ul'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$this->Html->addCrumb('First', '#first');
|
$this->Html->addCrumb('First', '#first');
|
||||||
$this->Html->addCrumb('Second', '#second');
|
$this->Html->addCrumb('Second', '#second');
|
||||||
|
|
||||||
|
@ -1502,14 +1511,11 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$this->assertTags($result, array('meta' => array('name' => 'keywords', 'content' => 'these, are, some, meta, keywords')));
|
$this->assertTags($result, array('meta' => array('name' => 'keywords', 'content' => 'these, are, some, meta, keywords')));
|
||||||
$this->assertRegExp('/\s+\/>$/', $result);
|
$this->assertRegExp('/\s+\/>$/', $result);
|
||||||
|
|
||||||
|
|
||||||
$result = $this->Html->meta('description', 'this is the meta description');
|
$result = $this->Html->meta('description', 'this is the meta description');
|
||||||
$this->assertTags($result, array('meta' => array('name' => 'description', 'content' => 'this is the meta description')));
|
$this->assertTags($result, array('meta' => array('name' => 'description', 'content' => 'this is the meta description')));
|
||||||
|
|
||||||
$result = $this->Html->meta(array('name' => 'ROBOTS', 'content' => 'ALL'));
|
$result = $this->Html->meta(array('name' => 'ROBOTS', 'content' => 'ALL'));
|
||||||
$this->assertTags($result, array('meta' => array('name' => 'ROBOTS', 'content' => 'ALL')));
|
$this->assertTags($result, array('meta' => array('name' => 'ROBOTS', 'content' => 'ALL')));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1788,46 +1794,46 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* Test getCrumbList startText
|
* Test getCrumbList startText
|
||||||
*/
|
*/
|
||||||
public function testCrumbListFirstLink() {
|
public function testCrumbListFirstLink() {
|
||||||
$this->Html->addCrumb('First', '#first');
|
$this->Html->addCrumb('First', '#first');
|
||||||
$this->Html->addCrumb('Second', '#second');
|
$this->Html->addCrumb('Second', '#second');
|
||||||
|
|
||||||
$result = $this->Html->getCrumbList(null, 'Home');
|
$result = $this->Html->getCrumbList(null, 'Home');
|
||||||
$this->assertTags(
|
$this->assertTags(
|
||||||
$result,
|
$result,
|
||||||
array(
|
array(
|
||||||
'<ul',
|
'<ul',
|
||||||
array('li' => array('class' => 'first')),
|
array('li' => array('class' => 'first')),
|
||||||
array('a' => array('href' => '/')), 'Home', '/a',
|
array('a' => array('href' => '/')), 'Home', '/a',
|
||||||
'/li',
|
'/li',
|
||||||
'<li',
|
'<li',
|
||||||
array('a' => array('href' => '#first')), 'First', '/a',
|
array('a' => array('href' => '#first')), 'First', '/a',
|
||||||
'/li',
|
'/li',
|
||||||
array('li' => array('class' => 'last')),
|
array('li' => array('class' => 'last')),
|
||||||
array('a' => array('href' => '#second')), 'Second', '/a',
|
array('a' => array('href' => '#second')), 'Second', '/a',
|
||||||
'/li',
|
'/li',
|
||||||
'/ul'
|
'/ul'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $this->Html->getCrumbList(null, array('url' => '/home', 'text' => '<img src="/home.png" />', 'escape' => false));
|
$result = $this->Html->getCrumbList(null, array('url' => '/home', 'text' => '<img src="/home.png" />', 'escape' => false));
|
||||||
$this->assertTags(
|
$this->assertTags(
|
||||||
$result,
|
$result,
|
||||||
array(
|
array(
|
||||||
'<ul',
|
'<ul',
|
||||||
array('li' => array('class' => 'first')),
|
array('li' => array('class' => 'first')),
|
||||||
array('a' => array('href' => '/home')), 'img' => array('src' => '/home.png'), '/a',
|
array('a' => array('href' => '/home')), 'img' => array('src' => '/home.png'), '/a',
|
||||||
'/li',
|
'/li',
|
||||||
'<li',
|
'<li',
|
||||||
array('a' => array('href' => '#first')), 'First', '/a',
|
array('a' => array('href' => '#first')), 'First', '/a',
|
||||||
'/li',
|
'/li',
|
||||||
array('li' => array('class' => 'last')),
|
array('li' => array('class' => 'last')),
|
||||||
array('a' => array('href' => '#second')), 'Second', '/a',
|
array('a' => array('href' => '#second')), 'Second', '/a',
|
||||||
'/li',
|
'/li',
|
||||||
'/ul'
|
'/ul'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testLoadConfig method
|
* testLoadConfig method
|
||||||
|
@ -1836,7 +1842,7 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function testLoadConfig() {
|
public function testLoadConfig() {
|
||||||
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
|
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
|
||||||
|
|
||||||
$result = $this->Html->loadConfig('htmlhelper_tags', $path);
|
$result = $this->Html->loadConfig('htmlhelper_tags', $path);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -1876,7 +1882,7 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
* @expectedException ConfigureException
|
* @expectedException ConfigureException
|
||||||
*/
|
*/
|
||||||
public function testLoadConfigWrongReader() {
|
public function testLoadConfigWrongReader() {
|
||||||
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config'. DS;
|
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS;
|
||||||
$result = $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path);
|
$result = $this->Html->loadConfig(array('htmlhelper_tags', 'wrong_reader'), $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ App::uses('JqueryEngineHelper', 'View/Helper');
|
||||||
App::uses('View', 'View');
|
App::uses('View', 'View');
|
||||||
|
|
||||||
class JqueryEngineHelperTest extends CakeTestCase {
|
class JqueryEngineHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp
|
* setUp
|
||||||
*
|
*
|
||||||
|
|
|
@ -26,12 +26,15 @@ App::uses('View', 'View');
|
||||||
App::uses('ClassRegistry', 'Utility');
|
App::uses('ClassRegistry', 'Utility');
|
||||||
|
|
||||||
class JsEncodingObject {
|
class JsEncodingObject {
|
||||||
|
|
||||||
protected $_title = 'Old thing';
|
protected $_title = 'Old thing';
|
||||||
|
|
||||||
private $__noshow = 'Never ever';
|
private $__noshow = 'Never ever';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class OptionEngineHelper extends JsBaseEngineHelper {
|
class OptionEngineHelper extends JsBaseEngineHelper {
|
||||||
|
|
||||||
protected $_optionMap = array(
|
protected $_optionMap = array(
|
||||||
'request' => array(
|
'request' => array(
|
||||||
'complete' => 'success',
|
'complete' => 'success',
|
||||||
|
@ -58,17 +61,39 @@ class OptionEngineHelper extends JsBaseEngineHelper {
|
||||||
return $this->_parseOptions($options, $safe);
|
return $this->_parseOptions($options, $safe);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($selector) {}
|
public function get($selector) {
|
||||||
public function event($type, $callback, $options = array()) {}
|
}
|
||||||
public function domReady($functionBody) {}
|
|
||||||
public function each($callback) {}
|
public function event($type, $callback, $options = array()) {
|
||||||
public function effect($name, $options = array()) {}
|
}
|
||||||
public function request($url, $options = array()) {}
|
|
||||||
public function drag($options = array()) {}
|
public function domReady($functionBody) {
|
||||||
public function drop($options = array()) {}
|
}
|
||||||
public function sortable($options = array()) {}
|
|
||||||
public function slider($options = array()) {}
|
public function each($callback) {
|
||||||
public function serializeForm($options = array()) {}
|
}
|
||||||
|
|
||||||
|
public function effect($name, $options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function request($url, $options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function drag($options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function drop($options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sortable($options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function slider($options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function serializeForm($options = array()) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +102,7 @@ class OptionEngineHelper extends JsBaseEngineHelper {
|
||||||
* @package Cake.Test.Case.View.Helper
|
* @package Cake.Test.Case.View.Helper
|
||||||
*/
|
*/
|
||||||
class JsHelperTest extends CakeTestCase {
|
class JsHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regexp for CDATA start block
|
* Regexp for CDATA start block
|
||||||
*
|
*
|
||||||
|
@ -91,7 +117,6 @@ class JsHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public $cDataEnd = 'preg:/[^\]]*\]\]\>[\s\r\n]*/';
|
public $cDataEnd = 'preg:/[^\]]*\]\]\>[\s\r\n]*/';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
|
@ -689,6 +714,7 @@ class JsHelperTest extends CakeTestCase {
|
||||||
$this->assertEquals($result[1], 'alert("hey you!");');
|
$this->assertEquals($result[1], 'alert("hey you!");');
|
||||||
$this->assertEquals($result[2], 'confirm("Are you sure?");');
|
$this->assertEquals($result[2], 'confirm("Are you sure?");');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -697,6 +723,7 @@ class JsHelperTest extends CakeTestCase {
|
||||||
* @package Cake.Test.Case.View.Helper
|
* @package Cake.Test.Case.View.Helper
|
||||||
*/
|
*/
|
||||||
class JsBaseEngineTest extends CakeTestCase {
|
class JsBaseEngineTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp method
|
* setUp method
|
||||||
*
|
*
|
||||||
|
@ -812,7 +839,6 @@ class JsBaseEngineTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testObject() {
|
public function testObject() {
|
||||||
|
|
||||||
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8));
|
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8));
|
||||||
$result = $this->JsEngine->object($object);
|
$result = $this->JsEngine->object($object);
|
||||||
$expected = '{"title":"New thing","indexes":[5,6,7,8]}';
|
$expected = '{"title":"New thing","indexes":[5,6,7,8]}';
|
||||||
|
|
|
@ -22,6 +22,7 @@ App::uses('JsHelper', 'View/Helper');
|
||||||
App::uses('MootoolsEngineHelper', 'View/Helper');
|
App::uses('MootoolsEngineHelper', 'View/Helper');
|
||||||
|
|
||||||
class MootoolsEngineHelperTest extends CakeTestCase {
|
class MootoolsEngineHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp
|
* setUp
|
||||||
*
|
*
|
||||||
|
|
|
@ -68,7 +68,6 @@ class NumberHelperTest extends CakeTestCase {
|
||||||
unset($this->View);
|
unset($this->View);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test CakeNumber class methods are called correctly
|
* test CakeNumber class methods are called correctly
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -212,13 +212,11 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
$this->assertRegExp('/\/accounts\/index\/param\/page:1\/sort:title\/direction:asc" class="desc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'asc'));
|
||||||
$this->assertRegExp('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
$this->assertRegExp('/\/accounts\/index\/param\/page:1\/sort:title\/direction:desc" class="asc">Title<\/a>$/', $result);
|
||||||
|
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
|
||||||
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
|
||||||
|
@ -330,7 +328,6 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
|
||||||
$result = $this->Paginator->sort('Article.title', 'Title');
|
$result = $this->Paginator->sort('Article.title', 'Title');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
|
@ -1344,7 +1341,6 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->Paginator->request->params['paging'] = array(
|
$this->Paginator->request->params['paging'] = array(
|
||||||
'Client' => array(
|
'Client' => array(
|
||||||
'page' => 14,
|
'page' => 14,
|
||||||
|
@ -1417,7 +1413,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
|
array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$result = $this->Paginator->numbers(array('first' => 1, 'currentClass' => 'active'));
|
$result = $this->Paginator->numbers(array('first' => 1, 'currentClass' => 'active'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
|
array('span' => array()), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
|
||||||
|
@ -1439,7 +1435,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
|
array('span' => array()), array('a' => array('href' => '/index/page:9')), '9', '/a', '/span',
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$result = $this->Paginator->numbers(array('first' => 1, 'class' => 'page-link', 'currentClass' => 'active'));
|
$result = $this->Paginator->numbers(array('first' => 1, 'class' => 'page-link', 'currentClass' => 'active'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
|
array('span' => array('class' => 'page-link')), array('a' => array('href' => '/index/page:1')), '1', '/a', '/span',
|
||||||
|
@ -1699,7 +1695,6 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
|
||||||
$this->Paginator->request->params['paging'] = array(
|
$this->Paginator->request->params['paging'] = array(
|
||||||
'Client' => array(
|
'Client' => array(
|
||||||
'page' => 4895,
|
'page' => 4895,
|
||||||
|
|
|
@ -22,6 +22,7 @@ App::uses('JsHelper', 'View/Helper');
|
||||||
App::uses('PrototypeEngineHelper', 'View/Helper');
|
App::uses('PrototypeEngineHelper', 'View/Helper');
|
||||||
|
|
||||||
class PrototypeEngineHelperTest extends CakeTestCase {
|
class PrototypeEngineHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp
|
* setUp
|
||||||
*
|
*
|
||||||
|
|
|
@ -377,7 +377,7 @@ class RssHelperTest extends CakeTestCase {
|
||||||
'url' => 'http://example.com/foo?a=1&b=2',
|
'url' => 'http://example.com/foo?a=1&b=2',
|
||||||
'convertEntities' => false
|
'convertEntities' => false
|
||||||
),
|
),
|
||||||
'description' => array(
|
'description' => array(
|
||||||
'value' => 'descriptive words',
|
'value' => 'descriptive words',
|
||||||
'cdata' => true,
|
'cdata' => true,
|
||||||
),
|
),
|
||||||
|
|
|
@ -128,7 +128,7 @@ class SessionHelperTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
$result = $this->Session->flash('notification');
|
$result = $this->Session->flash('notification');
|
||||||
$result = str_replace("\r\n", "\n", $result);
|
$result = str_replace("\r\n", "\n", $result);
|
||||||
|
@ -161,7 +161,7 @@ class SessionHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testFlashElementInAttrs() {
|
public function testFlashElementInAttrs() {
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
$result = $this->Session->flash('flash', array(
|
$result = $this->Session->flash('flash', array(
|
||||||
'element' => 'session_helper',
|
'element' => 'session_helper',
|
||||||
|
@ -178,7 +178,7 @@ class SessionHelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testFlashWithPluginElement() {
|
public function testFlashWithPluginElement() {
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'. DS)
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
|
||||||
));
|
));
|
||||||
CakePlugin::load('TestPlugin');
|
CakePlugin::load('TestPlugin');
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ class HtmlAliasHelper extends HtmlHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
class HelperCollectionTest extends CakeTestCase {
|
class HelperCollectionTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setUp
|
* setUp
|
||||||
*
|
*
|
||||||
|
|
|
@ -93,6 +93,7 @@ class HelperTestComment extends Model {
|
||||||
);
|
);
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,6 +124,7 @@ class HelperTestTag extends Model {
|
||||||
);
|
);
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,9 +153,11 @@ class HelperTestPostsTag extends Model {
|
||||||
);
|
);
|
||||||
return $this->_schema;
|
return $this->_schema;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestHelper extends Helper {
|
class TestHelper extends Helper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helpers for this helper.
|
* Helpers for this helper.
|
||||||
*
|
*
|
||||||
|
@ -173,6 +177,7 @@ class TestHelper extends Helper {
|
||||||
public function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
|
public function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
|
||||||
return $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter);
|
return $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -644,12 +649,12 @@ class HelperTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAssetTimestampPluginsAndThemes() {
|
public function testAssetTimestampPluginsAndThemes() {
|
||||||
$_timestamp = Configure::read('Asset.timestamp');
|
$timestamp = Configure::read('Asset.timestamp');
|
||||||
Configure::write('Asset.timestamp', 'force');
|
Configure::write('Asset.timestamp', 'force');
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS),
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS),
|
||||||
));
|
));
|
||||||
CakePlugin::load(array('TestPlugin'));;
|
CakePlugin::load(array('TestPlugin'));
|
||||||
|
|
||||||
$result = $this->Helper->assetTimestamp('/test_plugin/css/test_plugin_asset.css');
|
$result = $this->Helper->assetTimestamp('/test_plugin/css/test_plugin_asset.css');
|
||||||
$this->assertRegExp('#/test_plugin/css/test_plugin_asset.css\?[0-9]+$#', $result, 'Missing timestamp plugin');
|
$this->assertRegExp('#/test_plugin/css/test_plugin_asset.css\?[0-9]+$#', $result, 'Missing timestamp plugin');
|
||||||
|
@ -664,7 +669,7 @@ class HelperTest extends CakeTestCase {
|
||||||
$this->assertRegExp('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file');
|
$this->assertRegExp('#/theme/test_theme/js/non_existant.js\?$#', $result, 'No error on missing file');
|
||||||
|
|
||||||
App::build();
|
App::build();
|
||||||
Configure::write('Asset.timestamp', $_timestamp);
|
Configure::write('Asset.timestamp', $timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -834,7 +839,7 @@ class HelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->Helper->request->data['My']['title'] = 'My Title';
|
$this->Helper->request->data['My']['title'] = 'My Title';
|
||||||
$result = $this->Helper->value('My.title');
|
$result = $this->Helper->value('My.title');
|
||||||
$this->assertEquals($result,'My Title');
|
$this->assertEquals($result, 'My Title');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWebrootPaths() {
|
public function testWebrootPaths() {
|
||||||
|
@ -846,7 +851,7 @@ class HelperTest extends CakeTestCase {
|
||||||
$this->Helper->theme = 'test_theme';
|
$this->Helper->theme = 'test_theme';
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
|
|
||||||
$result = $this->Helper->webroot('/img/cake.power.gif');
|
$result = $this->Helper->webroot('/img/cake.power.gif');
|
||||||
|
@ -916,10 +921,11 @@ class HelperTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testLazyLoadingUsesReferences() {
|
public function testLazyLoadingUsesReferences() {
|
||||||
$Helper = new TestHelper($this->View);
|
$Helper = new TestHelper($this->View);
|
||||||
$result1 = $Helper->Html;
|
$resultA = $Helper->Html;
|
||||||
$result2 = $Helper->Html;
|
$resultB = $Helper->Html;
|
||||||
|
|
||||||
$result1->testprop = 1;
|
$resultA->testprop = 1;
|
||||||
$this->assertEquals($result1->testprop, $result2->testprop);
|
$this->assertEquals($resultA->testprop, $resultB->testprop);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ class JsonViewTest extends CakeTestCase {
|
||||||
$View = new JsonView($Controller);
|
$View = new JsonView($Controller);
|
||||||
$output = $View->render(false);
|
$output = $View->render(false);
|
||||||
|
|
||||||
$this->assertIdentical(json_encode(array('no' =>$data['no'], 'user' => $data['user'])), $output);
|
$this->assertIdentical(json_encode(array('no' => $data['no'], 'user' => $data['user'])), $output);
|
||||||
$this->assertIdentical('application/json', $Response->type());
|
$this->assertIdentical('application/json', $Response->type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testRender() {
|
public function testRender() {
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS .'css' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS . 'css' . DS,
|
||||||
'id' => 'test_asset.css',
|
'id' => 'test_asset.css',
|
||||||
'extension' => 'css',
|
'extension' => 'css',
|
||||||
);
|
);
|
||||||
|
@ -117,7 +117,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Some generic browser';
|
$_SERVER['HTTP_USER_AGENT'] = 'Some generic browser';
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS,
|
||||||
'id' => 'no_section.ini',
|
'id' => 'no_section.ini',
|
||||||
'extension' => 'ini',
|
'extension' => 'ini',
|
||||||
);
|
);
|
||||||
|
@ -176,7 +176,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Opera/9.80 (Windows NT 6.0; U; en) Presto/2.8.99 Version/11.10';
|
$_SERVER['HTTP_USER_AGENT'] = 'Opera/9.80 (Windows NT 6.0; U; en) Presto/2.8.99 Version/11.10';
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS,
|
||||||
'id' => 'no_section.ini',
|
'id' => 'no_section.ini',
|
||||||
'extension' => 'ini',
|
'extension' => 'ini',
|
||||||
);
|
);
|
||||||
|
@ -240,7 +240,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
$currentUserAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
|
||||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)';
|
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)';
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Config' . DS,
|
||||||
'id' => 'no_section.ini',
|
'id' => 'no_section.ini',
|
||||||
'extension' => 'ini',
|
'extension' => 'ini',
|
||||||
'name' => 'config'
|
'name' => 'config'
|
||||||
|
@ -303,7 +303,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testConnectionAborted() {
|
public function testConnectionAborted() {
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS .'css' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS . 'css' . DS,
|
||||||
'id' => 'test_asset.css',
|
'id' => 'test_asset.css',
|
||||||
'extension' => 'css',
|
'extension' => 'css',
|
||||||
);
|
);
|
||||||
|
@ -326,7 +326,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testConnectionAbortedOnBuffering() {
|
public function testConnectionAbortedOnBuffering() {
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS .'css' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS . 'css' . DS,
|
||||||
'id' => 'test_asset.css',
|
'id' => 'test_asset.css',
|
||||||
'extension' => 'css',
|
'extension' => 'css',
|
||||||
);
|
);
|
||||||
|
@ -359,7 +359,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testRenderUpperExtension() {
|
public function testRenderUpperExtension() {
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS .'img' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS . 'img' . DS,
|
||||||
'id' => 'test_2.JPG',
|
'id' => 'test_2.JPG',
|
||||||
'extension' => 'JPG',
|
'extension' => 'JPG',
|
||||||
);
|
);
|
||||||
|
@ -383,7 +383,7 @@ class MediaViewTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testRenderExtensionNotSet() {
|
public function testRenderExtensionNotSet() {
|
||||||
$this->MediaView->viewVars = array(
|
$this->MediaView->viewVars = array(
|
||||||
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS .'img' . DS,
|
'path' => CAKE . 'Test' . DS . 'test_app' . DS . 'Vendor' . DS . 'img' . DS,
|
||||||
'id' => 'test_2.JPG',
|
'id' => 'test_2.JPG',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ class TestScaffoldView extends ScaffoldView {
|
||||||
public function testGetFilename($action) {
|
public function testGetFilename($action) {
|
||||||
return $this->_getViewFileName($action);
|
return $this->_getViewFileName($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +142,7 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $ScaffoldView->testGetFilename('admin_edit');
|
$result = $ScaffoldView->testGetFilename('admin_edit');
|
||||||
$expected =CAKE . 'View' . DS . 'Scaffolds' . DS . 'form.ctp';
|
$expected = CAKE . 'View' . DS . 'Scaffolds' . DS . 'form.ctp';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $ScaffoldView->testGetFilename('admin_add');
|
$result = $ScaffoldView->testGetFilename('admin_add');
|
||||||
|
@ -159,11 +160,11 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$ScaffoldView = new TestScaffoldView($Controller);
|
$ScaffoldView = new TestScaffoldView($Controller);
|
||||||
$result = $ScaffoldView->testGetFilename('admin_edit');
|
$result = $ScaffoldView->testGetFilename('admin_edit');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' .DS . 'View' . DS . 'Posts' . DS . 'scaffold.form.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'scaffold.form.ctp';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $ScaffoldView->testGetFilename('edit');
|
$result = $ScaffoldView->testGetFilename('edit');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' .DS . 'View' . DS . 'Posts' . DS . 'scaffold.form.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'scaffold.form.ctp';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$Controller = new ScaffoldViewMockController($this->request);
|
$Controller = new ScaffoldViewMockController($this->request);
|
||||||
|
@ -178,13 +179,13 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$ScaffoldView = new TestScaffoldView($Controller);
|
$ScaffoldView = new TestScaffoldView($Controller);
|
||||||
$result = $ScaffoldView->testGetFilename('admin_add');
|
$result = $ScaffoldView->testGetFilename('admin_add');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' .
|
||||||
. DS .'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
|
DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$result = $ScaffoldView->testGetFilename('add');
|
$result = $ScaffoldView->testGetFilename('add');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' .
|
||||||
. DS .'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
|
DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
Configure::write('Routing.prefixes', $_admin);
|
Configure::write('Routing.prefixes', $_admin);
|
||||||
|
@ -202,8 +203,8 @@ class ScaffoldViewTest extends CakeTestCase {
|
||||||
$ScaffoldView = new TestScaffoldView($this->Controller);
|
$ScaffoldView = new TestScaffoldView($this->Controller);
|
||||||
|
|
||||||
$result = $ScaffoldView->testGetFilename('index');
|
$result = $ScaffoldView->testGetFilename('index');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .
|
||||||
. 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'scaffold.index.ctp';
|
'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'scaffold.index.ctp';
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ class ThemePosts2Controller extends Controller {
|
||||||
$test3 = 'even more data';
|
$test3 = 'even more data';
|
||||||
$this->set(compact('test2', 'test3'));
|
$this->set(compact('test2', 'test3'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,7 +113,7 @@ class ThemeViewTest extends CakeTestCase {
|
||||||
$this->ThemeView = new ThemeView($this->PostsController);
|
$this->ThemeView = new ThemeView($this->PostsController);
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
App::objects('plugins', null, false);
|
App::objects('plugins', null, false);
|
||||||
CakePlugin::load(array('TestPlugin'));
|
CakePlugin::load(array('TestPlugin'));
|
||||||
|
@ -144,15 +145,15 @@ class ThemeViewTest extends CakeTestCase {
|
||||||
$this->Controller->theme = 'TestTheme';
|
$this->Controller->theme = 'TestTheme';
|
||||||
|
|
||||||
$ThemeView = new TestTheme2View($this->Controller);
|
$ThemeView = new TestTheme2View($this->Controller);
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS . 'index.ctp';
|
||||||
$result = $ThemeView->getViewFileName('index');
|
$result = $ThemeView->getViewFileName('index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Layouts' . DS . 'plugin_default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName('plugin_default');
|
$result = $ThemeView->getLayoutFileName('plugin_default');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName('default');
|
$result = $ThemeView->getLayoutFileName('default');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -171,15 +172,15 @@ class ThemeViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$ThemeView = new TestTheme2View($this->Controller);
|
$ThemeView = new TestTheme2View($this->Controller);
|
||||||
$ThemeView->theme = 'TestTheme';
|
$ThemeView->theme = 'TestTheme';
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
|
||||||
$result = $ThemeView->getViewFileName('home');
|
$result = $ThemeView->getViewFileName('home');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'index.ctp';
|
||||||
$result = $ThemeView->getViewFileName('/Posts/index');
|
$result = $ThemeView->getViewFileName('/Posts/index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName();
|
$result = $ThemeView->getLayoutFileName();
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ class ViewPostsController extends Controller {
|
||||||
$this->set('foo', 'this is foo var');
|
$this->set('foo', 'this is foo var');
|
||||||
$this->set('bar', 'this is bar var');
|
$this->set('bar', 'this is bar var');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,6 +96,7 @@ class ThemePostsController extends Controller {
|
||||||
$test3 = 'even more data';
|
$test3 = 'even more data';
|
||||||
$this->set(compact('test2', 'test3'));
|
$this->set(compact('test2', 'test3'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,6 +198,7 @@ class TestView extends View {
|
||||||
public function scripts() {
|
public function scripts() {
|
||||||
return $this->_scripts;
|
return $this->_scripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -229,6 +232,7 @@ class TestAfterHelper extends Helper {
|
||||||
public function afterLayout($layoutFile) {
|
public function afterLayout($layoutFile) {
|
||||||
$this->_View->output .= 'modified in the afterlife';
|
$this->_View->output .= 'modified in the afterlife';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,7 +274,7 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
), App::RESET);
|
), App::RESET);
|
||||||
App::objects('plugins', null, false);
|
App::objects('plugins', null, false);
|
||||||
|
|
||||||
|
@ -292,8 +296,8 @@ class ViewTest extends CakeTestCase {
|
||||||
unset($this->ThemeView);
|
unset($this->ThemeView);
|
||||||
unset($this->ThemePostsController);
|
unset($this->ThemePostsController);
|
||||||
unset($this->ThemeController);
|
unset($this->ThemeController);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testGetTemplate method
|
* testGetTemplate method
|
||||||
*
|
*
|
||||||
|
@ -308,15 +312,15 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$ThemeView = new TestThemeView($this->Controller);
|
$ThemeView = new TestThemeView($this->Controller);
|
||||||
$ThemeView->theme = 'TestTheme';
|
$ThemeView->theme = 'TestTheme';
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
|
||||||
$result = $ThemeView->getViewFileName('home');
|
$result = $ThemeView->getViewFileName('home');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'index.ctp';
|
||||||
$result = $ThemeView->getViewFileName('/Posts/index');
|
$result = $ThemeView->getViewFileName('/Posts/index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName();
|
$result = $ThemeView->getLayoutFileName();
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
@ -344,11 +348,11 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$View = new TestView($this->Controller);
|
$View = new TestView($this->Controller);
|
||||||
|
|
||||||
$expected = CakePlugin::path('TestPlugin') . 'View' . DS .'Tests' . DS .'index.ctp';
|
$expected = CakePlugin::path('TestPlugin') . 'View' . DS . 'Tests' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('index');
|
$result = $View->getViewFileName('index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CakePlugin::path('TestPlugin') . 'View' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CakePlugin::path('TestPlugin') . 'View' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $View->getLayoutFileName();
|
$result = $View->getLayoutFileName();
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -366,15 +370,15 @@ class ViewTest extends CakeTestCase {
|
||||||
$this->Controller->theme = 'TestTheme';
|
$this->Controller->theme = 'TestTheme';
|
||||||
|
|
||||||
$ThemeView = new TestThemeView($this->Controller);
|
$ThemeView = new TestThemeView($this->Controller);
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Tests' . DS . 'index.ctp';
|
||||||
$result = $ThemeView->getViewFileName('index');
|
$result = $ThemeView->getViewFileName('index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Layouts' . DS .'plugin_default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'Layouts' . DS . 'plugin_default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName('plugin_default');
|
$result = $ThemeView->getLayoutFileName('plugin_default');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName('default');
|
$result = $ThemeView->getLayoutFileName('default');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -421,15 +425,15 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new TestView($this->Controller);
|
$View = new TestView($this->Controller);
|
||||||
App::build(array(
|
App::build(array(
|
||||||
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS),
|
||||||
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View'. DS)
|
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
|
||||||
));
|
));
|
||||||
|
|
||||||
$pluginPath = CakePlugin::path('TestPlugin');
|
$pluginPath = CakePlugin::path('TestPlugin');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS .'TestPlugin' . DS . 'View' . DS .'Tests' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('index');
|
$result = $View->getViewFileName('index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = $pluginPath. 'View' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = $pluginPath . 'View' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $View->getLayoutFileName();
|
$result = $View->getLayoutFileName();
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -448,29 +452,29 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$View = new TestView($this->Controller);
|
$View = new TestView($this->Controller);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
|
||||||
$result = $View->getViewFileName('home');
|
$result = $View->getViewFileName('home');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Posts' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('/Posts/index');
|
$result = $View->getViewFileName('/Posts/index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Posts' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('../Posts/index');
|
$result = $View->getViewFileName('../Posts/index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'page.home.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'page.home.ctp';
|
||||||
$result = $View->getViewFileName('page.home');
|
$result = $View->getViewFileName('page.home');
|
||||||
$this->assertEquals($expected, $result, 'Should not ruin files with dots.');
|
$this->assertEquals($expected, $result, 'Should not ruin files with dots.');
|
||||||
|
|
||||||
CakePlugin::load('TestPlugin');
|
CakePlugin::load('TestPlugin');
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Pages' . DS .'home.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
|
||||||
$result = $View->getViewFileName('TestPlugin.home');
|
$result = $View->getViewFileName('TestPlugin.home');
|
||||||
$this->assertEquals($expected, $result, 'Plugin is missing the view, cascade to app.');
|
$this->assertEquals($expected, $result, 'Plugin is missing the view, cascade to app.');
|
||||||
|
|
||||||
$View->viewPath = 'Tests';
|
$View->viewPath = 'Tests';
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS .'Tests' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('TestPlugin.index');
|
$result = $View->getViewFileName('TestPlugin.index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -488,7 +492,7 @@ class ViewTest extends CakeTestCase {
|
||||||
|
|
||||||
$View = new TestView($this->Controller);
|
$View = new TestView($this->Controller);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $View->getLayoutFileName();
|
$result = $View->getLayoutFileName();
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
@ -517,12 +521,12 @@ class ViewTest extends CakeTestCase {
|
||||||
$View = new TestView($this->Controller);
|
$View = new TestView($this->Controller);
|
||||||
CakePlugin::load('TestPlugin');
|
CakePlugin::load('TestPlugin');
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $View->getLayoutFileName('TestPlugin.default');
|
$result = $View->getLayoutFileName('TestPlugin.default');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
$View->plugin = 'TestPlugin';
|
$View->plugin = 'TestPlugin';
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layouts' . DS .'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS . 'TestPlugin' . DS . 'View' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $View->getLayoutFileName('default');
|
$result = $View->getLayoutFileName('default');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
@ -1042,10 +1046,9 @@ class ViewTest extends CakeTestCase {
|
||||||
$result = $View->getViewFileName('../Themed/TestTheme/Posts/index');
|
$result = $View->getViewFileName('../Themed/TestTheme/Posts/index');
|
||||||
$this->assertRegExp('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result);
|
$this->assertRegExp('/Themed(\/|\\\)TestTheme(\/|\\\)Posts(\/|\\\)index.ctp/', $result);
|
||||||
|
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .'Posts' . DS .'index.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
|
||||||
$result = $View->getViewFileName('../Posts/index');
|
$result = $View->getViewFileName('../Posts/index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1114,44 +1117,6 @@ class ViewTest extends CakeTestCase {
|
||||||
$this->assertNotRegExp('/cake:nocache/', $result);
|
$this->assertNotRegExp('/cake:nocache/', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* testRenderNocache method
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This is a new test case for a pending enhancement
|
|
||||||
public function testRenderNocache() {
|
|
||||||
$this->PostsController->helpers = array('Cache', 'Html');
|
|
||||||
$this->PostsController->constructClasses();
|
|
||||||
$this->PostsController->cacheAction = 21600;
|
|
||||||
$this->PostsController->here = '/posts/nocache_multiple_element';
|
|
||||||
$this->PostsController->action = 'nocache_multiple_element';
|
|
||||||
$this->PostsController->nocache_multiple_element();
|
|
||||||
Configure::write('Cache.check', true);
|
|
||||||
Configure::write('Cache.disable', false);
|
|
||||||
|
|
||||||
$filename = CACHE . 'views' . DS . 'posts_nocache_multiple_element.php';
|
|
||||||
|
|
||||||
$View = new TestView($this->PostsController);
|
|
||||||
$View->render();
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
$View->renderCache($filename, getMicroTime());
|
|
||||||
$result = ob_get_clean();
|
|
||||||
@unlink($filename);
|
|
||||||
|
|
||||||
$this->assertRegExp('/php echo \$foo;/', $result);
|
|
||||||
$this->assertRegExp('/php echo \$bar;/', $result);
|
|
||||||
$this->assertRegExp('/php \$barfoo = \'in sub2\';/', $result);
|
|
||||||
$this->assertRegExp('/php echo \$barfoo;/', $result);
|
|
||||||
$this->assertRegExp('/printing: "in sub2"/', $result);
|
|
||||||
$this->assertRegExp('/php \$foobar = \'in sub1\';/', $result);
|
|
||||||
$this->assertRegExp('/php echo \$foobar;/', $result);
|
|
||||||
$this->assertRegExp('/printing: "in sub1"/', $result);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSet method
|
* testSet method
|
||||||
*
|
*
|
||||||
|
|
|
@ -64,7 +64,7 @@ class XmlViewTest extends CakeTestCase {
|
||||||
$output = $View->render(false);
|
$output = $View->render(false);
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'response' => array('no' =>$data['no'], 'user' => $data['user'])
|
'response' => array('no' => $data['no'], 'user' => $data['user'])
|
||||||
);
|
);
|
||||||
$this->assertIdentical(Xml::build($expected)->asXML(), $output);
|
$this->assertIdentical(Xml::build($expected)->asXML(), $output);
|
||||||
$this->assertIdentical('application/xml', $Response->type());
|
$this->assertIdentical('application/xml', $Response->type());
|
||||||
|
|
|
@ -30,6 +30,7 @@ class AccountFixture extends CakeTestFixture {
|
||||||
* @var string 'Aco'
|
* @var string 'Aco'
|
||||||
*/
|
*/
|
||||||
public $name = 'Account';
|
public $name = 'Account';
|
||||||
|
|
||||||
public $table = 'Accounts';
|
public $table = 'Accounts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -86,7 +86,7 @@ class AssertTagsTestCase extends CakeTestCase {
|
||||||
$this->assertTags($input, $pattern);
|
$this->assertTags($input, $pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testBadAssertTags
|
* testBadAssertTags
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
|
|
@ -39,7 +39,7 @@ class BookFixture extends CakeTestFixture {
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
'isbn' => array('type' => 'string', 'length' => 13),
|
'isbn' => array('type' => 'string', 'length' => 13),
|
||||||
'title' => array('type' => 'string', 'length' => 255),
|
'title' => array('type' => 'string', 'length' => 255),
|
||||||
'author' => array('type' => 'string', 'length' => 255),
|
'author' => array('type' => 'string', 'length' => 255),
|
||||||
'year' => array('type' => 'integer', 'null' => true),
|
'year' => array('type' => 'integer', 'null' => true),
|
||||||
'pages' => array('type' => 'integer', 'null' => true)
|
'pages' => array('type' => 'integer', 'null' => true)
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CdFixture extends CakeTestFixture {
|
||||||
*/
|
*/
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
'title' => array('type' => 'string', 'length' => 255),
|
'title' => array('type' => 'string', 'length' => 255),
|
||||||
'artist' => array('type' => 'string', 'length' => 255, 'null' => true),
|
'artist' => array('type' => 'string', 'length' => 255, 'null' => true),
|
||||||
'genre' => array('type' => 'string', 'length' => 255, 'null' => true)
|
'genre' => array('type' => 'string', 'length' => 255, 'null' => true)
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,6 +30,7 @@ class ContentAccountFixture extends CakeTestFixture {
|
||||||
* @var string 'Aco'
|
* @var string 'Aco'
|
||||||
*/
|
*/
|
||||||
public $name = 'ContentAccount';
|
public $name = 'ContentAccount';
|
||||||
|
|
||||||
public $table = 'ContentAccounts';
|
public $table = 'ContentAccounts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,8 +40,8 @@ class ContentAccountFixture extends CakeTestFixture {
|
||||||
*/
|
*/
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'iContentAccountsId' => array('type' => 'integer', 'key' => 'primary'),
|
'iContentAccountsId' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
'iContentId' => array('type' => 'integer'),
|
'iContentId' => array('type' => 'integer'),
|
||||||
'iAccountId' => array('type' => 'integer')
|
'iAccountId' => array('type' => 'integer')
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,6 +30,7 @@ class ContentFixture extends CakeTestFixture {
|
||||||
* @var string 'Aco'
|
* @var string 'Aco'
|
||||||
*/
|
*/
|
||||||
public $name = 'Content';
|
public $name = 'Content';
|
||||||
|
|
||||||
public $table = 'Content';
|
public $table = 'Content';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,8 +39,8 @@ class ContentFixture extends CakeTestFixture {
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'iContentId' => array('type' => 'integer', 'key' => 'primary'),
|
'iContentId' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
'cDescription' => array('type' => 'string', 'length' => 50, 'null' => true)
|
'cDescription' => array('type' => 'string', 'length' => 50, 'null' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,6 @@ class DataTestFixture extends CakeTestFixture {
|
||||||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
'count' => array('type' => 'integer', 'default' => 0),
|
'count' => array('type' => 'integer', 'default' => 0),
|
||||||
'float' => array('type' => 'float', 'default' => 0),
|
'float' => array('type' => 'float', 'default' => 0),
|
||||||
//'timestamp' => array('type' => 'timestamp', 'default' => null, 'null' => true),
|
|
||||||
'created' => array('type' => 'datetime', 'default' => null),
|
'created' => array('type' => 'datetime', 'default' => null),
|
||||||
'updated' => array('type' => 'datetime', 'default' => null)
|
'updated' => array('type' => 'datetime', 'default' => null)
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,6 +52,7 @@ class FixturizedTestCase extends CakeTestCase {
|
||||||
* test that a fixtures are unoaded even if the test throws exceptions
|
* test that a fixtures are unoaded even if the test throws exceptions
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function testThrowException() {
|
public function testThrowException() {
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
|
|
@ -40,7 +40,7 @@ class FruitFixture extends CakeTestFixture {
|
||||||
'id' => array('type' => 'string', 'length' => 36, 'key' => 'primary'),
|
'id' => array('type' => 'string', 'length' => 36, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'length' => 255),
|
'name' => array('type' => 'string', 'length' => 255),
|
||||||
'color' => array('type' => 'string', 'length' => 13),
|
'color' => array('type' => 'string', 'length' => 13),
|
||||||
'shape' => array('type' => 'string', 'length' => 255),
|
'shape' => array('type' => 'string', 'length' => 255),
|
||||||
'taste' => array('type' => 'string', 'length' => 255)
|
'taste' => array('type' => 'string', 'length' => 255)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,18 @@
|
||||||
* @package Cake.Test.Fixture
|
* @package Cake.Test.Fixture
|
||||||
*/
|
*/
|
||||||
class GroupUpdateAllFixture extends CakeTestFixture {
|
class GroupUpdateAllFixture extends CakeTestFixture {
|
||||||
|
|
||||||
public $name = 'GroupUpdateAll';
|
public $name = 'GroupUpdateAll';
|
||||||
|
|
||||||
public $table = 'group_update_all';
|
public $table = 'group_update_all';
|
||||||
|
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'null' => false, 'length' => 29),
|
'name' => array('type' => 'string', 'null' => false, 'length' => 29),
|
||||||
'code' => array('type' => 'integer', 'null' => false, 'length' => 4),
|
'code' => array('type' => 'integer', 'null' => false, 'length' => 4),
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
public $records = array(
|
public $records = array(
|
||||||
array(
|
array(
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
class PrefixTestFixture extends CakeTestFixture {
|
class PrefixTestFixture extends CakeTestFixture {
|
||||||
|
|
||||||
public $name = 'PrefixTest';
|
public $name = 'PrefixTest';
|
||||||
|
|
||||||
public $table = 'prefix_prefix_tests';
|
public $table = 'prefix_prefix_tests';
|
||||||
|
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,16 +23,19 @@
|
||||||
* @package Cake.Test.Fixture
|
* @package Cake.Test.Fixture
|
||||||
*/
|
*/
|
||||||
class ProductUpdateAllFixture extends CakeTestFixture {
|
class ProductUpdateAllFixture extends CakeTestFixture {
|
||||||
|
|
||||||
public $name = 'ProductUpdateAll';
|
public $name = 'ProductUpdateAll';
|
||||||
|
|
||||||
public $table = 'product_update_all';
|
public $table = 'product_update_all';
|
||||||
|
|
||||||
public $fields = array(
|
public $fields = array(
|
||||||
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'null' => false, 'length' => 29),
|
'name' => array('type' => 'string', 'null' => false, 'length' => 29),
|
||||||
'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4),
|
'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4),
|
||||||
'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8),
|
'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8),
|
||||||
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
|
||||||
);
|
);
|
||||||
|
|
||||||
public $records = array(
|
public $records = array(
|
||||||
array(
|
array(
|
||||||
'id' => 1,
|
'id' => 1,
|
||||||
|
|
|
@ -31,13 +31,6 @@ class SessionFixture extends CakeTestFixture {
|
||||||
*/
|
*/
|
||||||
public $name = 'Session';
|
public $name = 'Session';
|
||||||
|
|
||||||
/**
|
|
||||||
* table property.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
// public $table = 'sessions';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fields property
|
* fields property
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* SVN FILE: $Id$ */
|
|
||||||
/**
|
/**
|
||||||
* Short description for file.
|
* Short description for file.
|
||||||
*
|
*
|
||||||
|
@ -28,6 +27,7 @@
|
||||||
* @package Cake.Test.Fixture
|
* @package Cake.Test.Fixture
|
||||||
*/
|
*/
|
||||||
class TranslateWithPrefixFixture extends CakeTestFixture {
|
class TranslateWithPrefixFixture extends CakeTestFixture {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* name property
|
* name property
|
||||||
*
|
*
|
||||||
|
|
|
@ -30,7 +30,8 @@ class UnderscoreFieldFixture extends CakeTestFixture {
|
||||||
* @var string 'UnderscoreField'
|
* @var string 'UnderscoreField'
|
||||||
*/
|
*/
|
||||||
public $name = 'UnderscoreField';
|
public $name = 'UnderscoreField';
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* fields property
|
* fields property
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -43,7 +44,8 @@ class UnderscoreFieldFixture extends CakeTestFixture {
|
||||||
'published' => array('type' => 'string', 'length' => 1, 'default' => 'N'),
|
'published' => array('type' => 'string', 'length' => 1, 'default' => 'N'),
|
||||||
'another_field' => array('type' => 'integer', 'length' => 3),
|
'another_field' => array('type' => 'integer', 'length' => 3),
|
||||||
);
|
);
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* records property
|
* records property
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
|
|
|
@ -40,7 +40,7 @@ class UuidTagFixture extends CakeTestFixture {
|
||||||
'id' => array('type' => 'string', 'length' => 36, 'key' => 'primary'),
|
'id' => array('type' => 'string', 'length' => 36, 'key' => 'primary'),
|
||||||
'name' => array('type' => 'string', 'length' => 255),
|
'name' => array('type' => 'string', 'length' => 255),
|
||||||
'created' => array('type' => 'datetime')
|
'created' => array('type' => 'datetime')
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* records property
|
* records property
|
||||||
|
|
|
@ -53,16 +53,16 @@ $config['roles'] = array(
|
||||||
// Rules
|
// Rules
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
$config['rules']['allow'] = array(
|
$config['rules']['allow'] = array(
|
||||||
'/*' => 'Role/admin',
|
'/*' => 'Role/admin',
|
||||||
'/controllers/*/manager_*' => 'Role/manager',
|
'/controllers/*/manager_*' => 'Role/manager',
|
||||||
'/controllers/reports/*' => 'Role/sales',
|
'/controllers/reports/*' => 'Role/sales',
|
||||||
'/controllers/invoices/*' => 'Role/accounting',
|
'/controllers/invoices/*' => 'Role/accounting',
|
||||||
'/controllers/invoices/edit'=> 'User/db_manager_2',
|
'/controllers/invoices/edit' => 'User/db_manager_2',
|
||||||
'/controllers/db/*' => 'Role/database_manager',
|
'/controllers/db/*' => 'Role/database_manager',
|
||||||
'/controllers/*/(add|edit|publish)' => 'User/stan',
|
'/controllers/*/(add|edit|publish)' => 'User/stan',
|
||||||
'/controllers/users/dashboard' => 'Role/default',
|
'/controllers/users/dashboard' => 'Role/default',
|
||||||
// test for case insensitivity
|
// test for case insensitivity
|
||||||
'controllers/Forms/NEW' => 'Role/data_acquirer',
|
'controllers/Forms/NEW' => 'Role/data_acquirer',
|
||||||
);
|
);
|
||||||
$config['rules']['deny'] = array(
|
$config['rules']['deny'] = array(
|
||||||
// accountants and sales should not delete anything
|
// accountants and sales should not delete anything
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class TestsAppsController extends AppController {
|
class TestsAppsController extends AppController {
|
||||||
|
|
||||||
public $name = 'TestsApps';
|
public $name = 'TestsApps';
|
||||||
|
|
||||||
public $uses = array();
|
public $uses = array();
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
|
@ -40,4 +42,5 @@ class TestsAppsController extends AppController {
|
||||||
public function redirect_to() {
|
public function redirect_to() {
|
||||||
$this->redirect('http://cakephp.org');
|
$this->redirect('http://cakephp.org');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,11 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class TestsAppsPostsController extends AppController {
|
class TestsAppsPostsController extends AppController {
|
||||||
|
|
||||||
public $name = 'TestsAppsPosts';
|
public $name = 'TestsAppsPosts';
|
||||||
|
|
||||||
public $uses = array('Post');
|
public $uses = array('Post');
|
||||||
|
|
||||||
public $viewPath = 'TestsApps';
|
public $viewPath = 'TestsApps';
|
||||||
|
|
||||||
public function add() {
|
public function add() {
|
||||||
|
|
|
@ -24,13 +24,18 @@ class TestAppCacheEngine extends CacheEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function read($key) { }
|
public function read($key) {
|
||||||
|
}
|
||||||
|
|
||||||
public function increment($key, $offset = 1) { }
|
public function increment($key, $offset = 1) {
|
||||||
|
}
|
||||||
|
|
||||||
public function decrement($key, $offset = 1) { }
|
public function decrement($key, $offset = 1) {
|
||||||
|
}
|
||||||
|
|
||||||
public function delete($key) { }
|
public function delete($key) {
|
||||||
|
}
|
||||||
|
|
||||||
public function clear($check) { }
|
public function clear($check) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,5 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class Library {}
|
class Library {
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,5 @@ App::uses('CakeLogInterface', 'Log');
|
||||||
class TestAppLog implements CakeLogInterface {
|
class TestAppLog implements CakeLogInterface {
|
||||||
|
|
||||||
public function write($type, $message) {
|
public function write($type, $message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,5 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class TestUtilityClass {}
|
class TestUtilityClass {
|
||||||
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class Comment extends AppModel {
|
class Comment extends AppModel {
|
||||||
|
|
||||||
public $useTable = 'comments';
|
public $useTable = 'comments';
|
||||||
|
|
||||||
public $name = 'Comment';
|
public $name = 'Comment';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,22 +13,18 @@ class TestAppLibSession implements CakeSessionHandlerInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close() {
|
public function close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function read($id) {
|
public function read($id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function write($id, $data) {
|
public function write($id, $data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($id) {
|
public function destroy($id) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function gc($expires = null) {
|
public function gc($expires = null) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
|
@ -19,12 +19,15 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class PersisterOne extends AppModel {
|
class PersisterOne extends AppModel {
|
||||||
|
|
||||||
public $useTable = 'posts';
|
public $useTable = 'posts';
|
||||||
|
|
||||||
public $name = 'PersisterOne';
|
public $name = 'PersisterOne';
|
||||||
|
|
||||||
public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
|
public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
|
||||||
|
|
||||||
public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
|
public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
|
||||||
|
|
||||||
public $validate = array(
|
public $validate = array(
|
||||||
'title' => array(
|
'title' => array(
|
||||||
'custom' => array(
|
'custom' => array(
|
||||||
|
@ -53,4 +56,5 @@ class PersisterOne extends AppModel {
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,13 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
class PersisterTwo extends AppModel {
|
class PersisterTwo extends AppModel {
|
||||||
|
|
||||||
public $useTable = 'posts';
|
public $useTable = 'posts';
|
||||||
|
|
||||||
public $name = 'PersisterTwo';
|
public $name = 'PersisterTwo';
|
||||||
|
|
||||||
public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
|
public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
|
||||||
|
|
||||||
public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
|
public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue