Merge branch '2.1' into 2.2

Conflicts:
	lib/Cake/Test/Case/Model/ModelWriteTest.php
This commit is contained in:
mark_story 2012-03-18 21:26:45 -04:00
commit c58b61c17b
128 changed files with 1342 additions and 1072 deletions

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
################################################################################
#
# Bake is a shell script for running CakePHP bake script

View file

@ -2,5 +2,5 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

View file

@ -137,11 +137,17 @@
<package name="PHPUnit" channel="pear.phpunit.de" minimum_version="3.5.0" type="optional" />
</dependencies>
<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>
<install as="cake" name="bin/cake" />
<install as="cake.php" name="bin/cake.php" />
<install as="cake.bat" name="bin/cake.bat" />
</release>
<exceptions key="Cake/VERSION.txt">php</exceptions>
<exceptions key="Cake/LICENSE.txt">php</exceptions>
</d51pearpkg2>
</target>

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
################################################################################
#
# Bake is a shell script for running CakePHP bake script

View file

@ -2,5 +2,5 @@
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
################################################################################
#
# Bake is a shell script for running CakePHP bake script

View file

@ -190,8 +190,9 @@ class CookieComponent extends Component {
public function startup(Controller $controller) {
$this->_expire($this->time);
$this->_values[$this->name] = array();
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
*/
public function write($key, $value = null, $encrypt = true, $expires = null) {
if (empty($this->_values[$this->name])) {
$this->read();
}
if (is_null($encrypt)) {
$encrypt = true;
}
@ -227,14 +232,14 @@ class CookieComponent extends Component {
foreach ($key as $name => $value) {
if (strpos($name, '.') === false) {
$this->_values[$name] = $value;
$this->_values[$this->name][$name] = $value;
$this->_write("[$name]", $value);
} else {
$names = explode('.', $name, 2);
if (!isset($this->_values[$names[0]])) {
$this->_values[$names[0]] = array();
if (!isset($this->_values[$this->name][$names[0]])) {
$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);
}
}
@ -252,26 +257,28 @@ class CookieComponent extends Component {
* @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html#CookieComponent::read
*/
public function read($key = null) {
if (empty($this->_values) && isset($_COOKIE[$this->name])) {
$this->_values = $this->_decrypt($_COOKIE[$this->name]);
if (empty($this->_values[$this->name]) && isset($_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)) {
return $this->_values;
return $this->_values[$this->name];
}
if (strpos($key, '.') !== false) {
$names = explode('.', $key, 2);
$key = $names[0];
}
if (!isset($this->_values[$key])) {
if (!isset($this->_values[$this->name][$key])) {
return null;
}
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
*/
public function delete($key) {
if (empty($this->_values)) {
if (empty($this->_values[$this->name])) {
$this->read();
}
if (strpos($key, '.') === false) {
if (isset($this->_values[$key]) && is_array($this->_values[$key])) {
foreach ($this->_values[$key] as $idx => $val) {
if (isset($this->_values[$this->name][$key]) && is_array($this->_values[$this->name][$key])) {
foreach ($this->_values[$this->name][$key] as $idx => $val) {
$this->_delete("[$key][$idx]");
}
}
$this->_delete("[$key]");
unset($this->_values[$key]);
unset($this->_values[$this->name][$key]);
return;
}
$names = explode('.', $key, 2);
if (isset($this->_values[$names[0]])) {
$this->_values[$names[0]] = Set::remove($this->_values[$names[0]], $names[1]);
if (isset($this->_values[$this->name][$names[0]])) {
$this->_values[$this->name][$names[0]] = Set::remove($this->_values[$this->name][$names[0]], $names[1]);
}
$this->_delete('[' . implode('][', $names) . ']');
}
@ -319,17 +326,17 @@ class CookieComponent extends Component {
*/
public function destroy() {
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)) {
foreach ($value as $key => $val) {
unset($this->_values[$name][$key]);
unset($this->_values[$this->name][$name][$key]);
$this->_delete("[$name][$key]");
}
}
unset($this->_values[$name]);
unset($this->_values[$this->name][$name]);
$this->_delete("[$name]");
}
}
@ -503,5 +510,5 @@ class CookieComponent extends Component {
}
return $array;
}
}

View file

@ -581,9 +581,11 @@ class RequestHandlerComponent extends Component {
$controller->ext = '.ctp';
$viewClass = Inflector::classify($type);
App::uses($viewClass . 'View', 'View');
if (class_exists($viewClass . 'View')) {
$viewName = $viewClass . 'View';
if (!class_exists($viewName)) {
App::uses($viewName, 'View');
}
if (class_exists($viewName)) {
$controller->viewClass = $viewClass;
} elseif (empty($this->_renderType)) {
$controller->viewPath .= DS . $type;

View file

@ -75,20 +75,26 @@ class Configure {
App::$bootstrapping = false;
App::init();
App::build();
$level = -1;
if (isset(self::$_values['Error']['level'])) {
error_reporting(self::$_values['Error']['level']);
$level = self::$_values['Error']['level'];
}
if (!empty(self::$_values['Error']['handler'])) {
set_error_handler(self::$_values['Error']['handler'], $level);
}
if (!empty(self::$_values['Exception']['handler'])) {
set_exception_handler(self::$_values['Exception']['handler']);
}
$exception = array(
'handler' => 'ErrorHandler::handleException',
);
$error = array(
'handler' => 'ErrorHandler::handleError',
'level' => E_ALL & ~E_DEPRECATED,
);
self::_setErrorHandlers($error, $exception);
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);
}
restore_error_handler();
self::_setErrorHandlers(
self::$_values['Error'],
self::$_values['Exception']
);
unset($error, $exception);
}
}
@ -336,4 +342,24 @@ class Configure {
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']);
}
}
}

View file

@ -607,7 +607,7 @@ class TreeBehavior extends ModelBehavior {
$rght = $count++;
$Model->create(false);
$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) {
$Model->create(false);
@ -744,7 +744,7 @@ class TreeBehavior extends ModelBehavior {
$Model->id = $id;
return $Model->save(
array($left => $edge + 1, $right => $edge + 2, $parent => null),
array('callbacks' => false)
array('callbacks' => false, 'validate' => false)
);
}
}

View file

@ -1792,8 +1792,14 @@ class Model extends Object implements CakeEventListener {
$newValues[$row] = $values;
unset($values);
} elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
if (!empty($row[$this->{$join}->primaryKey])) {
$newJoins[] = $row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']];
}
$newData[] = $row;
} 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];
}
}
@ -1827,8 +1833,10 @@ class Model extends Object implements CakeEventListener {
if (!empty($newData)) {
foreach ($newData as $data) {
$data[$this->hasAndBelongsToMany[$assoc]['foreignKey']] = $id;
$this->{$join}->create($data);
$this->{$join}->save();
if (empty($data[$this->{$join}->primaryKey])) {
$this->{$join}->create();
}
$this->{$join}->save($data);
}
}

View file

@ -51,7 +51,7 @@ class AllTests extends PHPUnit_Framework_TestSuite {
$suite->addTestFile($path . 'Model' . DS . 'ModelTest.php');
$suite->addTestFile($path . 'AllRoutingTest.php');
$suite->addTestFile($path . 'AllNetworkTest.php');
$suite->addTestFile($path . 'AllTestSuiteTest.php');;
$suite->addTestFile($path . 'AllTestSuiteTest.php');
$suite->addTestFile($path . 'AllUtilityTest.php');
$suite->addTestFile($path . 'AllViewTest.php');
$suite->addTestFile($path . 'AllI18nTest.php');

View file

@ -160,7 +160,6 @@ class CookieComponentTest extends CakeTestCase {
*/
public function testReadPlainCookieData() {
$this->_setCookieData();
$data = $this->Cookie->read('Plain_array');
$expected = array('name' => 'CakePHP', 'version' => '1.2.0.x', 'tag' => 'CakePHP Rocks!');
$this->assertEquals($data, $expected);
@ -170,6 +169,26 @@ class CookieComponentTest extends CakeTestCase {
$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()
*

View file

@ -353,5 +353,5 @@ class ConfigureTest extends CakeTestCase {
$reader = new StdClass();
Configure::config('test', $reader);
}
}
}

View file

@ -67,7 +67,6 @@ class L10nTest extends CakeTestCase {
$l10n->get('');
$this->assertEquals($l10n->lang, 'en-us');
// Using $this->default
$l10n = new L10n();
@ -83,7 +82,7 @@ class L10nTest extends CakeTestCase {
* @return void
*/
public function testGetAutoLanguage() {
$__SERVER = $_SERVER;
$serverBackup = $_SERVER;
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'inexistent,en-ca';
$l10n = new L10n();
@ -107,7 +106,7 @@ class L10nTest extends CakeTestCase {
$this->assertEquals($l10n->languagePath, array('eng', 'eng', 'eng'));
$this->assertEquals($l10n->locale, 'eng');
$_SERVER = $__SERVER;
$_SERVER = $serverBackup;
}
/**

View file

@ -159,14 +159,12 @@ class MultibyteTest extends CakeTestCase {
65265, 65266, 65267, 65268, 65269, 65270, 65271, 65272, 65273, 65274, 65275, 65276);
$this->assertEquals($expected, $result);
$string = '';
$result = Multibyte::utf8($string);
$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);
$this->assertEquals($expected, $result);
$string = '。「」、・ヲァィゥェォャュョッーアイウエオカキク';
$result = Multibyte::utf8($string);
$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);
$this->assertEquals($expected, $result);
$string = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
$result = Multibyte::utf8($string);
$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);
$expected = 'ἀι';
$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ﬓﬔﬕﬖﬗ';
$result = mb_strtolower($string);
$expected = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';
@ -7696,29 +7643,6 @@ mb_strtolower does not work for these strings.
$expected = 'ΩKÅ';
$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ﬓﬔﬕﬖﬗ';
$result = mb_strtoupper($string);
$expected = 'fffiflffifflſtstﬓﬔﬕﬖﬗ';

View file

@ -198,6 +198,7 @@ class DbAroUserTest extends CakeTestModel {
return array('DbAroTest' => array('DbAroTest.model' => 'AuthUser', 'DbAroTest.foreign_key' => 2));
}
}
}
/**
@ -218,6 +219,7 @@ class TestDbAcl extends DbAcl {
$this->Aco = new DbAcoTest();
$this->Aro->Permission = new DbPermissionTest();
}
}
/**
@ -332,7 +334,6 @@ class AclNodeTest extends CakeTestCase {
$result = Set::extract($Aro->node($Model), '{n}.DbAroTest.id');
$expected = array(4, 2, 1);
$this->assertEquals($expected, $result);
}
/**

View file

@ -98,6 +98,7 @@ class AclPerson extends CakeTestModel {
return array('AclPerson' => array('id' => $motherId));
}
}
}
/**
@ -135,6 +136,7 @@ class AclUser extends CakeTestModel {
public function parentNode() {
return null;
}
}
/**
@ -172,6 +174,7 @@ class AclPost extends CakeTestModel {
public function parentNode() {
return null;
}
}
/**
@ -342,7 +345,7 @@ class AclBehaviorTest extends CakeTestCase {
$this->assertEquals($result['Aro']['parent_id'], 7);
$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[1]['Aro']['parent_id'], null);
}
@ -362,7 +365,6 @@ class AclBehaviorTest extends CakeTestCase {
);
$this->Aro->save($aroData);
$acoData = array(
'Aco' => array(
'model' => 'AclPerson',

View file

@ -19,7 +19,7 @@
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**
* ContainableTest class
@ -3553,8 +3553,10 @@ class ContainableBehaviorTest extends CakeTestCase {
$this->skipIf(
!isset($config->test) || !isset($config->test2),
'Primary and secondary test databases not configured, skipping cross-database join tests.'
. ' To run these tests, you must define $test and $test2 in your database configuration.'
'Primary and secondary test databases not configured, ' .
'skipping cross-database join tests. ' .
' To run these tests, you must define $test and $test2 ' .
'in your database configuration.'
);
$db = ConnectionManager::getDataSource('test2');

View file

@ -22,7 +22,7 @@ if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**
* TranslateBehaviorTest class
@ -351,7 +351,6 @@ class TranslateBehaviorTest extends CakeTestCase {
$TestModel = new TranslatedItem();
$TestModel->locale = array('deu', 'eng', 'cze');
$result = $TestModel->read(null, 1);
$expected = array(
'TranslatedItem' => array(

View file

@ -19,7 +19,7 @@
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**

View file

@ -21,7 +21,7 @@
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**
* TreeBehaviorNumberTest class
@ -42,7 +42,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
*
* @var array
*/
protected $settings = array(
public $settings = array(
'modelClass' => 'NumberTree',
'leftField' => 'lft',
'rightField' => 'rght',
@ -424,12 +424,12 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$this->Tree->id = $data[$modelClass]['id'];
$this->Tree->saveField($parentField, $parent_id);
$direct = $this->Tree->children($parent_id, true, array('id', 'name', $parentField, $leftField, $rightField));
$this->Tree->saveField($parentField, $parentId);
$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)),
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)));
@ -450,14 +450,14 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$this->Tree->id = $data[$modelClass]['id'];
$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)),
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)));
@ -495,13 +495,13 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$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')),
array($modelClass => array('name' => '1.1.2')),
array($modelClass => array('name' => '1.2')));
@ -523,13 +523,13 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$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')),
array($modelClass => array('name' => '1.2.2')),
array($modelClass => array('name' => '1.1')));
@ -551,15 +551,14 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$expects = $this->Tree->find('all');
$before = $this->Tree->read(null, $data[$modelClass]['id']);
$this->Tree->id = $parent_id;
//$this->expectError('Trying to save a node under itself in TreeBehavior::beforeSave');
$this->Tree->id = $parentId;
$this->Tree->saveField($parentField, $data[$modelClass]['id']);
$results = $this->Tree->find('all');
@ -586,11 +585,9 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$initialCount = $this->Tree->find('count');
$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->saveField($parentField, 999999);
//$this->assertSame($saveSuccess, false);
$laterCount = $this->Tree->find('count');
$this->assertSame($initialCount, $laterCount);
@ -612,7 +609,6 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$initialCount = $this->Tree->find('count');
$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'];
$saveSuccess = $this->Tree->saveField($parentField, $this->Tree->id);
@ -1036,9 +1032,11 @@ class TreeBehaviorNumberTest extends CakeTestCase {
$this->assertEquals($initialCount - 1, $laterCount);
$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.2')));
array($modelClass => array('name' => '1.2'))
);
$this->assertEquals($children, $expects);
$topNodes = $this->Tree->children(false, true,array('name'));

