Merge branch 'master' into 2.4

Conflicts:
	lib/Cake/Console/ShellDispatcher.php
	lib/Cake/Utility/CakeNumber.php
	lib/Cake/View/Elements/sql_dump.ctp
This commit is contained in:
Jose Lorenzo Rodriguez 2013-08-11 23:31:10 +02:00
commit 9d07fc4330
39 changed files with 208 additions and 115 deletions

View file

@ -111,7 +111,7 @@ before_script:
}" > app/Config/database.php }" > app/Config/database.php
script: script:
- sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi" - sh -c "if [ '$PHPCS' = '1' ]; then phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; elif [ '$DB' = 'mysql' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else ./lib/Cake/Console/cake test core AllDbRelated --stderr; fi"
notifications: notifications:
email: false email: false

View file

@ -223,6 +223,8 @@ class FileEngine extends CacheEngine {
if (!$this->_init) { if (!$this->_init) {
return false; return false;
} }
$this->_File = null;
$threshold = $now = false; $threshold = $now = false;
if ($check) { if ($check) {
$now = time(); $now = time();
@ -233,11 +235,17 @@ class FileEngine extends CacheEngine {
$directory = new RecursiveDirectoryIterator($this->settings['path']); $directory = new RecursiveDirectoryIterator($this->settings['path']);
$contents = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST); $contents = new RecursiveIteratorIterator($directory, RecursiveIteratorIterator::SELF_FIRST);
$cleared = array();
foreach ($contents as $path) { foreach ($contents as $path) {
if ($path->isFile()) { if ($path->isFile()) {
continue; continue;
} }
$this->_clearDirectory($path->getRealPath() . DS, $now, $threshold);
$path = $path->getRealPath() . DS;
if (!in_array($path, $cleared)) {
$this->_clearDirectory($path, $now, $threshold);
$cleared[] = $path;
}
} }
return true; return true;
} }
@ -263,7 +271,7 @@ class FileEngine extends CacheEngine {
continue; continue;
} }
$filePath = $path . $entry; $filePath = $path . $entry;
if (is_dir($filePath)) { if (!file_exists($filePath) || is_dir($filePath)) {
continue; continue;
} }
$file = new SplFileObject($path . $entry, 'r'); $file = new SplFileObject($path . $entry, 'r');
@ -281,7 +289,9 @@ class FileEngine extends CacheEngine {
} }
} }
if ($file->isFile()) { if ($file->isFile()) {
unlink($file->getRealPath()); $_path = $file->getRealPath();
$file = null;
unlink($_path);
} }
} }
} }
@ -394,6 +404,7 @@ class FileEngine extends CacheEngine {
* @return boolean success * @return boolean success
*/ */
public function clearGroup($group) { public function clearGroup($group) {
$this->_File = null;
$directoryIterator = new RecursiveDirectoryIterator($this->settings['path']); $directoryIterator = new RecursiveDirectoryIterator($this->settings['path']);
$contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST); $contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($contents as $object) { foreach ($contents as $object) {
@ -403,7 +414,6 @@ class FileEngine extends CacheEngine {
unlink($object->getPathName()); unlink($object->getPathName());
} }
} }
$this->_File = null;
return true; return true;
} }
} }

View file