View file

@ -21,7 +21,7 @@
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**
* TreeBehaviorScopedTest class

View file

@ -21,7 +21,7 @@
App::uses('Model', 'Model');
App::uses('AppModel', 'Model');
require_once(dirname(dirname(__FILE__)) . DS . 'models.php');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
/**
* TreeBehaviorUuidTest class
@ -68,12 +68,12 @@ class TreeBehaviorUuidTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$this->Tree->id = $data[$modelClass]['id'];
$this->Tree->saveField($parentField, $parent_id);
$direct = $this->Tree->children($parent_id, true, array('name', $leftField, $rightField));
$this->Tree->saveField($parentField, $parentId);
$direct = $this->Tree->children($parentId, true, array('name', $leftField, $rightField));
$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.1.1', $leftField => 12, $rightField => 13)));
@ -94,14 +94,14 @@ class TreeBehaviorUuidTest extends CakeTestCase {
$this->Tree->id = null;
$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')));
$this->Tree->id = $data[$modelClass]['id'];
$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)),
array($modelClass => array('name' => '1.2', $leftField => 6, $rightField => 11)),
array($modelClass => array('name' => '1.1.1', $leftField => 12, $rightField => 13)));

View file

@ -320,6 +320,7 @@ class TestBehavior extends ModelBehavior {
$query = preg_replace('/^in\s+/', 'Location.name = \'', $query);
return $method . '\' AND ' . $query . '\'';
}
}
/**
@ -328,15 +329,15 @@ class TestBehavior extends ModelBehavior {
* @package Cake.Test.Case.Model
*/
class Test2Behavior extends TestBehavior {
public $mapMethods = array('/mappingRobot(\w+)/' => 'mapped');
public function resolveMethod(Model $model, $stuff) {
}
public function mapped(Model $model, $method, $query) {
}
}
/**
@ -353,11 +354,13 @@ class Test3Behavior extends TestBehavior{
* @package Cake.Test.Case.Model
*/
class Test4Behavior extends ModelBehavior{
public function setup(Model $model, $config = null) {
$model->bindModel(
array('hasMany' => array('Comment'))
);
}
}
/**
@ -366,11 +369,13 @@ class Test4Behavior extends ModelBehavior{
* @package Cake.Test.Case.Model
*/
class Test5Behavior extends ModelBehavior{
public function setup(Model $model, $config = null) {
$model->bindModel(
array('belongsTo' => array('User'))
);
}
}
/**
@ -379,11 +384,13 @@ class Test5Behavior extends ModelBehavior{
* @package Cake.Test.Case.Model
*/
class Test6Behavior extends ModelBehavior{
public function setup(Model $model, $config = null) {
$model->bindModel(
array('hasAndBelongsToMany' => array('Tag'))
);
}
}
/**
@ -392,11 +399,13 @@ class Test6Behavior extends ModelBehavior{
* @package Cake.Test.Case.Model
*/
class Test7Behavior extends ModelBehavior{
public function setup(Model $model, $config = null) {
$model->bindModel(
array('hasOne' => array('Attachment'))
);
}
}
/**
@ -693,14 +702,12 @@ class BehaviorCollectionTest extends CakeTestCase {
$Apple->Child->Behaviors->attach('Test', array('before' => 'modify'));
$result = $Apple->find('all', array('fields' => array('Apple.id'), 'conditions' => array('Apple.id <' => '4')));
//$this->assertEquals($expected, $result2);
$Apple->Child->Behaviors->disable('Test');
$result = $Apple->find('all');
$this->assertEquals($expected, $result);
$Apple->Child->Behaviors->attach('Test', array('before' => 'off', 'after' => 'on'));
//$this->assertSame($Apple->find('all'), array());
$Apple->Child->Behaviors->attach('Test', array('after' => 'off'));
$this->assertEquals($Apple->find('all'), $expected);
@ -710,20 +717,8 @@ class BehaviorCollectionTest extends CakeTestCase {
$Apple->Child->Behaviors->attach('Test', array('after' => 'test2'));
$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
*
@ -746,32 +741,10 @@ class BehaviorCollectionTest extends CakeTestCase {
$Apple->Sample->Behaviors->attach('Test', array('before' => 'test'));
$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');
$result = $Apple->find('all');
$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'));
$this->assertEquals($Apple->find('all'), $expected);
@ -780,18 +753,6 @@ class BehaviorCollectionTest extends CakeTestCase {
$Apple->Sample->Behaviors->attach('Test', array('after' => 'test2'));
$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'));
$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($results, true);
$Apple->Behaviors->attach('Test', array('beforeDelete' => 'off', 'afterDelete' => 'on'));
ob_start();
$results = $Apple->delete(2, false);
@ -1190,5 +1138,4 @@ class BehaviorCollectionTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
}

View file

@ -113,6 +113,7 @@ class MyAppSchema extends CakeSchema {
}
return $this->$var;
}
}
/**
@ -219,6 +220,7 @@ class TestAppSchema extends CakeSchema {
*/
public function teardown($version) {
}
}
/**
@ -434,6 +436,7 @@ class SchemaCrossDatabaseFixture extends CakeTestFixture {
* @package Cake.Test.Case.Model
*/
class SchemaPrefixAuthUser extends CakeTestModel {
/**
* name property
*
@ -632,7 +635,6 @@ class CakeSchemaTest extends CakeTestCase {
));
unset($read['tables']['missing']);
$this->assertTrue(isset($read['tables']['auth_users']), 'auth_users key missing %s');
}
/**
@ -699,14 +701,15 @@ class CakeSchemaTest extends CakeTestCase {
$config = ConnectionManager::enumConnectionObjects();
$this->skipIf(
!isset($config['test']) || !isset($config['test2']),
'Primary and secondary test databases not configured, skipping cross-database join tests.'
. ' To run these tests, you must define $test and $test2 in your database configuration.'
'Primary and secondary test databases not configured, ' .
'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->create($db2);
$fixture->insert($db2);
$fixture->create($db);
$fixture->insert($db);
$read = $this->Schema->read(array(
'connection' => 'test',
@ -726,7 +729,7 @@ class CakeSchemaTest extends CakeTestCase {
$this->assertFalse(isset($read['tables']['posts']), 'Posts should not appear');
$this->assertTrue(isset($read['tables']['cross_database']));
$fixture->drop($db2);
$fixture->drop($db);
}
/**
@ -755,11 +758,15 @@ class CakeSchemaTest extends CakeTestCase {
* @return void
*/
public function testSchemaWrite() {
$write = $this->Schema->write(array('name' => 'MyOtherApp', 'tables' => $this->Schema->tables, 'path' => TMP . 'tests'));
$write = $this->Schema->write(array(
'name' => 'MyOtherApp',
'tables' => $this->Schema->tables,
'path' => TMP . 'tests'
));
$file = file_get_contents(TMP . 'tests' . DS . 'schema.php');
$this->assertEquals($write, $file);
require_once( TMP . 'tests' . DS .'schema.php');
require_once TMP . 'tests' . DS . 'schema.php';
$OtherSchema = new MyOtherAppSchema();
$this->assertEquals($this->Schema->tables, $OtherSchema->tables);
}
@ -807,21 +814,21 @@ class CakeSchemaTest extends CakeTestCase {
$tables = array(
'missing' => array(
'categories' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'created' => 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),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
'created' => 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),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
)
),
'ratings' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL),
'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL),
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL),
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => null),
'model' => array('type' => 'varchar', 'null' => false, 'default' => null),
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => null),
'created' => array('type' => 'datetime', 'null' => false, 'default' => null),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
)
@ -830,12 +837,12 @@ class CakeSchemaTest extends CakeTestCase {
$expected = array(
'ratings' => array(
'add' => array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'after' => 'id'),
'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL, 'after' => 'foreign_key'),
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL, 'after' => 'model'),
'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL, 'after' => 'value'),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL, 'after' => 'created'),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => null, 'after' => 'id'),
'model' => array('type' => 'varchar', 'null' => false, 'default' => null, 'after' => 'foreign_key'),
'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => null, 'after' => 'model'),
'created' => array('type' => 'datetime', 'null' => false, 'default' => null, 'after' => 'value'),
'modified' => array('type' => 'datetime', 'null' => false, 'default' => null, 'after' => 'created'),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)),
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM')
)
@ -852,13 +859,13 @@ class CakeSchemaTest extends CakeTestCase {
public function testCompareEmptyStringAndNull() {
$One = new CakeSchema(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' => '')
)
));
$Two = new CakeSchema(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)
)
));

View file

@ -29,6 +29,7 @@ require_once dirname(dirname(dirname(__FILE__))) . DS . 'models.php';
* @package Cake.Test.Case.Model.Datasource.Database
*/
class MysqlTest extends CakeTestCase {
/**
* autoFixtures property
*
@ -267,7 +268,6 @@ class MysqlTest extends CakeTestCase {
$this->Dbo->rawQuery('DROP TABLE ' . $name);
$this->assertEquals($expected, $result);
$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` ));');
$expected = array(
@ -370,8 +370,8 @@ class MysqlTest extends CakeTestCase {
'Column_name' => 'id',
'Collation' => 'A',
'Cardinality' => '0',
'Sub_part' => NULL,
'Packed' => NULL,
'Sub_part' => null,
'Packed' => null,
'Null' => '',
'Index_type' => 'BTREE',
'Comment' => ''
@ -383,9 +383,9 @@ class MysqlTest extends CakeTestCase {
'Seq_in_index' => '1',
'Column_name' => 'bool',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Cardinality' => null,
'Sub_part' => null,
'Packed' => null,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
@ -397,9 +397,9 @@ class MysqlTest extends CakeTestCase {
'Seq_in_index' => '1',
'Column_name' => 'small_int',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Cardinality' => null,
'Sub_part' => null,
'Packed' => null,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
@ -411,9 +411,9 @@ class MysqlTest extends CakeTestCase {
'Seq_in_index' => '1',
'Column_name' => 'bool',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Cardinality' => null,
'Sub_part' => null,
'Packed' => null,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
@ -425,9 +425,9 @@ class MysqlTest extends CakeTestCase {
'Seq_in_index' => '2',
'Column_name' => 'small_int',
'Collation' => 'A',
'Cardinality' => NULL,
'Sub_part' => NULL,
'Packed' => NULL,
'Cardinality' => null,
'Sub_part' => null,
'Packed' => null,
'Null' => 'YES',
'Index_type' => 'BTREE',
'Comment' => ''
@ -512,7 +512,7 @@ class MysqlTest extends CakeTestCase {
$this->Dbo->cacheSources = $this->Dbo->testing = false;
$table = $this->Dbo->fullTableName('altertest');
$schema1 = new CakeSchema(array(
$schemaA = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'altertest' => array(
@ -521,7 +521,7 @@ class MysqlTest extends CakeTestCase {
'group1' => 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('`name` varchar(50) NOT NULL,', $result);
$this->assertContains('`group1` int(11) DEFAULT NULL', $result);
@ -531,7 +531,7 @@ class MysqlTest extends CakeTestCase {
$query = $this->Dbo->getConnection()->prepare($result);
$this->assertEquals($result, $query->queryString);
$schema2 = new CakeSchema(array(
$schemaB = new CakeSchema(array(
'name' => 'AlterTest2',
'connection' => 'test',
'altertest' => array(
@ -546,7 +546,7 @@ class MysqlTest extends CakeTestCase {
'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('ADD KEY name_idx (`name`),', $result);
$this->assertContains('ADD KEY group_idx (`group1`),', $result);
@ -558,7 +558,7 @@ class MysqlTest extends CakeTestCase {
$this->assertEquals($result, $query->queryString);
// Change three indexes, delete one and add another one
$schema3 = new CakeSchema(array(
$schemaC = new CakeSchema(array(
'name' => 'AlterTest3',
'connection' => 'test',
'altertest' => array(
@ -573,7 +573,7 @@ class MysqlTest extends CakeTestCase {
'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('DROP PRIMARY KEY,', $result);
$this->assertContains('DROP KEY name_idx,', $result);
@ -588,10 +588,10 @@ class MysqlTest extends CakeTestCase {
$this->assertEquals($result, $query->queryString);
// Compare us to ourself.
$this->assertEquals($schema3->compare($schema3), array());
$this->assertEquals($schemaC->compare($schemaC), array());
// 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('DROP KEY name_idx,', $result);
@ -628,7 +628,7 @@ class MysqlTest extends CakeTestCase {
public function testAlteringTableParameters() {
$this->Dbo->cacheSources = $this->Dbo->testing = false;
$schema1 = new CakeSchema(array(
$schemaA = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'altertest' => array(
@ -641,8 +641,8 @@ class MysqlTest extends CakeTestCase {
)
)
));
$this->Dbo->rawQuery($this->Dbo->createSchema($schema1));
$schema2 = new CakeSchema(array(
$this->Dbo->rawQuery($this->Dbo->createSchema($schemaA));
$schemaB = new CakeSchema(array(
'name' => 'AlterTest1',
'connection' => 'test',
'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('ENGINE=InnoDB', $result);
$this->assertContains('COLLATE=utf8_general_ci', $result);
@ -666,7 +666,7 @@ class MysqlTest extends CakeTestCase {
$this->assertEquals($result['Engine'], 'InnoDB');
$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));
$model = new CakeTestModel(array('table' => 'testdescribes', 'name' => 'Testdescribes'));
$result = $model->getDataSource()->describe($model);
@ -1097,7 +1096,7 @@ class MysqlTest extends CakeTestCase {
* @param array $data
* @return array
*/
function _scrubQueryData($data) {
protected function _scrubQueryData($data) {
static $base = null;
if ($base === null) {
$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
@ -1484,7 +1483,7 @@ class MysqlTest extends CakeTestCase {
$this->Model->schema();
$this->_buildRelatedModels($this->Model);
$__backup = $this->Model->hasMany['TestModel6'];
$backup = $this->Model->hasMany['TestModel6'];
$this->Model->hasMany['TestModel6']['offset'] = 2;
$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+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->_buildRelatedModels($this->Model);
$__backup = $this->Model->hasMany['TestModel6'];
$backup = $this->Model->hasMany['TestModel6'];
$this->Model->hasMany['TestModel6']['page'] = 2;
$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+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->_buildRelatedModels($this->Model);
$__backup = $this->Model->hasAndBelongsToMany['TestModel7'];
$backup = $this->Model->hasAndBelongsToMany['TestModel7'];
$this->Model->hasAndBelongsToMany['TestModel7']['offset'] = 2;
$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('/\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->_buildRelatedModels($this->Model);
$__backup = $this->Model->hasAndBelongsToMany['TestModel7'];
$backup = $this->Model->hasAndBelongsToMany['TestModel7'];
$this->Model->hasAndBelongsToMany['TestModel7']['page'] = 2;
$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('/\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%\'';
$this->assertEquals($expected, $result);
$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%"';
$this->assertEquals($expected, $result);
@ -2949,7 +2947,6 @@ class MysqlTest extends CakeTestCase {
$this->Dbo->hasAny($this->Model, array('TestModel.name' => 'harry'));
$this->Dbo->hasAny($this->Model, array());
}
/**
@ -3308,8 +3305,7 @@ class MysqlTest extends CakeTestCase {
$data = array(2, 2.2);
$this->assertEquals($this->Dbo->introspectType($data), 'integer');
// NULL
// null
$result = $this->Dbo->value(null, 'boolean');
$this->assertEquals($result, 'NULL');
@ -3317,7 +3313,6 @@ class MysqlTest extends CakeTestCase {
$result = $this->Dbo->value('', 'boolean');
$this->assertEquals($result, "'0'");
// BOOLEAN
$result = $this->Dbo->value('true', 'boolean');
$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('2'), '2=2');
$this->Dbo->update($Article, array('field1'), array("'value'"), array('index' => 'val'));
}
/**

View file

@ -56,6 +56,7 @@ class DboPostgresTestDb extends Postgres {
public function getLastQuery() {
return $this->simulated[count($this->simulated) - 1];
}
}
/**
@ -143,6 +144,7 @@ class PostgresTestModel extends Model {
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
/**
@ -180,6 +182,7 @@ class PostgresClientTestModel extends Model {
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
/**
@ -541,12 +544,10 @@ class PostgresTest extends CakeTestCase {
$schema->tables = array('datatype_tests' => $result['tables']['missing']['datatype_tests']);
$result = $db1->createSchema($schema, 'datatype_tests');
$this->assertNotRegExp('/timestamp DEFAULT/', $result);
$this->assertRegExp('/\"full_length\"\s*text\s.*,/', $result);
$this->assertRegExp('/timestamp\s*,/', $result);
$db1->query('DROP TABLE ' . $db1->fullTableName('datatype_tests'));
$db1->query($result);
@ -731,7 +732,7 @@ class PostgresTest extends CakeTestCase {
$this->Dbo->query($this->Dbo->dropSchema($schema1));
}
/*
/**
* Test it is possible to use virtual field with postgresql
*
* @return void
@ -783,7 +784,10 @@ 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() {
$this->loadFixtures('Article');

View file

@ -55,6 +55,7 @@ class DboSqliteTestDb extends Sqlite {
public function getLastQuery() {
return $this->simulated[count($this->simulated) - 1];
}
}
/**

View file

@ -104,6 +104,7 @@ class SqlserverTestDb extends Sqlserver {
public function describe($model) {
return empty($this->describe) ? parent::describe($model) : $this->describe;
}
}
/**
@ -176,6 +177,7 @@ class SqlserverTestModel extends CakeTestModel {
public function find($conditions = null, $fields = null, $order = null, $recursive = null) {
return $conditions;
}
}
/**
@ -184,6 +186,7 @@ class SqlserverTestModel extends CakeTestModel {
* @package Cake.Test.Case.Model.Datasource.Database
*/
class SqlserverClientTestModel extends CakeTestModel {
/**
* name property
*
@ -218,12 +221,14 @@ class SqlserverClientTestModel extends CakeTestModel {
* @package Cake.Test.Case.Model.Datasource.Database
*/
class SqlserverTestResultIterator extends ArrayIterator {
/**
* closeCursor method
*
* @return void
*/
public function closeCursor() {}
public function closeCursor() {
}
/**
* fetch method
@ -238,6 +243,7 @@ class SqlserverTestResultIterator extends ArrayIterator {
$this->next();
return $current;
}
}
/**

View file

@ -27,6 +27,7 @@ class MockPDO extends PDO {
public function __construct() {
}
}
class MockDataSource extends DataSource {
@ -49,6 +50,7 @@ class DboTestSource extends DboSource {
public function setConnection($conn) {
$this->_connection = $conn;
}
}
/**
@ -109,7 +111,6 @@ class DboSourceTest extends CakeTestCase {
unset($this->Model);
}
/**
* test that booleans and null make logical condition strings.
*
@ -420,7 +421,6 @@ class DboSourceTest extends CakeTestCase {
$this->assertEquals($data, $expected);
}
/**
* testMagicMethodQuerying method
*
@ -492,7 +492,6 @@ class DboSourceTest extends CakeTestCase {
$result = $this->db->query('directCall', array(), $this->Model);
}
/**
* testValue method
*
@ -659,7 +658,6 @@ class DboSourceTest extends CakeTestCase {
$expected = array('query' => 'Error 1', 'affected' => '', 'numRows' => '', 'took' => '');
}
/**
* 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);
}
/**
* 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');
}
/**
* test order to generate query order clause for virtual fields
*
@ -716,8 +712,6 @@ class DboSourceTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
/**
* test the permutations of fullTableName()
*
@ -784,7 +778,6 @@ class DboSourceTest extends CakeTestCase {
$this->assertTrue(empty(DboTestSource::$methodCache['fields']), 'Cache not empty');
}
/**
* Test that group works without a model
*

View file

@ -23,8 +23,11 @@ App::uses('DatabaseSession', 'Model/Datasource/Session');
class_exists('CakeSession');
class SessionTestModel extends Model {
public $name = 'SessionTestModel';
public $useTable = 'sessions';
}
/**

View file

@ -66,8 +66,9 @@ class ModelCrossSchemaHabtmTest extends BaseModelTest {
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
$this->skipIf(
!isset($config['test']) || !isset($config['test2']),
'Primary and secondary test databases not configured, skipping cross-database join tests.'
. ' To run these tests, you must define $test and $test2 in your database configuration.'
'Primary and secondary test databases not configured, ' .
'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();
$this->skipIf(
!isset($config['test']) || !isset($config['test2']) || !isset($config['test_database_three']),
'Primary, secondary, and tertiary test databases not configured, skipping test.'
. ' To run these tests, you must define $test, $test2, and $test_database_three in your database configuration.'
'Primary, secondary, and tertiary test databases not configured,' .
' 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');

View file

@ -260,7 +260,6 @@ class ModelDeleteTest extends BaseModelTest {
$this->assertEquals($expected, $result);
}
/**
* test that delete() updates the correct records counterCache() records.
*
@ -688,7 +687,6 @@ class ModelDeleteTest extends BaseModelTest {
* @return void
*/
public function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() {
$this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
$ThePaper = new ThePaper();
$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');
// From now on, Tag #1 is only associated with Post #1
$submitted_data = array(
$submittedData = array(
"Tag" => array("id" => 1, 'tag' => 'tag1'),
"Article" => array(
"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.
$submitted_data = array(
$submittedData = array(
"Article" => array("id" => 2, 'title' => 'second article'),
"Tag" => array(
"Tag" => array(2, 3)
)
);
// ERROR:
// 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)
$Article->save($submitted_data);
$Article->save($submittedData);
// Want to make sure Article #1 has Tag #1 and Tag #2 still.
$after = $Article->find("all", array(

View file

@ -39,6 +39,7 @@ class DboMock extends DboSource {
public function connect() {
return true;
}
}
/**
@ -149,8 +150,8 @@ class ModelIntegrationTest extends BaseModelTest {
*/
public function testPkInHabtmLinkModelArticleB() {
$this->loadFixtures('Article', 'Tag', 'ArticlesTag');
$TestModel2 = new ArticleB();
$this->assertEquals($TestModel2->ArticlesTag->primaryKey, 'article_id');
$TestModel = new ArticleB();
$this->assertEquals($TestModel->ArticlesTag->primaryKey, 'article_id');
}
/**
@ -186,18 +187,17 @@ class ModelIntegrationTest extends BaseModelTest {
//test conformant models with no PK in the join table
$this->loadFixtures('Article', 'Tag');
$TestModel2 = new Article();
$this->assertEquals($TestModel2->ArticlesTag->primaryKey, 'article_id');
$TestModel = new Article();
$this->assertEquals($TestModel->ArticlesTag->primaryKey, 'article_id');
//test conformant models with PK in join table
$TestModel3 = new Portfolio();
$this->assertEquals($TestModel3->ItemsPortfolio->primaryKey, 'id');
$TestModel = new Portfolio();
$this->assertEquals($TestModel->ItemsPortfolio->primaryKey, 'id');
//test conformant models with PK in join table - join table contains extra field
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB');
$TestModel4 = new JoinA();
$this->assertEquals($TestModel4->JoinAsJoinB->primaryKey, 'id');
$TestModel = new JoinA();
$this->assertEquals($TestModel->JoinAsJoinB->primaryKey, 'id');
}
/**
@ -645,7 +645,6 @@ class ModelIntegrationTest extends BaseModelTest {
$expected = 3; // 3 domains belonging to cakephp
$this->assertEquals($expected, count($results['Domain']));
$Site->id = 2;
$results = $Site->read();
$expected = 2; // 2 domains belonging to markstory
@ -710,6 +709,102 @@ class ModelIntegrationTest extends BaseModelTest {
$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
*
@ -2249,7 +2344,6 @@ class ModelIntegrationTest extends BaseModelTest {
* @return void
*/
public function testMultischemaFixture() {
$config = ConnectionManager::enumConnectionObjects();
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
$this->skipIf(!isset($config['test']) || !isset($config['test2']),
@ -2279,7 +2373,6 @@ class ModelIntegrationTest extends BaseModelTest {
* @return void
*/
public function testMultischemaFixtureWithThreeDatabases() {
$config = ConnectionManager::enumConnectionObjects();
$this->skipIf($this->db instanceof Sqlite, 'This test is not compatible with Sqlite.');
$this->skipIf(

View file

@ -68,7 +68,6 @@ class ModelReadTest extends BaseModelTest {
)
);
$Something->JoinThing->create($joinThingData);
$Something->JoinThing->save();
@ -347,7 +346,6 @@ class ModelReadTest extends BaseModelTest {
$result = $this->db->getQueryCache($query, $params);
$this->assertFalse($result === false);
}
/**
@ -6199,17 +6197,20 @@ class ModelReadTest extends BaseModelTest {
$expected = array(
'conditions' => array(
'user' => 'larry'),
'fields' => NULL,
'user' => 'larry'
),
'fields' => null,
'joins' => array(),
'limit' => NULL,
'offset' => NULL,
'limit' => null,
'offset' => null,
'order' => array(
0 => NULL),
0 => null
),
'page' => 1,
'group' => NULL,
'group' => null,
'callbacks' => true,
'returnQuery' => true);
'returnQuery' => true
);
$result = $TestModel->buildQuery('all', array('returnQuery' => true, 'conditions' => array('user' => 'larry')));
$this->assertEquals($expected, $result);
}
@ -7736,7 +7737,6 @@ class ModelReadTest extends BaseModelTest {
$this->assertEquals($result, $expectation);
$Author = ClassRegistry::init('Author');
$Author->virtualFields = array(
'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']);
}
/**
* test that checks for error when NOT condition passed in key and a 1 element array value
*
@ -7823,7 +7822,6 @@ class ModelReadTest extends BaseModelTest {
)
)
);
$this->assertTrue(is_array($result) && !empty($result));
}
@ -7846,4 +7844,5 @@ class ModelReadTest extends BaseModelTest {
$result = $Article->find('unPublished');
$this->assertEquals(1, count($result));
}
}

View file

@ -51,7 +51,7 @@ class ModelValidationTest extends BaseModelTest {
'required' => true
),
'or' => true,
'ignore_on_same' => 'id'
'ignoreOnSame' => 'id'
);
$this->assertEquals($TestModel->validatorParams, $expected);

View file

@ -109,7 +109,6 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($testResult['Article']['title'], $data['Article']['title']);
$this->assertEquals($testResult['Article']['created'], '2008-01-01 00:00:00');
}
/**
@ -617,7 +616,6 @@ class ModelWriteTest extends BaseModelTest {
$result = $TestModel->saveField('title', '', true);
$this->assertFalse($result);
$TestModel->recursive = -1;
$TestModel->id = 1;
$result = $TestModel->saveField('user_id', 9999);
@ -630,7 +628,6 @@ class ModelWriteTest extends BaseModelTest {
));
$this->assertEquals($expected, $result);
$this->loadFixtures('Node', 'Dependency');
$Node = new Node();
$Node->set('id', 1);
@ -1512,12 +1509,16 @@ class ModelWriteTest extends BaseModelTest {
),
'Tag' => array(
'Tag' => array(1, 2, 3)
));
)
);
$result = $TestModel->create()
&& $TestModel->save($data, true, array('user_id', 'title', 'published'));
$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();
$expected = array(
'Article' => array(
@ -1550,7 +1551,6 @@ class ModelWriteTest extends BaseModelTest {
)));
$this->assertEquals($expected, $result);
$this->loadFixtures('JoinA', 'JoinC', 'JoinAC', 'JoinB', 'JoinAB');
$TestModel = new JoinA();
$TestModel->hasBelongsToMany = array('JoinC' => array('unique' => true));
@ -2133,7 +2133,6 @@ class ModelWriteTest extends BaseModelTest {
'id' => 3,
'title' => 'Third Article'
)));
$this->assertEquals($expected, $articles);
$comments = $Comment->find('all', array(
@ -2754,7 +2753,6 @@ class ModelWriteTest extends BaseModelTest {
unset($result[6]['Comment']['created'], $result[6]['Comment']['updated']);
$this->assertEquals($result[6]['Comment'], $expected);
$expected = array(
'id' => '2',
'comment_id' => '7',
@ -2878,7 +2876,6 @@ class ModelWriteTest extends BaseModelTest {
)));
$this->assertEquals($expected, $result);
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
$data = array(
'Comment' => array(
@ -4545,7 +4542,6 @@ class ModelWriteTest extends BaseModelTest {
$result = Set::extract('/Comment/article_id', $result);
$this->assertEquals($result[0], 4);
$model->deleteAll(true);
$data = array(
'Article' => array(
@ -4801,7 +4797,6 @@ class ModelWriteTest extends BaseModelTest {
unset($result[6]['Comment']['updated'], $result[6]['Comment']['created']);
$this->assertEquals($result[6]['Comment'], $expected);
$expected = array(
'id' => '2',
'comment_id' => '7',
@ -4985,7 +4980,6 @@ class ModelWriteTest extends BaseModelTest {
)));
$this->assertEquals($expected, $result);
$model->Attachment->bindModel(array('belongsTo' => array('Comment')), false);
$data = array(
'Comment' => array(
@ -5155,7 +5149,6 @@ class ModelWriteTest extends BaseModelTest {
), array('validate' => true, 'atomic' => false));
$this->assertSame($result, array(true, false));
}
/**
@ -5850,7 +5843,6 @@ class ModelWriteTest extends BaseModelTest {
$result = Set::extract('/Comment/article_id', $result);
$this->assertEquals($result[0], 4);
$model->deleteAll(true);
$data = array(
'Article' => array(
@ -6335,7 +6327,7 @@ class ModelWriteTest extends BaseModelTest {
'id' => '4',
'author_id' => '5',
'title' => 'Post without body',
'body' => NULL,
'body' => null,
'published' => 'N',
'created' => $ts,
'updated' => $ts,
@ -6343,7 +6335,7 @@ class ModelWriteTest extends BaseModelTest {
'Author' => array (
'id' => '5',
'user' => 'bob',
'password' => NULL,
'password' => null,
'created' => $ts,
'updated' => $ts,
'test' => 'working',
@ -6560,4 +6552,56 @@ class ModelWriteTest extends BaseModelTest {
$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);
}
}

View file

@ -45,13 +45,14 @@ class AppModel extends Model {
*
* @return array
*/
public function _findPublished($state, $query, $results = array()) {
protected function _findPublished($state, $query, $results = array()) {
if ($state === 'before') {
$query['conditions']['published'] = 'Y';
return $query;
}
return $results;
}
}
/**
@ -88,6 +89,7 @@ class Test extends CakeTestModel {
'created' => array('type' => 'date', 'null' => '1', 'default' => '', 'length' => ''),
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
/**
@ -190,6 +192,7 @@ class TestValidate extends CakeTestModel {
public function validateTitle($value) {
return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0);
}
}
/**
@ -217,6 +220,7 @@ class User extends CakeTestModel {
* beforeFind() callback used to run ContainableBehaviorTest::testLazyLoad()
*
* @return bool
* @throws Exception
*/
public function beforeFind($queryData) {
if (!empty($queryData['lazyLoad'])) {
@ -226,6 +230,7 @@ class User extends CakeTestModel {
}
return true;
}
}
/**
@ -292,12 +297,13 @@ class Article extends CakeTestModel {
* @param mixed $title
* @return void
*/
static function titleDuplicate($title) {
public static function titleDuplicate($title) {
if ($title === 'My Article Title') {
return false;
}
return true;
}
}
/**
@ -307,6 +313,7 @@ class Article extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class BeforeDeleteComment extends CakeTestModel {
public $name = 'BeforeDeleteComment';
public $useTable = 'comments';
@ -316,6 +323,7 @@ class BeforeDeleteComment extends CakeTestModel {
$db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3)));
return true;
}
}
/**
@ -338,6 +346,7 @@ class NumericArticle extends CakeTestModel {
* @var string 'numeric_articles'
*/
public $useTable = 'numeric_articles';
}
/**
@ -367,6 +376,7 @@ class Article10 extends CakeTestModel {
* @var array
*/
public $hasMany = array('Comment' => array('dependent' => true, 'exclusive' => true));
}
/**
@ -417,6 +427,7 @@ class ArticleFeatured extends CakeTestModel {
* @var array
*/
public $validate = array('user_id' => 'numeric', 'title' => 'notEmpty', 'body' => 'notEmpty');
}
/**
@ -554,6 +565,7 @@ class ModifiedComment extends CakeTestModel {
}
return $results;
}
}
/**
@ -595,6 +607,7 @@ class AgainModifiedComment extends CakeTestModel {
}
return $results;
}
}
/**
@ -885,6 +898,7 @@ class Post extends CakeTestModel {
$this->useDbConfig = 'test';
return $results;
}
}
/**
@ -918,6 +932,7 @@ class Author extends CakeTestModel {
$results[0]['Author']['test'] = 'working';
return $results;
}
}
/**
@ -946,6 +961,7 @@ class ModifiedAuthor extends Author {
}
return $results;
}
}
/**
@ -1064,7 +1080,6 @@ class BiddingMessage extends CakeTestModel {
*/
public $primaryKey = 'bidding';
/**
* belongsTo property
*
@ -1164,6 +1179,7 @@ class NodeAfterFind extends CakeTestModel {
public function afterFind($results, $primary = false) {
return $results;
}
}
/**
@ -1943,25 +1959,30 @@ class Callback extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class CallbackPostTestModel extends CakeTestModel {
public $useTable = 'posts';
/**
* variable to control return of beforeValidate
*
* @var string
*/
public $beforeValidateReturn = true;
/**
* variable to control return of beforeSave
*
* @var string
*/
public $beforeSaveReturn = true;
/**
* variable to control return of beforeDelete
*
* @var string
*/
public $beforeDeleteReturn = true;
/**
* beforeSave callback
*
@ -1970,6 +1991,7 @@ class CallbackPostTestModel extends CakeTestModel {
public function beforeSave($options = array()) {
return $this->beforeSaveReturn;
}
/**
* beforeValidate callback
*
@ -1978,6 +2000,7 @@ class CallbackPostTestModel extends CakeTestModel {
public function beforeValidate($options = array()) {
return $this->beforeValidateReturn;
}
/**
* beforeDelete callback
*
@ -1986,6 +2009,7 @@ class CallbackPostTestModel extends CakeTestModel {
public function beforeDelete($cascade = true) {
return $this->beforeDeleteReturn;
}
}
/**
@ -2098,7 +2122,7 @@ class ValidationTest1 extends CakeTestModel {
*
* @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();
unset($this->validatorParams['this']);
return true;
@ -2112,6 +2136,7 @@ class ValidationTest1 extends CakeTestModel {
public function customValidatorWithMessage($data) {
return 'This field will *never* validate! Muhahaha!';
}
/**
* Test validation with many parameters
*
@ -2122,6 +2147,7 @@ class ValidationTest1 extends CakeTestModel {
unset($this->validatorParams['this']);
return true;
}
}
/**
@ -2178,6 +2204,7 @@ class ValidationTest2 extends CakeTestModel {
public function schema($field = false) {
return array();
}
}
/**
@ -2202,10 +2229,13 @@ class Person extends CakeTestModel {
public $belongsTo = array(
'Mother' => array(
'className' => 'Person',
'foreignKey' => 'mother_id'),
'foreignKey' => 'mother_id'
),
'Father' => array(
'className' => 'Person',
'foreignKey' => 'father_id'));
'foreignKey' => 'father_id'
)
);
}
/**
@ -2293,7 +2323,14 @@ class Cd extends CakeTestModel {
*
* @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
*/
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
* @return void
*/
public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parent_id = null, $prefix = '1', $hierachial = true) {
if (!$parent_id) {
public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierachial = true) {
if (!$parentId) {
$db = ConnectionManager::getDataSource($this->useDbConfig);
$db->truncate($this->table);
$this->save(array($this->name => array('name' => '1. Root')));
@ -2482,15 +2526,16 @@ class NumberTree extends CakeTestModel {
if ($hierachial) {
if ($this->name == 'UnconventionalTree') {
$data[$this->name]['join'] = $parent_id;
$data[$this->name]['join'] = $parentId;
} else {
$data[$this->name]['parent_id'] = $parent_id;
$data[$this->name]['parent_id'] = $parentId;
}
}
$this->save($data);
$this->initialize($levelLimit, $childLimit, $currentLevel + 1, $this->id, $name, $hierachial);
}
}
}
/**
@ -2543,6 +2588,7 @@ class UnconventionalTree extends NumberTree {
* @var string 'FlagTree'
*/
public $name = 'UnconventionalTree';
public $actsAs = array(
'Tree' => array(
'parent' => 'join',
@ -2550,6 +2596,7 @@ class UnconventionalTree extends NumberTree {
'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';
}
}
}
/**
@ -2746,7 +2794,9 @@ class ContentAccount extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class FilmFile extends CakeTestModel {
public $name = 'FilmFile';
}
/**
@ -2755,6 +2805,7 @@ class FilmFile extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class Basket extends CakeTestModel {
public $name = 'Basket';
public $belongsTo = array(
@ -2766,6 +2817,7 @@ class Basket extends CakeTestModel {
'order' => ''
)
);
}
/**
@ -2941,25 +2993,30 @@ class TranslateTestModel extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class TranslateWithPrefix extends CakeTestModel {
/**
* name property
*
* @var string 'TranslateTestModel'
*/
public $name = 'TranslateWithPrefix';
/**
* tablePrefix property
*
* @var string 'i18n'
*/
public $tablePrefix = 'i18n_';
/**
* displayField property
*
* @var string 'field'
*/
public $displayField = 'field';
}
/**
* TranslatedItem class.
*
@ -2994,6 +3051,7 @@ class TranslatedItem extends CakeTestModel {
* @var string 'TranslateTestModel'
*/
public $translateModel = 'TranslateTestModel';
}
/**
@ -3002,31 +3060,37 @@ class TranslatedItem extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class TranslatedItem2 extends CakeTestModel {
/**
* name property
*
* @var string 'TranslatedItem'
*/
public $name = 'TranslatedItem';
/**
* cacheQueries property
*
* @var bool false
*/
public $cacheQueries = false;
/**
* actsAs property
*
* @var array
*/
public $actsAs = array('Translate' => array('content', 'title'));
/**
* translateModel property
*
* @var string 'TranslateTestModel'
*/
public $translateModel = 'TranslateWithPrefix';
}
/**
* TranslatedItemWithTable class.
*
@ -3075,6 +3139,7 @@ class TranslatedItemWithTable extends CakeTestModel {
* @var string 'another_i18n'
*/
public $translateTable = 'another_i18n';
}
/**
@ -3104,6 +3169,7 @@ class TranslateArticleModel extends CakeTestModel {
* @var string 'field'
*/
public $displayField = 'field';
}
/**
@ -3147,55 +3213,79 @@ class TranslatedArticle extends CakeTestModel {
* @var array
*/
public $belongsTo = array('User');
}
class CounterCacheUser extends CakeTestModel {
public $name = 'CounterCacheUser';
public $alias = 'User';
public $hasMany = array('Post' => array(
public $hasMany = array(
'Post' => array(
'className' => 'CounterCachePost',
'foreignKey' => 'user_id'
));
)
);
}
class CounterCachePost extends CakeTestModel {
public $name = 'CounterCachePost';
public $alias = 'Post';
public $belongsTo = array('User' => array(
public $belongsTo = array(
'User' => array(
'className' => 'CounterCacheUser',
'foreignKey' => 'user_id',
'counterCache' => true
));
)
);
}
class CounterCacheUserNonstandardPrimaryKey extends CakeTestModel {
public $name = 'CounterCacheUserNonstandardPrimaryKey';
public $alias = 'User';
public $primaryKey = 'uid';
public $hasMany = array('Post' => array(
public $hasMany = array(
'Post' => array(
'className' => 'CounterCachePostNonstandardPrimaryKey',
'foreignKey' => 'uid'
));
)
);
}
class CounterCachePostNonstandardPrimaryKey extends CakeTestModel {
public $name = 'CounterCachePostNonstandardPrimaryKey';
public $alias = 'Post';
public $primaryKey = 'pid';
public $belongsTo = array('User' => array(
public $belongsTo = array(
'User' => array(
'className' => 'CounterCacheUserNonstandardPrimaryKey',
'foreignKey' => 'uid',
'counterCache' => true
));
)
);
}
class ArticleB extends CakeTestModel {
public $name = 'ArticleB';
public $useTable = 'articles';
public $hasAndBelongsToMany = array(
'TagB' => array(
'className' => 'TagB',
@ -3204,11 +3294,15 @@ class ArticleB extends CakeTestModel {
'associationForeignKey' => 'tag_id'
)
);
}
class TagB extends CakeTestModel {
public $name = 'TagB';
public $useTable = 'tags';
public $hasAndBelongsToMany = array(
'ArticleB' => array(
'className' => 'ArticleB',
@ -3217,10 +3311,13 @@ class TagB extends CakeTestModel {
'associationForeignKey' => 'article_id'
)
);
}
class Fruit extends CakeTestModel {
public $name = 'Fruit';
public $hasAndBelongsToMany = array(
'UuidTag' => array(
'className' => 'UuidTag',
@ -3230,11 +3327,15 @@ class Fruit extends CakeTestModel {
'with' => 'FruitsUuidTag'
)
);
}
class FruitsUuidTag extends CakeTestModel {
public $name = 'FruitsUuidTag';
public $primaryKey = false;
public $belongsTo = array(
'UuidTag' => array(
'className' => 'UuidTag',
@ -3245,10 +3346,13 @@ class FruitsUuidTag extends CakeTestModel {
'foreignKey' => 'fruit_id',
)
);
}
class UuidTag extends CakeTestModel {
public $name = 'UuidTag';
public $hasAndBelongsToMany = array(
'Fruit' => array(
'className' => 'Fruit',
@ -3258,11 +3362,15 @@ class UuidTag extends CakeTestModel {
'with' => 'FruitsUuidTag'
)
);
}
class FruitNoWith extends CakeTestModel {
public $name = 'Fruit';
public $useTable = 'fruits';
public $hasAndBelongsToMany = array(
'UuidTag' => array(
'className' => 'UuidTagNoWith',
@ -3271,11 +3379,15 @@ class FruitNoWith extends CakeTestModel {
'associationForeignKey' => 'uuid_tag_id',
)
);
}
class UuidTagNoWith extends CakeTestModel {
public $name = 'UuidTag';
public $useTable = 'uuid_tags';
public $hasAndBelongsToMany = array(
'Fruit' => array(
'className' => 'FruitNoWith',
@ -3284,21 +3396,29 @@ class UuidTagNoWith extends CakeTestModel {
'associationForeignKey' => 'fruit_id',
)
);
}
class ProductUpdateAll extends CakeTestModel {
public $name = 'ProductUpdateAll';
public $useTable = 'product_update_all';
}
class GroupUpdateAll extends CakeTestModel {
public $name = 'GroupUpdateAll';
public $useTable = 'group_update_all';
}
class TransactionTestModel extends CakeTestModel {
public $name = 'TransactionTestModel';
public $useTable = 'samples';
public function afterSave($created) {
@ -3307,10 +3427,13 @@ class TransactionTestModel extends CakeTestModel {
);
$this->saveAll($data, array('atomic' => true, 'callbacks' => false));
}
}
class TransactionManyTestModel extends CakeTestModel {
public $name = 'TransactionManyTestModel';
public $useTable = 'samples';
public function afterSave($created) {
@ -3319,10 +3442,13 @@ class TransactionManyTestModel extends CakeTestModel {
);
$this->saveMany($data, array('atomic' => true, 'callbacks' => false));
}
}
class Site extends CakeTestModel {
public $name = 'Site';
public $useTable = 'sites';
public $hasAndBelongsToMany = array(
@ -3331,7 +3457,9 @@ class Site extends CakeTestModel {
}
class Domain extends CakeTestModel {
public $name = 'Domain';
public $useTable = 'domains';
public $hasAndBelongsToMany = array(
@ -3411,6 +3539,7 @@ class TestModel extends CakeTestModel {
public function findAll($conditions = null, $fields = null, $order = null, $recursive = null) {
return $conditions;
}
}
/**
@ -3538,6 +3667,7 @@ class TestModel4 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3582,6 +3712,7 @@ class TestModel4TestModel7 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3649,6 +3780,7 @@ class TestModel5 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3684,10 +3816,12 @@ class TestModel6 extends CakeTestModel {
*
* @var array
*/
public $belongsTo = array('TestModel5' => array(
public $belongsTo = array(
'TestModel5' => array(
'className' => 'TestModel5',
'foreignKey' => 'test_model5_id'
));
)
);
/**
* schema method
@ -3706,6 +3840,7 @@ class TestModel6 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3752,6 +3887,7 @@ class TestModel7 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3812,6 +3948,7 @@ class TestModel8 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3847,11 +3984,13 @@ class TestModel9 extends CakeTestModel {
*
* @var array
*/
public $belongsTo = array('TestModel8' => array(
public $belongsTo = array(
'TestModel8' => array(
'className' => 'TestModel8',
'foreignKey' => 'test_model8_id',
'conditions' => 'TestModel8.name != \'larry\''
));
)
);
/**
* schema method
@ -3870,6 +4009,7 @@ class TestModel9 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -3928,6 +4068,7 @@ class Level extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4059,6 +4200,7 @@ class User2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4141,6 +4283,7 @@ class Category2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4212,6 +4355,7 @@ class Article2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4259,6 +4403,7 @@ class CategoryFeatured2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4316,6 +4461,7 @@ class Featured2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4369,6 +4515,7 @@ class Comment2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4448,6 +4595,7 @@ class ArticleFeatured2 extends CakeTestModel {
}
return $this->_schema;
}
}
/**
@ -4524,6 +4672,7 @@ class MysqlTestModel extends Model {
'updated' => array('type' => 'datetime', 'null' => '1', 'default' => '', 'length' => null)
);
}
}
/**
@ -4532,9 +4681,13 @@ class MysqlTestModel extends Model {
*/
class PrefixTestModel extends CakeTestModel {
}
class PrefixTestUseTableModel extends CakeTestModel {
public $name = 'PrefixTest';
public $useTable = 'prefix_tests';
}
/**
@ -4574,6 +4727,7 @@ class ScaffoldMock extends CakeTestModel {
'foreignKey' => 'article_id',
)
);
/**
* hasAndBelongsToMany property
*
@ -4587,6 +4741,7 @@ class ScaffoldMock extends CakeTestModel {
'joinTable' => 'join_things'
)
);
}
/**
@ -4649,12 +4804,14 @@ class ScaffoldComment extends CakeTestModel {
* @package Cake.Test.Case.Controller
*/
class ScaffoldTag extends CakeTestModel {
/**
* useTable property
*
* @var string 'posts'
*/
public $useTable = 'tags';
}
/**
@ -4663,12 +4820,14 @@ class ScaffoldTag extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class Player extends CakeTestModel {
public $hasAndBelongsToMany = array(
'Guild' => array(
'with' => 'GuildsPlayer',
'unique' => true,
),
);
}
/**
@ -4677,12 +4836,14 @@ class Player extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class Guild extends CakeTestModel {
public $hasAndBelongsToMany = array(
'Player' => array(
'with' => 'GuildsPlayer',
'unique' => true,
),
);
}
/**
@ -4731,6 +4892,7 @@ class ArmorsPlayer extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class CustomArticle extends AppModel {
/**
* useTable property
*
@ -4750,7 +4912,7 @@ class CustomArticle extends AppModel {
*
* @return array
*/
public function _findUnPublished($state, $query, $results = array()) {
protected function _findUnPublished($state, $query, $results = array()) {
if ($state === 'before') {
$query['conditions']['published'] = 'N';
return $query;

View file

@ -22,6 +22,7 @@ App::uses('Xml', 'Utility');
App::uses('CakeRequest', 'Network');
class CakeRequestTest extends CakeTestCase {
/**
* setup callback
*
@ -106,7 +107,6 @@ class CakeRequestTest extends CakeTestCase {
$expected = array('one' => 'something', 'two' => 'else');
$this->assertEquals($expected, $request->query);
$this->assertEquals('some/path?one=something&two=else', $request->url);
}
/**
@ -161,7 +161,6 @@ class CakeRequestTest extends CakeTestCase {
$this->assertFalse(isset($request->random));
}
/**
* test parsing POST data into the object.
*
@ -437,7 +436,6 @@ class CakeRequestTest extends CakeTestCase {
);
$this->assertEquals($request->data, $expected);
$_FILES = array(
'data' => array(
'name' => array('birth_cert' => 'born on.txt'),
@ -471,7 +469,6 @@ class CakeRequestTest extends CakeTestCase {
);
$request = new CakeRequest('some/path');
$this->assertEquals($request->params['form'], $_FILES);
}
/**
@ -682,7 +679,7 @@ class CakeRequestTest extends CakeTestCase {
* @expectedException CakeException
* @return void
*/
public function test__callExceptionOnUnknownMethod() {
public function testMagicCallExceptionOnUnknownMethod() {
$request = new CakeRequest('some/path');
$request->IamABanana();
}
@ -725,7 +722,7 @@ class CakeRequestTest extends CakeTestCase {
*
* @return void
*/
public function test__get() {
public function testMagicget() {
$request = new CakeRequest('some/path');
$request->params = array('controller' => 'posts', 'action' => 'view', 'plugin' => 'blogs');
@ -740,7 +737,7 @@ class CakeRequestTest extends CakeTestCase {
*
* @return void
*/
public function test__isset() {
public function testMagicisset() {
$request = new CakeRequest('some/path');
$request->params = array(
'controller' => 'posts',
@ -945,7 +942,6 @@ class CakeRequestTest extends CakeTestCase {
$this->assertEquals($request->webroot, '/1.2.x.x/');
$this->assertEquals($request->url, 'posts/view/1');
$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/app/webroot';
$_SERVER['PHP_SELF'] = '/index.php';
$_SERVER['PATH_INFO'] = '/posts/add';
@ -962,7 +958,6 @@ class CakeRequestTest extends CakeTestCase {
$this->assertEquals('', $request->base);
$this->assertEquals('/', $request->webroot);
$_SERVER['DOCUMENT_ROOT'] = '/some/apps/where';
$_SERVER['PHP_SELF'] = '/app/webroot/index.php';
$request = new CakeRequest();
@ -1704,7 +1699,6 @@ XML;
);
}
/**
* Test is('requested') and isRequested()
*

View file

@ -652,7 +652,6 @@ class CakeResponseTest extends CakeTestCase {
->method('_sendHeader')->with('Cache-Control', 'public');
$response->send();
$response = $this->getMock('CakeResponse', array('_sendHeader', '_sendContent'));
$response->sharable(false);
$headers = $response->header();
@ -765,7 +764,6 @@ class CakeResponseTest extends CakeTestCase {
$response->expects($this->at(1))
->method('_sendHeader')->with('Cache-Control', 's-maxage=3600, must-revalidate');
$response->send();
}
/**
@ -899,7 +897,6 @@ class CakeResponseTest extends CakeTestCase {
$this->assertFalse($response->checkNotModified(new CakeRequest));
}
/**
* Test checkNotModified method
*

View file

@ -62,6 +62,7 @@ class TestCakeEmail extends CakeEmail {
public function encode($text) {
return $this->_encode($text);
}
}
/*
@ -308,12 +309,12 @@ class CakeEmailTest extends CakeTestCase {
$this->assertSame($expected, $result);
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => '寿限無寿限無五劫の擦り切れ海砂利水魚の水行末雲来末風来末食う寝る処に住む処やぶら小路の藪柑子パイポパイポパイポのシューリンガンシューリンガンのグーリンダイグーリンダイのポンポコピーのポンポコナーの長久命の長助'));
$expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= <cake@cakephp.org>");
$expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= <cake@cakephp.org>");
$this->assertSame($expected, $result);
}
@ -420,13 +421,12 @@ class CakeEmailTest extends CakeTestCase {
$this->assertSame($this->CakeEmail->subject(), $expected);
$this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう');
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n"
." =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n"
." =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" .
" =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
$this->assertSame($this->CakeEmail->subject(), $expected);
}
/**
* testHeaders method
*
@ -659,7 +659,6 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail->config(array());
$this->assertSame($transportClass->config(), array());
}
/**
@ -1209,7 +1208,6 @@ class CakeEmailTest extends CakeTestCase {
$this->assertTrue($this->checkContentTransferEncoding($message, '7bit'));
}
/**
* testReset method
*
@ -1493,9 +1491,9 @@ class CakeEmailTest extends CakeTestCase {
$this->CakeEmail->headerCharset = 'ISO-2022-JP';
$result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう');
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n"
. " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n"
. " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
$expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" .
" =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" .
" =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?=";
$this->assertSame($expected, $result);
}

View file

@ -52,7 +52,6 @@ class SmtpTestTransport extends SmtpTransport {
* @return void
*/
protected function _generateSocket() {
return;
}
/**

View file

@ -160,8 +160,8 @@ class DigestAuthenticationTest extends CakeTestCase {
$this->assertTrue(strpos($this->HttpSocket->request['header']['Authorization'], 'nc=00000003') > 0);
$this->assertEquals($auth['nc'], 4);
$responsePos = strpos($this->HttpSocket->request['header']['Authorization'], 'response=');
$response2 = substr($this->HttpSocket->request['header']['Authorization'], $responsePos + 10, 32);
$this->assertNotEquals($response, $response2);
$responseB = substr($this->HttpSocket->request['header']['Authorization'], $responsePos + 10, 32);
$this->assertNotEquals($response, $responseB);
}
/**

View file

@ -85,6 +85,7 @@ class TestHttpResponse extends HttpResponse {
* @package Cake.Test.Case.Network.Http
*/
class HttpResponseTest extends CakeTestCase {
/**
* This function sets up a HttpResponse
*
@ -519,14 +520,13 @@ class HttpResponseTest extends CakeTestCase {
);
$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!";
$expected1 = "HTTP/1.1 200 OK\r\n";
$this->assertEquals($this->HttpResponse['raw']['status-line'], $expected1);
$expected2 = "Server: CakePHP\r\nContEnt-Type: text/plain\r\n";
$this->assertEquals($this->HttpResponse['raw']['header'], $expected2);
$expected3 = 'This is a test!';
$this->assertEquals($this->HttpResponse['raw']['body'], $expected3);
$expected = $expected1 . $expected2 . "\r\n" . $expected3;
$expectedOne = "HTTP/1.1 200 OK\r\n";
$this->assertEquals($this->HttpResponse['raw']['status-line'], $expectedOne);
$expectedTwo = "Server: CakePHP\r\nContEnt-Type: text/plain\r\n";
$this->assertEquals($this->HttpResponse['raw']['header'], $expectedTwo);
$expectedThree = 'This is a test!';
$this->assertEquals($this->HttpResponse['raw']['body'], $expectedThree);
$expected = $expectedOne . $expectedTwo . "\r\n" . $expectedThree;
$this->assertEquals($this->HttpResponse['raw']['response'], $expected);
$expected = 'HTTP/1.1';

View file

@ -160,7 +160,7 @@ class TestHttpSocket extends HttpSocket {
* @param string $token Token to escape
* @return string Escaped token
*/
public function EscapeToken($token, $chars = null) {
public function escapeToken($token, $chars = null) {
return parent::_escapeToken($token, $chars);
}
@ -762,7 +762,6 @@ class HttpSocketTest extends CakeTestCase {
$this->assertEquals($response->first10, 'HTTP/1.x 2');
}
/**
* testRequestWithRedirect method
*
@ -812,7 +811,6 @@ class HttpSocketTest extends CakeTestCase {
$this->assertEquals('http://localhost/anotheruri', $response->getHeader('Location'));
}
/**
* testProxy method
*
@ -1496,7 +1494,6 @@ class HttpSocketTest extends CakeTestCase {
$r = $this->Socket->buildHeader(array('Test@Field' => "My value"));
$this->assertEquals($r, "Test\"@\"Field: My value\r\n");
}
/**

View file

@ -338,4 +338,5 @@ class CakeTestCaseTest extends CakeTestCase {
$this->assertTextNotContains("different\rlines", $stringDirty);
}
}

View file

@ -155,15 +155,23 @@ class CakeTestFixtureDefaultImportFixture extends CakeTestFixture {
* @package Cake.Test.Case.TestSuite
*/
class FixtureImportTestModel extends Model {
public $name = 'FixtureImport';
public $useTable = 'fixture_tests';
public $useDbConfig = 'test';
}
class FixturePrefixTest extends Model {
public $name = 'FixturePrefix';
public $useTable = '_tests';
public $tablePrefix = 'fixture';
public $useDbConfig = 'test';
}
@ -218,9 +226,9 @@ class CakeTestFixtureTest extends CakeTestCase {
$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
*/
@ -359,7 +367,6 @@ class CakeTestFixtureTest extends CakeTestCase {
$Source->create($newTestSuiteDb);
$Source->insert($newTestSuiteDb);
$Fixture = new CakeTestFixtureDefaultImportFixture();
$Fixture->fields = $Fixture->records = null;
$Fixture->import = array(

View file

@ -20,24 +20,6 @@
*/
class CakeTestSuiteTest extends CakeTestCase {
/**
* setUp
*
* @return void
*/
public function setUp() {
parent::setUp();
}
/**
* tearDown
*
* @return void
*/
public function tearDown() {
parent::tearDown();
}
/**
* testAddTestDirectory
*

View file

@ -26,7 +26,6 @@ App::uses('CakeHtmlReporter', 'TestSuite/Reporter');
require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php';
/**
* AppController class
*
@ -39,6 +38,7 @@ if (!class_exists('AppController', false)) {
* @package Cake.Test.Case.TestSuite
*/
class AppController extends Controller {
/**
* helpers property
*
@ -46,6 +46,7 @@ if (!class_exists('AppController', false)) {
* @access public
*/
public $helpers = array('Html');
/**
* uses property
*
@ -53,6 +54,7 @@ if (!class_exists('AppController', false)) {
* @access public
*/
public $uses = array('ControllerPost');
/**
* components property
*
@ -60,6 +62,7 @@ if (!class_exists('AppController', false)) {
* @access public
*/
public $components = array('Cookie');
}
} elseif (!defined('APP_CONTROLLER_EXISTS')) {
define('APP_CONTROLLER_EXISTS', true);
@ -238,7 +241,6 @@ class ControllerTestCaseTest extends CakeTestCase {
->will($this->returnValue(false));
$this->assertTrue($Tests->TestPluginComment->save(array()));
$this->assertFalse($Tests->TestPluginComment->save(array()));
}
/**

View file

@ -21,6 +21,7 @@ App::uses('HtmlCoverageReport', 'TestSuite/Coverage');
App::uses('CakeBaseReporter', 'TestSuite/Reporter');
class HtmlCoverageReportTest extends CakeTestCase {
/**
* 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.
*
@ -198,7 +198,6 @@ class HtmlCoverageReportTest extends CakeTestCase {
5 => -1
);
$result = $this->Coverage->generateDiff('myfile.php', $file, $coverage);
$this->assertTrue(

View file

@ -49,6 +49,7 @@ class CacheTestController extends Controller {
$this->set('batman', 'bruce wayne');
$this->set('spiderman', 'peter parker');
}
}
/**
@ -380,7 +381,6 @@ class CacheHelperTest extends CakeTestCase {
$this->assertTrue(file_exists($filename));
@unlink($filename);
$this->Controller->cache_parsing();
$this->Controller->cacheAction = array(
'cache_parsing' => 21600
@ -398,7 +398,6 @@ class CacheHelperTest extends CakeTestCase {
$this->assertTrue(file_exists($filename));
@unlink($filename);
$this->Controller->cache_parsing();
$this->Controller->request->addParams(array(
'controller' => 'cache_test',

View file

@ -182,6 +182,7 @@ class ContactTagsContact extends CakeTestModel {
public function setSchema($schema) {
$this->_schema = $schema;
}
}
/**
@ -217,6 +218,7 @@ class ContactNonStandardPk extends Contact {
unset($this->_schema['id']);
return $this->_schema;
}
}
/**
@ -369,6 +371,7 @@ class OpenidUrl extends CakeTestModel {
$this->invalidate('openid_not_registered');
return true;
}
}
/**
@ -432,6 +435,7 @@ class ValidateUser extends CakeTestModel {
$this->invalidate('email');
return false;
}
}
/**
@ -505,6 +509,7 @@ class ValidateProfile extends CakeTestModel {
$this->invalidate('city');
return false;
}
}
/**
@ -568,6 +573,7 @@ class ValidateItem extends CakeTestModel {
$this->invalidate('description');
return false;
}
}
/**
@ -675,8 +681,6 @@ class FormHelperTest extends CakeTestCase {
Configure::write('Security.salt', $this->oldSalt);
}
/**
* testFormCreateWithSecurity method
*
@ -975,7 +979,6 @@ class FormHelperTest extends CakeTestCase {
$this->assertEquals(array('Address.button'), $result);
}
/**
* 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->input('Address.primary.1');
$this->assertEquals('Address.primary', $this->Form->fields[0]);
$this->Form->input('Address.secondary.1.0');
$this->assertEquals('Address.secondary', $this->Form->fields[1]);
}
/**
@ -2389,7 +2395,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->View->viewVars['users'] = array('value' => 'good', 'other' => 'bad');
$this->Form->request->data = array('Model' => array('user_id' => 'value'));
@ -5271,7 +5276,6 @@ class FormHelperTest extends CakeTestCase {
$this->assertContains('label for="ModelDateYear"', $result);
}
/**
* testMonth method
*
@ -6459,7 +6463,6 @@ class FormHelperTest extends CakeTestCase {
'/div'
);
$this->assertTags($result, $expected);
}
/**
@ -6572,7 +6575,11 @@ class FormHelperTest extends CakeTestCase {
*/
public function testCreateWithInputDefaults() {
$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');
$expected = array(
@ -7058,7 +7065,6 @@ class FormHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
extract($this->dateRegex);
$now = strtotime('now');

View file

@ -52,6 +52,7 @@ class TheHtmlTestController extends Controller {
}
class TestHtmlHelper extends HtmlHelper {
/**
* expose a method as public
*
@ -800,7 +801,6 @@ class HtmlHelperTest extends CakeTestCase {
'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.2.js', 'defer' => 'defer', 'encoding' => 'utf-8')
);
$this->assertTags($result, $expected);
}
/**
@ -987,7 +987,6 @@ class HtmlHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->View->expects($this->at(0))
->method('append')
->with('script', $this->matchesRegularExpression('/window\.foo\s\=\s2;/'));
@ -1031,7 +1030,6 @@ class HtmlHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$result = $this->Html->scriptStart(array('safe' => false));
$this->assertNull($result);
echo 'this is some javascript';
@ -1116,7 +1114,6 @@ class HtmlHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Html->addCrumb('Fourth', null);
$result = $this->Html->getCrumbs();
@ -1164,6 +1161,18 @@ class HtmlHelperTest extends CakeTestCase {
* Test the array form of $startText
*/
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('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->assertRegExp('/\s+\/>$/', $result);
$result = $this->Html->meta('description', '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'));
$this->assertTags($result, array('meta' => array('name' => 'ROBOTS', 'content' => 'ALL')));
}
/**

View file

@ -22,6 +22,7 @@ App::uses('JqueryEngineHelper', 'View/Helper');
App::uses('View', 'View');
class JqueryEngineHelperTest extends CakeTestCase {
/**
* setUp
*

View file

@ -26,12 +26,15 @@ App::uses('View', 'View');
App::uses('ClassRegistry', 'Utility');
class JsEncodingObject {
protected $_title = 'Old thing';
private $__noshow = 'Never ever';
}
class OptionEngineHelper extends JsBaseEngineHelper {
protected $_optionMap = array(
'request' => array(
'complete' => 'success',
@ -58,17 +61,39 @@ class OptionEngineHelper extends JsBaseEngineHelper {
return $this->_parseOptions($options, $safe);
}
public function get($selector) {}
public function event($type, $callback, $options = array()) {}
public function domReady($functionBody) {}
public function each($callback) {}
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()) {}
public function get($selector) {
}
public function event($type, $callback, $options = array()) {
}
public function domReady($functionBody) {
}
public function each($callback) {
}
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
*/
class JsHelperTest extends CakeTestCase {
/**
* Regexp for CDATA start block
*
@ -91,7 +117,6 @@ class JsHelperTest extends CakeTestCase {
*/
public $cDataEnd = 'preg:/[^\]]*\]\]\>[\s\r\n]*/';
/**
* setUp method
*
@ -689,6 +714,7 @@ class JsHelperTest extends CakeTestCase {
$this->assertEquals($result[1], 'alert("hey you!");');
$this->assertEquals($result[2], 'confirm("Are you sure?");');
}
}
/**
@ -697,6 +723,7 @@ class JsHelperTest extends CakeTestCase {
* @package Cake.Test.Case.View.Helper
*/
class JsBaseEngineTest extends CakeTestCase {
/**
* setUp method
*
@ -812,7 +839,6 @@ class JsBaseEngineTest extends CakeTestCase {
* @return void
*/
public function testObject() {
$object = array('title' => 'New thing', 'indexes' => array(5, 6, 7, 8));
$result = $this->JsEngine->object($object);
$expected = '{"title":"New thing","indexes":[5,6,7,8]}';

View file

@ -22,6 +22,7 @@ App::uses('JsHelper', 'View/Helper');
App::uses('MootoolsEngineHelper', 'View/Helper');
class MootoolsEngineHelperTest extends CakeTestCase {
/**
* setUp
*

View file

@ -68,7 +68,6 @@ class NumberHelperTest extends CakeTestCase {
unset($this->View);
}
/**
* test CakeNumber class methods are called correctly
*/

View file

@ -212,13 +212,11 @@ class PaginatorHelperTest extends CakeTestCase {
$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->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$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->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$this->Paginator->request->params['paging']['Article']['options']['sort'] = null;
$result = $this->Paginator->sort('title', 'Title', array('direction' => 'desc'));
@ -330,7 +328,6 @@ class PaginatorHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Paginator->request->params['paging']['Article']['options']['order'] = array('Article.title' => 'asc');
$result = $this->Paginator->sort('Article.title', 'Title');
$expected = array(
@ -1344,7 +1341,6 @@ class PaginatorHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Paginator->request->params['paging'] = array(
'Client' => array(
'page' => 14,
@ -1699,7 +1695,6 @@ class PaginatorHelperTest extends CakeTestCase {
);
$this->assertTags($result, $expected);
$this->Paginator->request->params['paging'] = array(
'Client' => array(
'page' => 4895,

View file

@ -22,6 +22,7 @@ App::uses('JsHelper', 'View/Helper');
App::uses('PrototypeEngineHelper', 'View/Helper');
class PrototypeEngineHelperTest extends CakeTestCase {
/**
* setUp
*

View file

@ -28,6 +28,7 @@ class HtmlAliasHelper extends HtmlHelper {
}
class HelperCollectionTest extends CakeTestCase {
/**
* setUp
*

View file

@ -93,6 +93,7 @@ class HelperTestComment extends Model {
);
return $this->_schema;
}
}
/**
@ -123,6 +124,7 @@ class HelperTestTag extends Model {
);
return $this->_schema;
}
}
/**
@ -151,9 +153,11 @@ class HelperTestPostsTag extends Model {
);
return $this->_schema;
}
}
class TestHelper extends Helper {
/**
* Helpers for this helper.
*
@ -173,6 +177,7 @@ class TestHelper extends Helper {
public function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
return $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter);
}
}
/**
@ -644,12 +649,12 @@ class HelperTest extends CakeTestCase {
* @return void
*/
public function testAssetTimestampPluginsAndThemes() {
$_timestamp = Configure::read('Asset.timestamp');
$timestamp = Configure::read('Asset.timestamp');
Configure::write('Asset.timestamp', 'force');
App::build(array(
'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');
$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');
App::build();
Configure::write('Asset.timestamp', $_timestamp);
Configure::write('Asset.timestamp', $timestamp);
}
/**
@ -916,10 +921,11 @@ class HelperTest extends CakeTestCase {
*/
public function testLazyLoadingUsesReferences() {
$Helper = new TestHelper($this->View);
$result1 = $Helper->Html;
$result2 = $Helper->Html;
$resultA = $Helper->Html;
$resultB = $Helper->Html;
$result1->testprop = 1;
$this->assertEquals($result1->testprop, $result2->testprop);
$resultA->testprop = 1;
$this->assertEquals($resultA->testprop, $resultB->testprop);
}
}

View file

@ -39,6 +39,7 @@ class TestScaffoldView extends ScaffoldView {
public function testGetFilename($action) {
return $this->_getViewFileName($action);
}
}
/**
@ -178,13 +179,13 @@ class ScaffoldViewTest extends CakeTestCase {
$ScaffoldView = new TestScaffoldView($Controller);
$result = $ScaffoldView->testGetFilename('admin_add');
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'
. DS .'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' .
DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
$this->assertEquals($expected, $result);
$result = $ScaffoldView->testGetFilename('add');
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin'
. DS .'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' .
DS . 'TestPlugin' . DS . 'View' . DS . 'Tests' . DS . 'scaffold.form.ctp';
$this->assertEquals($expected, $result);
Configure::write('Routing.prefixes', $_admin);
@ -202,8 +203,8 @@ class ScaffoldViewTest extends CakeTestCase {
$ScaffoldView = new TestScaffoldView($this->Controller);
$result = $ScaffoldView->testGetFilename('index');
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS
. 'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'scaffold.index.ctp';
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS .
'Themed' . DS . 'TestTheme' . DS . 'Posts' . DS . 'scaffold.index.ctp';
$this->assertEquals($expected, $result);
}

View file

@ -48,6 +48,7 @@ class ThemePosts2Controller extends Controller {
$test3 = 'even more data';
$this->set(compact('test2', 'test3'));
}
}
/**

View file

@ -66,6 +66,7 @@ class ViewPostsController extends Controller {
$this->set('foo', 'this is foo var');
$this->set('bar', 'this is bar var');
}
}
/**
@ -95,6 +96,7 @@ class ThemePostsController extends Controller {
$test3 = 'even more data';
$this->set(compact('test2', 'test3'));
}
}
/**
@ -196,6 +198,7 @@ class TestView extends View {
public function scripts() {
return $this->_scripts;
}
}
/**
@ -229,6 +232,7 @@ class TestAfterHelper extends Helper {
public function afterLayout($layoutFile) {
$this->_View->output .= 'modified in the afterlife';
}
}
@ -292,8 +296,8 @@ class ViewTest extends CakeTestCase {
unset($this->ThemeView);
unset($this->ThemePostsController);
unset($this->ThemeController);
}
/**
* testGetTemplate method
*
@ -1045,7 +1049,6 @@ class ViewTest extends CakeTestCase {
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Posts' . DS . 'index.ctp';
$result = $View->getViewFileName('../Posts/index');
$this->assertEquals($expected, $result);
}
/**
@ -1114,44 +1117,6 @@ class ViewTest extends CakeTestCase {
$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
*

View file

@ -30,6 +30,7 @@ class AccountFixture extends CakeTestFixture {
* @var string 'Aco'
*/
public $name = 'Account';
public $table = 'Accounts';
/**

View file

@ -30,6 +30,7 @@ class ContentAccountFixture extends CakeTestFixture {
* @var string 'Aco'
*/
public $name = 'ContentAccount';
public $table = 'ContentAccounts';
/**

View file

@ -30,6 +30,7 @@ class ContentFixture extends CakeTestFixture {
* @var string 'Aco'
*/
public $name = 'Content';
public $table = 'Content';
/**

View file

@ -40,7 +40,6 @@ class DataTestFixture extends CakeTestFixture {
'id' => array('type' => 'integer', 'key' => 'primary'),
'count' => array('type' => 'integer', 'default' => 0),
'float' => array('type' => 'float', 'default' => 0),
//'timestamp' => array('type' => 'timestamp', 'default' => null, 'null' => true),
'created' => array('type' => 'datetime', 'default' => null),
'updated' => array('type' => 'datetime', 'default' => null)
);

View file

@ -52,6 +52,7 @@ class FixturizedTestCase extends CakeTestCase {
* test that a fixtures are unoaded even if the test throws exceptions
*
* @return void
* @throws Exception
*/
public function testThrowException() {
throw new Exception();

View file

@ -23,15 +23,18 @@
* @package Cake.Test.Fixture
*/
class GroupUpdateAllFixture extends CakeTestFixture {
public $name = 'GroupUpdateAll';
public $table = 'group_update_all';
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),
'code' => array('type' => 'integer', 'null' => false, 'length' => 4),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
public $records = array(
array(
'id' => 1,

View file

@ -27,9 +27,11 @@
class PrefixTestFixture extends CakeTestFixture {
public $name = 'PrefixTest';
public $table = 'prefix_prefix_tests';
public $fields = array(
'id' => array('type' => 'integer', 'key' => 'primary'),
);
}

View file

@ -23,16 +23,19 @@
* @package Cake.Test.Fixture
*/
class ProductUpdateAllFixture extends CakeTestFixture {
public $name = 'ProductUpdateAll';
public $table = 'product_update_all';
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),
'groupcode' => array('type' => 'integer', 'null' => false, 'length' => 4),
'group_id' => array('type' => 'integer', 'null' => false, 'length' => 8),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
public $records = array(
array(
'id' => 1,

View file

@ -31,13 +31,6 @@ class SessionFixture extends CakeTestFixture {
*/
public $name = 'Session';
/**
* table property.
*
* @var string
*/
// public $table = 'sessions';
/**
* fields property
*

View file

@ -1,5 +1,4 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -28,6 +27,7 @@
* @package Cake.Test.Fixture
*/
class TranslateWithPrefixFixture extends CakeTestFixture {
/**
* name property
*

View file

@ -30,6 +30,7 @@ class UnderscoreFieldFixture extends CakeTestFixture {
* @var string 'UnderscoreField'
*/
public $name = 'UnderscoreField';
/**
* fields property
*
@ -43,6 +44,7 @@ class UnderscoreFieldFixture extends CakeTestFixture {
'published' => array('type' => 'string', 'length' => 1, 'default' => 'N'),
'another_field' => array('type' => 'integer', 'length' => 3),
);
/**
* records property
*

View file

@ -17,7 +17,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestsAppsController extends AppController {
public $name = 'TestsApps';
public $uses = array();
public function index() {
@ -40,4 +42,5 @@ class TestsAppsController extends AppController {
public function redirect_to() {
$this->redirect('http://cakephp.org');
}
}

View file

@ -17,8 +17,11 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestsAppsPostsController extends AppController {
public $name = 'TestsAppsPosts';
public $uses = array('Post');
public $viewPath = 'TestsApps';
public function add() {

View file

@ -24,13 +24,18 @@ class TestAppCacheEngine extends CacheEngine {
}
}
public function read($key) { }
public function increment($key, $offset = 1) { }
public function decrement($key, $offset = 1) { }
public function delete($key) { }
public function clear($check) { }
public function read($key) {
}
public function increment($key, $offset = 1) {
}
public function decrement($key, $offset = 1) {
}
public function delete($key) {
}
public function clear($check) {
}
}

View file

@ -16,4 +16,5 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class Library {}
class Library {
}

View file

@ -22,6 +22,5 @@ App::uses('CakeLogInterface', 'Log');
class TestAppLog implements CakeLogInterface {
public function write($type, $message) {
}
}

View file

@ -16,4 +16,5 @@
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestUtilityClass {}
class TestUtilityClass {
}

View file

@ -19,6 +19,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class Comment extends AppModel {
public $useTable = 'comments';
public $name = 'Comment';
}

View file

@ -13,22 +13,18 @@ class TestAppLibSession implements CakeSessionHandlerInterface {
}
public function close() {
}
public function read($id) {
}
public function write($id, $data) {
}
public function destroy($id) {
}
public function gc($expires = null) {
}
}
}

View file

@ -19,12 +19,15 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class PersisterOne extends AppModel {
public $useTable = 'posts';
public $name = 'PersisterOne';
public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
public $validate = array(
'title' => array(
'custom' => array(
@ -53,4 +56,5 @@ class PersisterOne extends AppModel {
)
),
);
}

View file

@ -19,10 +19,13 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class PersisterTwo extends AppModel {
public $useTable = 'posts';
public $name = 'PersisterTwo';
public $actsAs = array('PersisterOneBehavior', 'TestPlugin.TestPluginPersisterOne');
public $hasMany = array('Comment', 'TestPlugin.TestPluginComment');
}

View file

@ -19,6 +19,9 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class Post extends AppModel {
public $useTable = 'posts';
public $name = 'Post';
}

View file

@ -23,13 +23,13 @@ class TestPluginAppSchema extends CakeSchema {
public $name = 'TestPluginApp';
public $test_plugin_acos = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'model' => array('type' => 'string', 'null' => true),
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'alias' => array('type' => 'string', 'null' => true),
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
}

View file

@ -17,5 +17,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class PluginsComponent extends Component {
public $components = array('TestPlugin.Other');
}

View file

@ -17,5 +17,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestPluginComponentComponent extends Object {
public $components = array('TestPlugin.TestPluginOtherComponent');
}

View file

@ -16,4 +16,5 @@
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestPluginAppController extends AppController { }
class TestPluginAppController extends AppController {
}

View file

@ -17,6 +17,7 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestPluginController extends TestPluginAppController {
public $uses = array();
public function index() {
@ -26,4 +27,5 @@ class TestPluginController extends TestPluginAppController {
public function add() {
$this->autoRender = false;
}
}

View file

@ -17,9 +17,13 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestsController extends TestPluginAppController {
public $name = 'Tests';
public $uses = array();
public $helpers = array('TestPlugin.OtherHelper', 'Html');
public $components = array('TestPlugin.Plugins');
public function index() {
@ -29,4 +33,5 @@ class TestsController extends TestPluginAppController {
public function some_method() {
return 25;
}
}

View file

@ -18,16 +18,22 @@
*/
class TestPluginCacheEngine extends CacheEngine {
public function write($key, $value, $duration) { }
public function write($key, $value, $duration) {
}
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) {
}
}

View file

@ -16,4 +16,5 @@
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class CustomLibClass {}
class CustomLibClass {
}

View file

@ -19,6 +19,5 @@
class TestPluginLog implements CakeLogInterface {
public function write($type, $message) {
}
}

View file

@ -16,4 +16,5 @@
* @since CakePHP(tm) v 1.2.0.5432
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestPluginLibrary {}
class TestPluginLibrary {
}

View file

@ -16,4 +16,5 @@
* @since CakePHP(tm) v 2.0.1
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TestPluginOtherLibrary {}
class TestPluginOtherLibrary {
}

View file

@ -1,5 +1,4 @@
<?php
/* SVN FILE: $Id$ */
/**
* Behavior for binding management.
*

View file

@ -1,5 +1,4 @@
<?php
/* SVN FILE: $Id$ */
/**
* Behavior for binding management.
*

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