@ -66,6 +66,9 @@ class BakeShell extends AppShell {
$this->{$task}->connection = $this->params['connection']; $this->{$task}->connection = $this->params['connection'];
} }
} }
if (isset($this->params['connection'])) {
$this->connection = $this->params['connection'];
}
} }
/** /**

View file

@ -129,8 +129,8 @@ class ServerShell extends AppShell {
$command = sprintf("php -S %s:%d -t %s %s", $command = sprintf("php -S %s:%d -t %s %s",
$this->_host, $this->_host,
$this->_port, $this->_port,
$this->_documentRoot, escapeshellarg($this->_documentRoot),
$this->_documentRoot . '/index.php' escapeshellarg($this->_documentRoot . '/index.php')
); );
$port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port; $port = ($this->_port == self::DEFAULT_PORT) ? '' : ':' . $this->_port;

View file

@ -122,8 +122,10 @@ class ShellDispatcher {
define('ROOT', $this->params['root']); define('ROOT', $this->params['root']);
define('APP_DIR', $this->params['app']); define('APP_DIR', $this->params['app']);
define('APP', $this->params['working'] . DS); define('APP', $this->params['working'] . DS);
define('WWW_ROOT', APP . $this->params['webroot'] . DS); if (!defined('WWW_ROOT')) {
if (!is_dir(ROOT . DS . APP_DIR . DS . 'tmp') && !defined('TMP')) { define('WWW_ROOT', APP . $this->params['webroot'] . DS);
}
if (!defined('TMP') && !is_dir(APP . 'tmp')) {
define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'tmp' . DS); define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'tmp' . DS);
} }
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'Config' . DS . 'bootstrap.php'); $boot = file_exists(ROOT . DS . APP_DIR . DS . 'Config' . DS . 'bootstrap.php');

View file

@ -198,7 +198,7 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
<ul> <ul>
<li><a href="http://cakefoundation.org/"><?php echo __d('cake_dev', 'Cake Software Foundation'); ?> </a> <li><a href="http://cakefoundation.org/"><?php echo __d('cake_dev', 'Cake Software Foundation'); ?> </a>
<ul><li><?php echo __d('cake_dev', 'Promoting development related to CakePHP'); ?></li></ul></li> <ul><li><?php echo __d('cake_dev', 'Promoting development related to CakePHP'); ?></li></ul></li>
<li><a href="http://www.cakephp.org"><?php echo __d('cake_dev', 'CakePHP'); ?> </a> <li><a href="http://www.cakephp.org">CakePHP</a>
<ul><li><?php echo __d('cake_dev', 'The Rapid Development Framework'); ?></li></ul></li> <ul><li><?php echo __d('cake_dev', 'The Rapid Development Framework'); ?></li></ul></li>
<li><a href="http://book.cakephp.org"><?php echo __d('cake_dev', 'CakePHP Documentation'); ?> </a> <li><a href="http://book.cakephp.org"><?php echo __d('cake_dev', 'CakePHP Documentation'); ?> </a>
<ul><li><?php echo __d('cake_dev', 'Your Rapid Development Cookbook'); ?></li></ul></li> <ul><li><?php echo __d('cake_dev', 'Your Rapid Development Cookbook'); ?></li></ul></li>

View file

@ -421,7 +421,7 @@ class CookieComponent extends Component {
'httpOnly' => $this->httpOnly 'httpOnly' => $this->httpOnly
)); ));
if (!is_null($this->_reset)) { if (!empty($this->_reset)) {
$this->_expires = $this->_reset; $this->_expires = $this->_reset;
$this->_reset = null; $this->_reset = null;
} }

View file

@ -85,7 +85,7 @@ class AclNode extends Model {
'joins' => array(array( 'joins' => array(array(
'table' => $table, 'table' => $table,
'alias' => "{$type}0", 'alias' => "{$type}0",
'type' => 'LEFT', 'type' => 'INNER',
'conditions' => array("{$type}0.alias" => $start) 'conditions' => array("{$type}0.alias" => $start)
)), )),
'order' => $db->name("{$type}.lft") . ' DESC' 'order' => $db->name("{$type}.lft") . ' DESC'
@ -97,7 +97,7 @@ class AclNode extends Model {
$queryData['joins'][] = array( $queryData['joins'][] = array(
'table' => $table, 'table' => $table,
'alias' => "{$type}{$i}", 'alias' => "{$type}{$i}",
'type' => 'LEFT', 'type' => 'INNER',
'conditions' => array( 'conditions' => array(
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"), $db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"), $db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),

View file

@ -0,0 +1,51 @@
<?php
/**
* AllDbRelatedTest file
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package Cake.Test.Case
* @since CakePHP(tm) v 2.3
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* AllDbRelatedTest class
*
* This test group will run db related tests.
*
* @package Cake.Test.Case
*/
class AllDbRelatedTest extends PHPUnit_Framework_TestSuite {
/**
* Suite define the tests for this suite
*
* @return void
*/
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('All Db Related Tests');
$path = CORE_TEST_CASES . DS;
$suite->addTestFile($path . 'AllBehaviorsTest.php');
$suite->addTestFile($path . 'Controller' . DS . 'Component' . DS . 'PaginatorComponentTest.php');
$suite->addTestFile($path . 'AllDatabaseTest.php');
$suite->addTestFile($path . 'Model' . DS . 'ModelTest.php');
$suite->addTestFile($path . 'View' . DS . 'ViewTest.php');
$suite->addTestFile($path . 'View' . DS . 'ScaffoldViewTest.php');
$suite->addTestFile($path . 'View' . DS . 'HelperTest.php');
$suite->addTestFile($path . 'View' . DS . 'Helper' . DS . 'FormHelperTest.php');
$suite->addTestFile($path . 'View' . DS . 'Helper' . DS . 'PaginatorHelperTest.php');
return $suite;
}
}

View file

@ -400,7 +400,7 @@ class FileEngineTest extends CakeTestCase {
Cache::config('mask_test', array('engine' => 'File', 'path' => TMP . 'tests')); Cache::config('mask_test', array('engine' => 'File', 'path' => TMP . 'tests'));
$data = 'This is some test content'; $data = 'This is some test content';
$write = Cache::write('masking_test', $data, 'mask_test'); $write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4); $result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0664'; $expected = '0664';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test'); Cache::delete('masking_test', 'mask_test');
@ -408,7 +408,7 @@ class FileEngineTest extends CakeTestCase {
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests')); Cache::config('mask_test', array('engine' => 'File', 'mask' => 0666, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test'); $write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4); $result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0666'; $expected = '0666';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test'); Cache::delete('masking_test', 'mask_test');
@ -416,7 +416,7 @@ class FileEngineTest extends CakeTestCase {
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests')); Cache::config('mask_test', array('engine' => 'File', 'mask' => 0644, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test'); $write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4); $result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0644'; $expected = '0644';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test'); Cache::delete('masking_test', 'mask_test');
@ -424,7 +424,7 @@ class FileEngineTest extends CakeTestCase {
Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests')); Cache::config('mask_test', array('engine' => 'File', 'mask' => 0640, 'path' => TMP . 'tests'));
$write = Cache::write('masking_test', $data, 'mask_test'); $write = Cache::write('masking_test', $data, 'mask_test');
$result = substr(sprintf('%o',fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4); $result = substr(sprintf('%o', fileperms(TMP . 'tests' . DS . 'cake_masking_test')), -4);
$expected = '0640'; $expected = '0640';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
Cache::delete('masking_test', 'mask_test'); Cache::delete('masking_test', 'mask_test');

View file

@ -44,7 +44,7 @@ class ApiShellTest extends CakeTestCase {
$this->Shell = $this->getMock( $this->Shell = $this->getMock(
'ApiShell', 'ApiShell',
array('in', 'out', 'createFile', 'hr', '_stop'), array('in', 'out', 'createFile', 'hr', '_stop'),
array( $out, $out, $in) array($out, $out, $in)
); );
} }

View file

@ -203,6 +203,24 @@ class CookieComponentTest extends CakeTestCase {
$this->assertEquals('value', $result); $this->assertEquals('value', $result);
} }
/**
* test that two write() calls use the expiry.
*
* @return void
*/
public function testWriteMultipleShareExpiry() {
$this->Cookie->write('key1', 'value1', false);
$this->Cookie->write('key2', 'value2', false);
$name = $this->Cookie->name . '[key1]';
$result = $this->Controller->response->cookie($name);
$this->assertWithinMargin(time() + 10, $result['expire'], 2, 'Expiry time is wrong');
$name = $this->Cookie->name . '[key2]';
$result = $this->Controller->response->cookie($name);
$this->assertWithinMargin(time() + 10, $result['expire'], 2, 'Expiry time is wrong');
}
/** /**
* test write with distant future cookies * test write with distant future cookies
* *

View file

@ -600,7 +600,7 @@ class ObjectTest extends CakeTestCase {
$this->assertEquals(null, $result['plugin']); $this->assertEquals(null, $result['plugin']);
$result = $this->object->requestAction('/request_action/params_pass/sort:desc/limit:5'); $result = $this->object->requestAction('/request_action/params_pass/sort:desc/limit:5');
$expected = array('sort' => 'desc', 'limit' => 5,); $expected = array('sort' => 'desc', 'limit' => 5);
$this->assertEquals($expected, $result['named']); $this->assertEquals($expected, $result['named']);
$result = $this->object->requestAction( $result = $this->object->requestAction(

View file

@ -528,7 +528,7 @@ class ExceptionRendererTest extends CakeTestCase {
404 404
), ),
array( array(
new PrivateActionException(array('controller' => 'PostsController' , 'action' => '_secretSauce')), new PrivateActionException(array('controller' => 'PostsController', 'action' => '_secretSauce')),
array( array(
'/<h2>Private Method in PostsController<\/h2>/', '/<h2>Private Method in PostsController<\/h2>/',
'/<em>PostsController::<\/em><em>_secretSauce\(\)<\/em>/' '/<em>PostsController::<\/em><em>_secretSauce\(\)<\/em>/'

View file

@ -2407,7 +2407,7 @@ class MysqlTest extends CakeTestCase {
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
$result = $this->Dbo->conditions(array( $result = $this->Dbo->conditions(array(
'NOT' => array('Course.id' => null, 'Course.vet' => 'N', 'level_of_education_id' => array(912,999)), 'NOT' => array('Course.id' => null, 'Course.vet' => 'N', 'level_of_education_id' => array(912, 999)),
'Enrollment.yearcompleted >' => '0') 'Enrollment.yearcompleted >' => '0')
); );
$this->assertRegExp('/^\s*WHERE\s+\(NOT\s+\(`Course`\.`id` IS NULL\)\s+AND NOT\s+\(`Course`\.`vet`\s+=\s+\'N\'\)\s+AND NOT\s+\(`level_of_education_id` IN \(912, 999\)\)\)\s+AND\s+`Enrollment`\.`yearcompleted`\s+>\s+\'0\'\s*$/', $result); $this->assertRegExp('/^\s*WHERE\s+\(NOT\s+\(`Course`\.`id` IS NULL\)\s+AND NOT\s+\(`Course`\.`vet`\s+=\s+\'N\'\)\s+AND NOT\s+\(`level_of_education_id` IN \(912, 999\)\)\)\s+AND\s+`Enrollment`\.`yearcompleted`\s+>\s+\'0\'\s*$/', $result);
@ -3267,7 +3267,7 @@ class MysqlTest extends CakeTestCase {
$expected = '(1 + 1) = 2'; $expected = '(1 + 1) = 2';
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
$conditions = array('this_moment BETWEEN ? AND ?' => array(1,2)); $conditions = array('this_moment BETWEEN ? AND ?' => array(1, 2));
$expected = 'NOW() BETWEEN 1 AND 2'; $expected = 'NOW() BETWEEN 1 AND 2';
$result = $this->Dbo->conditions($conditions, true, false, $Article); $result = $this->Dbo->conditions($conditions, true, false, $Article);
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);

View file

@ -836,16 +836,16 @@ class ModelIntegrationTest extends BaseModelTest {
$this->assertEquals('test_database_three', $Player->ArmorsPlayer->useDbConfig); $this->assertEquals('test_database_three', $Player->ArmorsPlayer->useDbConfig);
$players = $Player->find('all'); $players = $Player->find('all');
$this->assertEquals(4 , count($players)); $this->assertEquals(4, count($players));
$playersGuilds = Hash::extract($players, '{n}.Guild.{n}.GuildsPlayer'); $playersGuilds = Hash::extract($players, '{n}.Guild.{n}.GuildsPlayer');
$this->assertEquals(3 , count($playersGuilds)); $this->assertEquals(3, count($playersGuilds));
$playersArmors = Hash::extract($players, '{n}.Armor.{n}.ArmorsPlayer'); $playersArmors = Hash::extract($players, '{n}.Armor.{n}.ArmorsPlayer');
$this->assertEquals(3 , count($playersArmors)); $this->assertEquals(3, count($playersArmors));
unset($players); unset($players);
$larry = $Player->findByName('larry'); $larry = $Player->findByName('larry');
$larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer'); $larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer');
$this->assertEquals(1 , count($larrysArmor)); $this->assertEquals(1, count($larrysArmor));
$larry['Guild']['Guild'] = array(1, 3); // larry joins another guild $larry['Guild']['Guild'] = array(1, 3); // larry joins another guild
$larry['Armor']['Armor'] = array(2, 3); // purchases chainmail $larry['Armor']['Armor'] = array(2, 3); // purchases chainmail
@ -854,9 +854,9 @@ class ModelIntegrationTest extends BaseModelTest {
$larry = $Player->findByName('larry'); $larry = $Player->findByName('larry');
$larrysGuild = Hash::extract($larry, 'Guild.{n}.GuildsPlayer'); $larrysGuild = Hash::extract($larry, 'Guild.{n}.GuildsPlayer');
$this->assertEquals(2 , count($larrysGuild)); $this->assertEquals(2, count($larrysGuild));
$larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer'); $larrysArmor = Hash::extract($larry, 'Armor.{n}.ArmorsPlayer');
$this->assertEquals(2 , count($larrysArmor)); $this->assertEquals(2, count($larrysArmor));
$Player->ArmorsPlayer->id = 3; $Player->ArmorsPlayer->id = 3;
$Player->ArmorsPlayer->saveField('broken', true); // larry's cloak broke $Player->ArmorsPlayer->saveField('broken', true); // larry's cloak broke

View file

@ -4963,7 +4963,7 @@ class ModelWriteTest extends BaseModelTest {
$expected = array( $expected = array(
'Comment' => array( 'Comment' => array(
array( array(
'comment' => array( 'This field cannot be left blank' ) 'comment' => array('This field cannot be left blank')
) )
) )
); );

View file

@ -1800,7 +1800,7 @@ class CakeEmailTest extends CakeTestCase {
$email->to('someone@example.com')->from('someone@example.com'); $email->to('someone@example.com')->from('someone@example.com');
$result = $email->send('ってテーブルを作ってやってたらう'); $result = $email->send('ってテーブルを作ってやってたらう');
$this->assertContains('Content-Type: text/plain; charset=ISO-2022-JP', $result['headers']); $this->assertContains('Content-Type: text/plain; charset=ISO-2022-JP', $result['headers']);
$this->assertContains(mb_convert_encoding('ってテーブルを作ってやってたらう','ISO-2022-JP'), $result['message']); $this->assertContains(mb_convert_encoding('ってテーブルを作ってやってたらう', 'ISO-2022-JP'), $result['message']);
} }
/** /**
@ -1824,7 +1824,7 @@ class CakeEmailTest extends CakeTestCase {
$result = $email->send('①㈱'); $result = $email->send('①㈱');
$this->assertTextContains("Content-Type: text/plain; charset=ISO-2022-JP", $result['headers']); $this->assertTextContains("Content-Type: text/plain; charset=ISO-2022-JP", $result['headers']);
$this->assertTextNotContains("Content-Type: text/plain; charset=ISO-2022-JP-MS", $result['headers']); // not charset=iso-2022-jp-ms $this->assertTextNotContains("Content-Type: text/plain; charset=ISO-2022-JP-MS", $result['headers']); // not charset=iso-2022-jp-ms
$this->assertTextNotContains(mb_convert_encoding('①㈱','ISO-2022-JP-MS'), $result['message']); $this->assertTextNotContains(mb_convert_encoding('①㈱', 'ISO-2022-JP-MS'), $result['message']);
} }
/** /**
@ -1848,7 +1848,7 @@ class CakeEmailTest extends CakeTestCase {
$result = $email->send('①㈱'); $result = $email->send('①㈱');
$this->assertTextContains("Content-Type: text/plain; charset=ISO-2022-JP", $result['headers']); $this->assertTextContains("Content-Type: text/plain; charset=ISO-2022-JP", $result['headers']);
$this->assertTextNotContains("Content-Type: text/plain; charset=iso-2022-jp-ms", $result['headers']); // not charset=iso-2022-jp-ms $this->assertTextNotContains("Content-Type: text/plain; charset=iso-2022-jp-ms", $result['headers']); // not charset=iso-2022-jp-ms
$this->assertContains(mb_convert_encoding('①㈱','ISO-2022-JP-MS'), $result['message']); $this->assertContains(mb_convert_encoding('①㈱', 'ISO-2022-JP-MS'), $result['message']);
} }
protected function _checkContentTransferEncoding($message, $charset) { protected function _checkContentTransferEncoding($message, $charset) {

View file

@ -1547,8 +1547,8 @@ class HttpSocketTest extends CakeTestCase {
'name' => 'jim', 'name' => 'jim',
'items' => array( 'items' => array(
'personal' => array( 'personal' => array(
'book' 'book',
, 'pen' 'pen'
), ),
'ball' 'ball'
) )
@ -1635,10 +1635,10 @@ class HttpSocketTest extends CakeTestCase {
$this->Socket->reset(); $this->Socket->reset();
$expected = array( $expected = array(
'\x22','\x28','\x29','\x3c','\x3e','\x40','\x2c','\x3b','\x3a','\x5c','\x2f','\x5b','\x5d','\x3f','\x3d','\x7b', '\x22', '\x28', '\x29', '\x3c', '\x3e', '\x40', '\x2c', '\x3b', '\x3a', '\x5c', '\x2f', '\x5b', '\x5d', '\x3f', '\x3d', '\x7b',
'\x7d','\x20','\x00','\x01','\x02','\x03','\x04','\x05','\x06','\x07','\x08','\x09','\x0a','\x0b','\x0c','\x0d', '\x7d', '\x20', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d',
'\x0e','\x0f','\x10','\x11','\x12','\x13','\x14','\x15','\x16','\x17','\x18','\x19','\x1a','\x1b','\x1c','\x1d', '\x0e', '\x0f', '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d',
'\x1e','\x1f','\x7f' '\x1e', '\x1f', '\x7f'
); );
$r = $this->Socket->tokenEscapeChars(); $r = $this->Socket->tokenEscapeChars();
$this->assertEquals($expected, $r); $this->assertEquals($expected, $r);

View file

@ -923,7 +923,7 @@ class CakeRouteTest extends CakeTestCase {
public function testUTF8PatternOnSection() { public function testUTF8PatternOnSection() {
$route = new CakeRoute( $route = new CakeRoute(
'/:section', '/:section',
array('plugin' => 'blogs', 'controller' => 'posts' , 'action' => 'index' ), array('plugin' => 'blogs', 'controller' => 'posts', 'action' => 'index'),
array( array(
'persist' => array('section'), 'persist' => array('section'),
'section' => 'آموزش|weblog' 'section' => 'آموزش|weblog'

View file

@ -957,7 +957,7 @@ class RouterTest extends CakeTestCase {
public function testUrlParsing() { public function testUrlParsing() {
extract(Router::getNamedExpressions()); extract(Router::getNamedExpressions());
Router::connect('/posts/:value/:somevalue/:othervalue/*', array('controller' => 'posts', 'action' => 'view'), array('value','somevalue', 'othervalue')); Router::connect('/posts/:value/:somevalue/:othervalue/*', array('controller' => 'posts', 'action' => 'view'), array('value', 'somevalue', 'othervalue'));
$result = Router::parse('/posts/2007/08/01/title-of-post-here'); $result = Router::parse('/posts/2007/08/01/title-of-post-here');
$expected = array('value' => '2007', 'somevalue' => '08', 'othervalue' => '01', 'controller' => 'posts', 'action' => 'view', 'plugin' => '', 'pass' => array('0' => 'title-of-post-here'), 'named' => array()); $expected = array('value' => '2007', 'somevalue' => '08', 'othervalue' => '01', 'controller' => 'posts', 'action' => 'view', 'plugin' => '', 'pass' => array('0' => 'title-of-post-here'), 'named' => array());
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);

View file

@ -408,6 +408,11 @@ TEXT;
false false
TEXT; TEXT;
$this->assertTextEquals($expected, $result); $this->assertTextEquals($expected, $result);
$file = fopen('php://output', 'w');
fclose($file);
$result = Debugger::exportVar($file);
$this->assertTextEquals('unknown', $result);
} }
/** /**

View file

@ -256,7 +256,7 @@ class SetTest extends CakeTestCase {
$a = array( $a = array(
0 => array('Person' => array('name' => 'Jeff'), 'Friend' => array(array('name' => 'Nate'))), 0 => array('Person' => array('name' => 'Jeff'), 'Friend' => array(array('name' => 'Nate'))),
1 => array('Person' => array('name' => 'Tracy'),'Friend' => array(array('name' => 'Lindsay'))), 1 => array('Person' => array('name' => 'Tracy'), 'Friend' => array(array('name' => 'Lindsay'))),
2 => array('Person' => array('name' => 'Adam'), 'Friend' => array(array('name' => 'Bob'))) 2 => array('Person' => array('name' => 'Adam'), 'Friend' => array(array('name' => 'Bob')))
); );
$b = array( $b = array(
@ -268,15 +268,15 @@ class SetTest extends CakeTestCase {
$this->assertEquals($a, $b); $this->assertEquals($a, $b);
$a = array( $a = array(
array(7,6,4), array(7, 6, 4),
array(3,4,5), array(3, 4, 5),
array(3,2,1), array(3, 2, 1),
); );
$b = array( $b = array(
array(3,2,1), array(3, 2, 1),
array(3,4,5), array(3, 4, 5),
array(7,6,4), array(7, 6, 4),
); );
$a = Set::sort($a, '{n}.{n}', 'asc'); $a = Set::sort($a, '{n}.{n}', 'asc');
@ -884,7 +884,7 @@ class SetTest extends CakeTestCase {
$r = Set::extract('/file/.[type=application/x-zip-compressed]', $f); $r = Set::extract('/file/.[type=application/x-zip-compressed]', $f);
$this->assertEquals($expected, $r); $this->assertEquals($expected, $r);
$expected = array(array('name' => 'zipfile.zip', 'type' => 'application/zip','tmp_name' => '/tmp/php178.tmp', 'error' => 0, 'size' => '564647')); $expected = array(array('name' => 'zipfile.zip', 'type' => 'application/zip', 'tmp_name' => '/tmp/php178.tmp', 'error' => 0, 'size' => '564647'));
$r = Set::extract('/file/.[type=application/zip]', $f); $r = Set::extract('/file/.[type=application/zip]', $f);
$this->assertEquals($expected, $r); $this->assertEquals($expected, $r);
@ -922,8 +922,8 @@ class SetTest extends CakeTestCase {
$this->assertEquals($expected, $r); $this->assertEquals($expected, $r);
$expected = array( $expected = array(
array('name' => 'zipfile.zip','type' => 'application/zip', 'tmp_name' => '/tmp/php178.tmp', 'error' => 0, 'size' => '564647'), array('name' => 'zipfile.zip', 'type' => 'application/zip', 'tmp_name' => '/tmp/php178.tmp', 'error' => 0, 'size' => '564647'),
array('name' => 'zipfile2.zip','type' => 'application/x zip compressed', 'tmp_name' => '/tmp/php179.tmp', 'error' => 0, 'size' => '354784') array('name' => 'zipfile2.zip', 'type' => 'application/x zip compressed', 'tmp_name' => '/tmp/php179.tmp', 'error' => 0, 'size' => '354784')
); );
$r = Set::extract('/file/.[tmp_name=/tmp\/php17/]', $f); $r = Set::extract('/file/.[tmp_name=/tmp\/php17/]', $f);
$this->assertEquals($expected, $r); $this->assertEquals($expected, $r);
@ -1110,7 +1110,7 @@ class SetTest extends CakeTestCase {
) )
); );
$expected = array(7,2,1); $expected = array(7, 2, 1);
$r = Set::extract('/CallType[name=Internal Voice]/../x/hour', $multiple); $r = Set::extract('/CallType[name=Internal Voice]/../x/hour', $multiple);
$this->assertEquals($expected, $r); $this->assertEquals($expected, $r);
@ -1856,7 +1856,7 @@ class SetTest extends CakeTestCase {
$a = array( $a = array(
array('User' => array('id' => 2, 'group_id' => 1, array('User' => array('id' => 2, 'group_id' => 1,
'Data' => array('user' => 'mariano.iglesias','name' => 'Mariano Iglesias'))), 'Data' => array('user' => 'mariano.iglesias', 'name' => 'Mariano Iglesias'))),
array('User' => array('id' => 14, 'group_id' => 2, array('User' => array('id' => 14, 'group_id' => 2,
'Data' => array('user' => 'phpnut', 'name' => 'Larry E. Masters'))), 'Data' => array('user' => 'phpnut', 'name' => 'Larry E. Masters'))),
array('User' => array('id' => 25, 'group_id' => 1, array('User' => array('id' => 25, 'group_id' => 1,
@ -2470,8 +2470,8 @@ class SetTest extends CakeTestCase {
array( array(
'Post' => array('id' => '1', 'author_id' => '1', 'title' => 'First Post', 'body' => 'First Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'), 'Post' => array('id' => '1', 'author_id' => '1', 'title' => 'First Post', 'body' => 'First Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:39:23', 'updated' => '2007-03-18 10:41:31'),
'Author' => array('id' => '1', 'user' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31', 'test' => 'working'), 'Author' => array('id' => '1', 'user' => 'mariano', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:16:23', 'updated' => '2007-03-17 01:18:31', 'test' => 'working'),
) ),
, array( array(
'Post' => array('id' => '2', 'author_id' => '3', 'title' => 'Second Post', 'body' => 'Second Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'), 'Post' => array('id' => '2', 'author_id' => '3', 'title' => 'Second Post', 'body' => 'Second Post Body', 'published' => 'Y', 'created' => '2007-03-18 10:41:23', 'updated' => '2007-03-18 10:43:31'),
'Author' => array('id' => '3', 'user' => 'larry', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:20:23', 'updated' => '2007-03-17 01:22:31', 'test' => 'working'), 'Author' => array('id' => '3', 'user' => 'larry', 'password' => '5f4dcc3b5aa765d61d8327deb882cf99', 'created' => '2007-03-17 01:20:23', 'updated' => '2007-03-17 01:22:31', 'test' => 'working'),
) )

View file

@ -180,7 +180,7 @@ class StringTest extends CakeTestCase {
$expected = "this is a long string with a few? params you know"; $expected = "this is a long string with a few? params you know";
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
$result = String::insert('update saved_urls set url = :url where id = :id', array('url' => 'http://www.testurl.com/param1:url/param2:id','id' => 1)); $result = String::insert('update saved_urls set url = :url where id = :id', array('url' => 'http://www.testurl.com/param1:url/param2:id', 'id' => 1));
$expected = "update saved_urls set url = http://www.testurl.com/param1:url/param2:id where id = 1"; $expected = "update saved_urls set url = http://www.testurl.com/param1:url/param2:id where id = 1";
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
@ -330,14 +330,12 @@ TEXT;
$this->assertTextEquals($expected, $result, 'Text not wrapped.'); $this->assertTextEquals($expected, $result, 'Text not wrapped.');
$result = String::wrap($text, array('width' => 20, 'wordWrap' => false)); $result = String::wrap($text, array('width' => 20, 'wordWrap' => false));
$expected = <<<TEXT $expected = 'This is the song th' . "\n" .
This is the song th 'at never ends. This' . "\n" .
at never ends. This ' is the song that n' . "\n" .
is the song that n 'ever ends. This is ' . "\n" .
ever ends. This is 'the song that never' . "\n" .
the song that never ' ends.';
ends.
TEXT;
$this->assertTextEquals($expected, $result, 'Text not wrapped.'); $this->assertTextEquals($expected, $result, 'Text not wrapped.');
} }

View file

@ -1388,7 +1388,7 @@ class FormHelperTest extends CakeTestCase {
$this->Form->input('Addresses.first_name', array('secure' => false)); $this->Form->input('Addresses.first_name', array('secure' => false));
$this->Form->input('Addresses.city', array('type' => 'textarea', 'secure' => false)); $this->Form->input('Addresses.city', array('type' => 'textarea', 'secure' => false));
$this->Form->input('Addresses.zip', array( $this->Form->input('Addresses.zip', array(
'type' => 'select', 'options' => array(1,2), 'secure' => false 'type' => 'select', 'options' => array(1, 2), 'secure' => false
)); ));
$result = $this->Form->fields; $result = $this->Form->fields;
@ -1719,7 +1719,7 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add')); $result = $this->Form->create('ValidateUser', array('type' => 'post', 'action' => 'add'));
$encoding = strtolower(Configure::read('App.encoding')); $encoding = strtolower(Configure::read('App.encoding'));
$expected = array( $expected = array(
'form' => array('method' => 'post', 'action' => '/validate_users/add', 'id','accept-charset' => $encoding), 'form' => array('method' => 'post', 'action' => '/validate_users/add', 'id', 'accept-charset' => $encoding),
'div' => array('style' => 'display:none;'), 'div' => array('style' => 'display:none;'),
'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'), 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
'/div' '/div'
@ -2267,8 +2267,8 @@ class FormHelperTest extends CakeTestCase {
$this->assertRegExp('#<option value="15"[^>]*>15</option>#', $result[1]); $this->assertRegExp('#<option value="15"[^>]*>15</option>#', $result[1]);
$result = $this->Form->input('prueba', array( $result = $this->Form->input('prueba', array(
'type' => 'time', 'timeFormat' => 24 , 'dateFormat' => 'DMY' , 'minYear' => 2008, 'type' => 'time', 'timeFormat' => 24, 'dateFormat' => 'DMY', 'minYear' => 2008,
'maxYear' => date('Y') + 1 , 'interval' => 15 'maxYear' => date('Y') + 1, 'interval' => 15
)); ));
$result = explode(':', $result); $result = explode(':', $result);
$this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]); $this->assertNotRegExp('#<option value="12"[^>]*>12</option>#', $result[1]);

View file

@ -873,7 +873,7 @@ class JsBaseEngineTest extends CakeTestCase {
$object = new JsEncodingObject(); $object = new JsEncodingObject();
$object->title = 'New thing'; $object->title = 'New thing';
$object->indexes = array(5,6,7,8); $object->indexes = array(5, 6, 7, 8);
$result = $this->JsEngine->object($object); $result = $this->JsEngine->object($object);
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);

View file

@ -266,7 +266,7 @@ class MootoolsEngineHelperTest extends CakeTestCase {
'start' => 'onStart', 'start' => 'onStart',
'drag' => 'onDrag', 'drag' => 'onDrag',
'stop' => 'onStop', 'stop' => 'onStop',
'snapGrid' => array(10,10), 'snapGrid' => array(10, 10),
'wrapCallbacks' => false 'wrapCallbacks' => false
)); ));
$expected = '$("drag-me").makeDraggable({onComplete:onStop, onDrag:onDrag, onStart:onStart, snap:[10,10]});'; $expected = '$("drag-me").makeDraggable({onComplete:onStop, onDrag:onDrag, onStart:onStart, snap:[10,10]});';

View file

@ -290,7 +290,7 @@ class PaginatorHelperTest extends CakeTestCase {
Router::setRequestInfo(array( Router::setRequestInfo(array(
array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(), array('plugin' => null, 'controller' => 'accounts', 'action' => 'index', 'pass' => array(),
'url' => array('url' => 'accounts/', 'mod_rewrite' => 'true')), 'url' => array('url' => 'accounts/', 'mod_rewrite' => 'true')),
array('base' => '/', 'here' => '/accounts/', 'webroot' => '/',) array('base' => '/', 'here' => '/accounts/', 'webroot' => '/')
)); ));
$this->Paginator->options(array('url' => array('param'))); $this->Paginator->options(array('url' => array('param')));

View file

@ -47,13 +47,13 @@ class AcoTwoFixture extends CakeTestFixture {
*/ */
public $records = array( public $records = array(
array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 20), array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 20),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports','lft' => 2, 'rght' => 9), array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'tpsReports', 'lft' => 2, 'rght' => 9),
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 3, 'rght' => 6), array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 3, 'rght' => 6),
array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'current', 'lft' => 4, 'rght' => 5), array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'current', 'lft' => 4, 'rght' => 5),
array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'update', 'lft' => 7, 'rght' => 8), array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'update', 'lft' => 7, 'rght' => 8),
array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'printers', 'lft' => 10, 'rght' => 19), array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'printers', 'lft' => 10, 'rght' => 19),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'print', 'lft' => 11, 'rght' => 14), array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'print', 'lft' => 11, 'rght' => 14),
array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'lettersize','lft' => 12, 'rght' => 13), array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'lettersize', 'lft' => 12, 'rght' => 13),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'refill', 'lft' => 15, 'rght' => 16), array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'refill', 'lft' => 15, 'rght' => 16),
array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'smash', 'lft' => 17, 'rght' => 18), array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'smash', 'lft' => 17, 'rght' => 18),
); );

View file

@ -51,8 +51,8 @@ class AroTwoFixture extends CakeTestFixture {
array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '2', 'alias' => 'managers', 'lft' => '6', 'rght' => '9'), array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '2', 'alias' => 'managers', 'lft' => '6', 'rght' => '9'),
array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '3', 'alias' => 'users', 'lft' => '10', 'rght' => '19'), array('parent_id' => 1, 'model' => 'Group', 'foreign_key' => '3', 'alias' => 'users', 'lft' => '10', 'rght' => '19'),
array('parent_id' => 2, 'model' => 'User', 'foreign_key' => '1', 'alias' => 'Bobs', 'lft' => '3', 'rght' => '4'), array('parent_id' => 2, 'model' => 'User', 'foreign_key' => '1', 'alias' => 'Bobs', 'lft' => '3', 'rght' => '4'),
array('parent_id' => 3, 'model' => 'User', 'foreign_key' => '2', 'alias' => 'Lumbergh', 'lft' => '7' , 'rght' => '8'), array('parent_id' => 3, 'model' => 'User', 'foreign_key' => '2', 'alias' => 'Lumbergh', 'lft' => '7', 'rght' => '8'),
array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '3', 'alias' => 'Samir', 'lft' => '11' , 'rght' => '12'), array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '3', 'alias' => 'Samir', 'lft' => '11', 'rght' => '12'),
array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '4', 'alias' => 'Micheal', 'lft' => '13', 'rght' => '14'), array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '4', 'alias' => 'Micheal', 'lft' => '13', 'rght' => '14'),
array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '5', 'alias' => 'Peter', 'lft' => '15', 'rght' => '16'), array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '5', 'alias' => 'Peter', 'lft' => '15', 'rght' => '16'),
array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '6', 'alias' => 'Milton', 'lft' => '17', 'rght' => '18'), array('parent_id' => 4, 'model' => 'User', 'foreign_key' => '6', 'alias' => 'Milton', 'lft' => '17', 'rght' => '18'),

View file

@ -35,11 +35,11 @@ class FlagTreeFixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $fields = array( public $fields = array(
'id' => array('type' => 'integer','key' => 'primary'), 'id' => array('type' => 'integer', 'key' => 'primary'),
'name' => array('type' => 'string','null' => false), 'name' => array('type' => 'string', 'null' => false),
'parent_id' => 'integer', 'parent_id' => 'integer',
'lft' => array('type' => 'integer','null' => false), 'lft' => array('type' => 'integer', 'null' => false),
'rght' => array('type' => 'integer','null' => false), 'rght' => array('type' => 'integer', 'null' => false),
'flag' => array('type' => 'integer','null' => false, 'length' => 1, 'default' => 0) 'flag' => array('type' => 'integer', 'null' => false, 'length' => 1, 'default' => 0)
); );
} }

View file

@ -35,10 +35,10 @@ class NumberTreeFixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $fields = array( public $fields = array(
'id' => array('type' => 'integer','key' => 'primary'), 'id' => array('type' => 'integer', 'key' => 'primary'),
'name' => array('type' => 'string','null' => false), 'name' => array('type' => 'string', 'null' => false),
'parent_id' => 'integer', 'parent_id' => 'integer',
'lft' => array('type' => 'integer','null' => false), 'lft' => array('type' => 'integer', 'null' => false),
'rght' => array('type' => 'integer','null' => false) 'rght' => array('type' => 'integer', 'null' => false)
); );
} }

View file

@ -35,11 +35,11 @@ class NumberTreeTwoFixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $fields = array( public $fields = array(
'id' => array('type' => 'integer','key' => 'primary'), 'id' => array('type' => 'integer', 'key' => 'primary'),
'name' => array('type' => 'string','null' => false), 'name' => array('type' => 'string', 'null' => false),
'number_tree_id' => array('type' => 'integer', 'null' => false), 'number_tree_id' => array('type' => 'integer', 'null' => false),
'parent_id' => 'integer', 'parent_id' => 'integer',
'lft' => array('type' => 'integer','null' => false), 'lft' => array('type' => 'integer', 'null' => false),
'rght' => array('type' => 'integer','null' => false) 'rght' => array('type' => 'integer', 'null' => false)
); );
} }

View file

@ -34,10 +34,10 @@ class UnconventionalTreeFixture extends CakeTestFixture {
* @var array * @var array
*/ */
public $fields = array( public $fields = array(
'id' => array('type' => 'integer','key' => 'primary'), 'id' => array('type' => 'integer', 'key' => 'primary'),
'name' => array('type' => 'string','null' => false), 'name' => array('type' => 'string', 'null' => false),
'join' => 'integer', 'join' => 'integer',
'left' => array('type' => 'integer','null' => false), 'left' => array('type' => 'integer', 'null' => false),
'right' => array('type' => 'integer','null' => false), 'right' => array('type' => 'integer', 'null' => false),
); );
} }

View file

@ -76,7 +76,7 @@ class CakeNumber {
*/ */
protected static $_currencyDefaults = array( protected static $_currencyDefaults = array(
'wholeSymbol' => '', 'wholePosition' => 'before', 'fractionSymbol' => '', 'fractionPosition' => 'after', 'wholeSymbol' => '', 'wholePosition' => 'before', 'fractionSymbol' => '', 'fractionPosition' => 'after',
'zero' => '0', 'places' => 2, 'thousands' => ',', 'decimals' => '.','negative' => '()', 'escape' => true, 'zero' => '0', 'places' => 2, 'thousands' => ',', 'decimals' => '.', 'negative' => '()', 'escape' => true,
'fractionExponent' => 2 'fractionExponent' => 2
); );
@ -348,7 +348,7 @@ class CakeNumber {
$symbolKey = 'whole'; $symbolKey = 'whole';
$value = (float)$value; $value = (float)$value;
if (!$value) { if (!$value) {
if ($options['zero'] !== 0 ) { if ($options['zero'] !== 0) {
return $options['zero']; return $options['zero'];
} }
} elseif ($value < 1 && $value > -1) { } elseif ($value < 1 && $value > -1) {

View file

@ -500,6 +500,8 @@ class Debugger {
return strtolower(gettype($var)); return strtolower(gettype($var));
case 'null': case 'null':
return 'null'; return 'null';
case 'unknown':
return 'unknown';
default: default:
return self::_object($var, $depth - 1, $indent + 1); return self::_object($var, $depth - 1, $indent + 1);
} }
@ -591,24 +593,20 @@ class Debugger {
if (version_compare(PHP_VERSION, '5.3.0') >= 0) { if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
$ref = new ReflectionObject($var); $ref = new ReflectionObject($var);
$reflectionProperties = $ref->getProperties(ReflectionProperty::IS_PROTECTED); $filters = array(
foreach ($reflectionProperties as $reflectionProperty) { ReflectionProperty::IS_PROTECTED => 'protected',
$reflectionProperty->setAccessible(true); ReflectionProperty::IS_PRIVATE => 'private',
$property = $reflectionProperty->getValue($var); );
foreach ($filters as $filter => $visibility) {
$reflectionProperties = $ref->getProperties($filter);
foreach ($reflectionProperties as $reflectionProperty) {
$reflectionProperty->setAccessible(true);
$property = $reflectionProperty->getValue($var);
$value = self::_export($property, $depth - 1, $indent); $value = self::_export($property, $depth - 1, $indent);
$key = $reflectionProperty->name; $key = $reflectionProperty->name;
$props[] = "[protected] $key => " . $value; $props[] = sprintf('[%s] %s => %s', $visibility, $key, $value);
} }
$reflectionProperties = $ref->getProperties(ReflectionProperty::IS_PRIVATE);
foreach ($reflectionProperties as $reflectionProperty) {
$reflectionProperty->setAccessible(true);
$property = $reflectionProperty->getValue($var);
$value = self::_export($property, $depth - 1, $indent);
$key = $reflectionProperty->name;
$props[] = "[private] $key => " . $value;
} }
} }

View file

@ -524,7 +524,7 @@ class String {
} }
} }
$truncate .= mb_substr($tag[3], 0 , $left + $entitiesLength); $truncate .= mb_substr($tag[3], 0, $left + $entitiesLength);
break; break;
} else { } else {
$truncate .= $tag[3]; $truncate .= $tag[3];

View file

@ -58,19 +58,27 @@ if ($noLogs || isset($_forced_from_dbo_)):
} }
foreach ($i['params'] as $bindKey => $bindVal) { foreach ($i['params'] as $bindKey => $bindVal) {
if ($bindType === true) { if ($bindType === true) {
$bindParam .= h($bindKey) ." => " . h($bindVal) . ", "; $bindParam .= h($bindKey) . " => " . h($bindVal) . ", ";
} else { } else {
$bindParam .= h($bindVal) . ", "; $bindParam .= h($bindVal) . ", ";
} }
} }
$i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]"; $i['query'] .= " , params[ " . rtrim($bindParam, ', ') . " ]";
} }
echo "<tr><td>" . ($k + 1) . "</td><td>" . h($i['query']) . "</td><td>{$i['error']}</td><td style = \"text-align: right\">{$i['affected']}</td><td style = \"text-align: right\">{$i['numRows']}</td><td style = \"text-align: right\">{$i['took']}</td></tr>\n"; printf('<tr><td>%d</td><td>%s</td><td>%s</td><td style="text-align: right">%d</td><td style="text-align: right">%d</td><td style="text-align: right">%d</td></tr>%s',
$k + 1,
h($i['query']),
$i['error'],
$i['affected'],
$i['numRows'],
$i['took'],
"\n"
);
endforeach; endforeach;
?> ?>
</tbody></table> </tbody></table>
<?php <?php
endforeach; endforeach;
else: else:
echo '<p>Encountered unexpected $sqlLogs cannot generate SQL log</p>'; printf('<p>%s</p>', __d('cake_dev', 'Encountered unexpected %s. Cannot generate SQL log.', '$sqlLogs'));
endif; endif;

View file

@ -483,7 +483,7 @@ class Helper extends Object {
*/ */
protected function _formatAttribute($key, $value, $escape = true) { protected function _formatAttribute($key, $value, $escape = true) {
if (is_array($value)) { if (is_array($value)) {
$value = implode(' ' , $value); $value = implode(' ', $value);
} }
if (is_numeric($key)) { if (is_numeric($key)) {
return sprintf($this->_minimizedAttributeFormat, $value, $value); return sprintf($this->_minimizedAttributeFormat, $value, $value);