Permalink
Browse files

Merge branch '1.3' of git@thechaw.com:cakephp into 1.3-jshelper

Conflicts:
	cake/libs/view/helpers/html.php
  • Loading branch information...
2 parents e873bb5 + 6cb8b3d commit 4b690237f04e89fa7d7f4dd4a638325ff7f499af @markstory markstory committed Mar 15, 2009
Showing with 2,223 additions and 562 deletions.
  1. +1 −1 app/webroot/css.php
  2. +2 −2 cake/console/libs/shell.php
  3. +3 −0 cake/console/libs/tasks/extract.php
  4. +50 −50 cake/console/libs/tasks/model.php
  5. +15 −15 cake/console/libs/tasks/test.php
  6. +51 −78 cake/dispatcher.php
  7. +0 −4 cake/libs/cache.php
  8. +2 −2 cake/libs/cache/memcache.php
  9. +3 −2 cake/libs/cache/xcache.php
  10. +51 −55 cake/libs/controller/component.php
  11. +13 −13 cake/libs/controller/components/request_handler.php
  12. +7 −5 cake/libs/controller/controller.php
  13. +1 −1 cake/libs/error.php
  14. +4 −0 cake/libs/folder.php
  15. +2 −2 cake/libs/http_socket.php
  16. +11 −11 cake/libs/i18n.php
  17. +2 −1 cake/libs/inflector.php
  18. +0 −1 cake/libs/l10n.php
  19. +22 −6 cake/libs/model/behavior.php
  20. +2 −0 cake/libs/model/behaviors/translate.php
  21. +30 −22 cake/libs/model/behaviors/tree.php
  22. +26 −12 cake/libs/model/datasources/dbo_source.php
  23. +16 −10 cake/libs/model/model.php
  24. +4 −4 cake/libs/model/schema.php
  25. +11 −8 cake/libs/router.php
  26. +16 −12 cake/libs/set.php
  27. +4 −4 cake/libs/string.php
  28. +1 −1 cake/libs/view/helper.php
  29. +37 −29 cake/libs/view/helpers/form.php
  30. +6 −6 cake/libs/view/helpers/html.php
  31. +18 −9 cake/libs/view/helpers/javascript.php
  32. +8 −10 cake/libs/view/helpers/number.php
  33. +10 −19 cake/libs/view/helpers/paginator.php
  34. +1 −1 cake/libs/view/helpers/time.php
  35. +7 −3 cake/libs/view/helpers/xml.php
  36. +20 −7 cake/libs/view/media.php
  37. +3 −0 cake/libs/view/pages/home.ctp
  38. +26 −10 cake/libs/xml.php
  39. +241 −2 cake/tests/cases/basics.test.php
  40. +4 −0 cake/tests/cases/console/cake.test.php
  41. +287 −32 cake/tests/cases/console/libs/shell.test.php
  42. +136 −0 cake/tests/cases/console/libs/tasks/extract.test.php
  43. +100 −0 cake/tests/cases/console/libs/tasks/test.test.php
  44. +167 −11 cake/tests/cases/dispatcher.test.php
  45. +13 −0 cake/tests/cases/libs/cache/memcache.test.php
  46. +17 −0 cake/tests/cases/libs/cache/xcache.test.php
  47. +37 −2 cake/tests/cases/libs/cake_test_case.test.php
  48. +15 −1 cake/tests/cases/libs/controller/component.test.php
  49. +15 −0 cake/tests/cases/libs/controller/components/auth.test.php
  50. +36 −0 cake/tests/cases/libs/controller/components/request_handler.test.php
  51. +20 −1 cake/tests/cases/libs/controller/controller.test.php
  52. +13 −1 cake/tests/cases/libs/error.test.php
  53. +6 −4 cake/tests/cases/libs/http_socket.test.php
  54. +18 −3 cake/tests/cases/libs/i18n.test.php
  55. +5 −0 cake/tests/cases/libs/inflector.test.php
  56. +12 −3 cake/tests/cases/libs/model/behavior.test.php
  57. +27 −1 cake/tests/cases/libs/model/behaviors/translate.test.php
  58. +81 −31 cake/tests/cases/libs/model/datasources/dbo_source.test.php
  59. +44 −2 cake/tests/cases/libs/model/model.test.php
  60. +6 −3 cake/tests/cases/libs/object.test.php
  61. +26 −5 cake/tests/cases/libs/router.test.php
  62. +135 −4 cake/tests/cases/libs/set.test.php
  63. +14 −3 cake/tests/cases/libs/string.test.php
  64. +22 −1 cake/tests/cases/libs/validation.test.php
  65. +29 −0 cake/tests/cases/libs/view/helper.test.php
  66. +34 −3 cake/tests/cases/libs/view/helpers/html.test.php
  67. +10 −1 cake/tests/cases/libs/view/helpers/javascript.test.php
  68. +5 −0 cake/tests/cases/libs/view/helpers/number.test.php
  69. +63 −9 cake/tests/cases/libs/view/helpers/paginator.test.php
  70. +58 −0 cake/tests/groups/console.group.php
  71. +39 −23 cake/tests/lib/cake_test_case.php
  72. +2 −0 cake/tests/lib/test_manager.php
View
@@ -95,7 +95,7 @@ function write_css_cache($path, $content) {
header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT');
header("Content-Type: text/css");
- header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT");
+ header("Expires: " . gmdate("D, d M Y H:i:s", time() + DAY) . " GMT");
header("Cache-Control: max-age=86400, must-revalidate"); // HTTP/1.1
header("Pragma: cache"); // HTTP/1.0
print $output;
@@ -471,11 +471,11 @@ function _checkUnitTest() {
if (App::import('vendor', 'simpletest' . DS . 'simpletest')) {
return true;
}
- $unitTest = $this->in('Cake test suite not installed. Do you want to bake unit test files anyway?', array('y','n'), 'y');
+ $unitTest = $this->in('SimpleTest is not installed. Do you want to bake unit test files anyway?', array('y','n'), 'y');
$result = low($unitTest) == 'y' || low($unitTest) == 'yes';
if ($result) {
- $this->out("\nYou can download the Cake test suite from http://cakeforge.org/projects/testsuite/", true);
+ $this->out("\nYou can download SimpleTest from http://simpletest.org", true);
}
return $result;
}
@@ -668,6 +668,9 @@ function __searchDirectory($path = null) {
$files = glob("$path*.{php,ctp,thtml,inc,tpl}", GLOB_BRACE);
$dirs = glob("$path*", GLOB_ONLYDIR);
+ $files = $files ? $files : array();
+ $dirs = $dirs ? $dirs : array();
+
foreach ($dirs as $dir) {
if (!preg_match("!(^|.+/)(CVS|.svn)$!", $dir)) {
$files = array_merge($files, $this->__searchDirectory("$dir" . DS));
@@ -570,13 +570,13 @@ function bake($name, $associations = array(), $validate = array(), $primaryKey
$belongsToCount = count($associations['belongsTo']);
for ($i = 0; $i < $belongsToCount; $i++) {
- $out .= "\t\t\t'{$associations['belongsTo'][$i]['alias']}' => ";
- $out .= "array('className' => '{$associations['belongsTo'][$i]['className']}',\n";
- $out .= "\t\t\t\t\t\t\t\t'foreignKey' => '{$associations['belongsTo'][$i]['foreignKey']}',\n";
- $out .= "\t\t\t\t\t\t\t\t'conditions' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'fields' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'order' => ''\n";
- $out .= "\t\t\t)";
+ $out .= "\t\t'{$associations['belongsTo'][$i]['alias']}' => array(\n";
+ $out .= "\t\t\t'className' => '{$associations['belongsTo'][$i]['className']}',\n";
+ $out .= "\t\t\t'foreignKey' => '{$associations['belongsTo'][$i]['foreignKey']}',\n";
+ $out .= "\t\t\t'conditions' => '',\n";
+ $out .= "\t\t\t'fields' => '',\n";
+ $out .= "\t\t\t'order' => ''\n";
+ $out .= "\t\t)";
if ($i + 1 < $belongsToCount) {
$out .= ",";
}
@@ -591,14 +591,14 @@ function bake($name, $associations = array(), $validate = array(), $primaryKey
$hasOneCount = count($associations['hasOne']);
for ($i = 0; $i < $hasOneCount; $i++) {
- $out .= "\t\t\t'{$associations['hasOne'][$i]['alias']}' => ";
- $out .= "array('className' => '{$associations['hasOne'][$i]['className']}',\n";
- $out .= "\t\t\t\t\t\t\t\t'foreignKey' => '{$associations['hasOne'][$i]['foreignKey']}',\n";
- $out .= "\t\t\t\t\t\t\t\t'dependent' => false,\n";
- $out .= "\t\t\t\t\t\t\t\t'conditions' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'fields' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'order' => ''\n";
- $out .= "\t\t\t)";
+ $out .= "\t\t'{$associations['hasOne'][$i]['alias']}' => array(\n";
+ $out .= "\t\t\t'className' => '{$associations['hasOne'][$i]['className']}',\n";
+ $out .= "\t\t\t'foreignKey' => '{$associations['hasOne'][$i]['foreignKey']}',\n";
+ $out .= "\t\t\t'dependent' => false,\n";
+ $out .= "\t\t\t'conditions' => '',\n";
+ $out .= "\t\t\t'fields' => '',\n";
+ $out .= "\t\t\t'order' => ''\n";
+ $out .= "\t\t)";
if ($i + 1 < $hasOneCount) {
$out .= ",";
}
@@ -613,19 +613,19 @@ function bake($name, $associations = array(), $validate = array(), $primaryKey
$hasManyCount = count($associations['hasMany']);
for ($i = 0; $i < $hasManyCount; $i++) {
- $out .= "\t\t\t'{$associations['hasMany'][$i]['alias']}' => ";
- $out .= "array('className' => '{$associations['hasMany'][$i]['className']}',\n";
- $out .= "\t\t\t\t\t\t\t\t'foreignKey' => '{$associations['hasMany'][$i]['foreignKey']}',\n";
- $out .= "\t\t\t\t\t\t\t\t'dependent' => false,\n";
- $out .= "\t\t\t\t\t\t\t\t'conditions' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'fields' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'order' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'limit' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'offset' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'exclusive' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'finderQuery' => '',\n";
- $out .= "\t\t\t\t\t\t\t\t'counterQuery' => ''\n";
- $out .= "\t\t\t)";
+ $out .= "\t\t'{$associations['hasMany'][$i]['alias']}' => array(\n";
+ $out .= "\t\t\t'className' => '{$associations['hasMany'][$i]['className']}',\n";
+ $out .= "\t\t\t'foreignKey' => '{$associations['hasMany'][$i]['foreignKey']}',\n";
+ $out .= "\t\t\t'dependent' => false,\n";
+ $out .= "\t\t\t'conditions' => '',\n";
+ $out .= "\t\t\t'fields' => '',\n";
+ $out .= "\t\t\t'order' => '',\n";
+ $out .= "\t\t\t'limit' => '',\n";
+ $out .= "\t\t\t'offset' => '',\n";
+ $out .= "\t\t\t'exclusive' => '',\n";
+ $out .= "\t\t\t'finderQuery' => '',\n";
+ $out .= "\t\t\t'counterQuery' => ''\n";
+ $out .= "\t\t)";
if ($i + 1 < $hasManyCount) {
$out .= ",";
}
@@ -639,21 +639,21 @@ function bake($name, $associations = array(), $validate = array(), $primaryKey
$hasAndBelongsToManyCount = count($associations['hasAndBelongsToMany']);
for ($i = 0; $i < $hasAndBelongsToManyCount; $i++) {
- $out .= "\t\t\t'{$associations['hasAndBelongsToMany'][$i]['alias']}' => ";
- $out .= "array('className' => '{$associations['hasAndBelongsToMany'][$i]['className']}',\n";
- $out .= "\t\t\t\t\t\t'joinTable' => '{$associations['hasAndBelongsToMany'][$i]['joinTable']}',\n";
- $out .= "\t\t\t\t\t\t'foreignKey' => '{$associations['hasAndBelongsToMany'][$i]['foreignKey']}',\n";
- $out .= "\t\t\t\t\t\t'associationForeignKey' => '{$associations['hasAndBelongsToMany'][$i]['associationForeignKey']}',\n";
- $out .= "\t\t\t\t\t\t'unique' => true,\n";
- $out .= "\t\t\t\t\t\t'conditions' => '',\n";
- $out .= "\t\t\t\t\t\t'fields' => '',\n";
- $out .= "\t\t\t\t\t\t'order' => '',\n";
- $out .= "\t\t\t\t\t\t'limit' => '',\n";
- $out .= "\t\t\t\t\t\t'offset' => '',\n";
- $out .= "\t\t\t\t\t\t'finderQuery' => '',\n";
- $out .= "\t\t\t\t\t\t'deleteQuery' => '',\n";
- $out .= "\t\t\t\t\t\t'insertQuery' => ''\n";
- $out .= "\t\t\t)";
+ $out .= "\t\t'{$associations['hasAndBelongsToMany'][$i]['alias']}' => array(\n";
+ $out .= "\t\t\t'className' => '{$associations['hasAndBelongsToMany'][$i]['className']}',\n";
+ $out .= "\t\t\t'joinTable' => '{$associations['hasAndBelongsToMany'][$i]['joinTable']}',\n";
+ $out .= "\t\t\t'foreignKey' => '{$associations['hasAndBelongsToMany'][$i]['foreignKey']}',\n";
+ $out .= "\t\t\t'associationForeignKey' => '{$associations['hasAndBelongsToMany'][$i]['associationForeignKey']}',\n";
+ $out .= "\t\t\t'unique' => true,\n";
+ $out .= "\t\t\t'conditions' => '',\n";
+ $out .= "\t\t\t'fields' => '',\n";
+ $out .= "\t\t\t'order' => '',\n";
+ $out .= "\t\t\t'limit' => '',\n";
+ $out .= "\t\t\t'offset' => '',\n";
+ $out .= "\t\t\t'finderQuery' => '',\n";
+ $out .= "\t\t\t'deleteQuery' => '',\n";
+ $out .= "\t\t\t'insertQuery' => ''\n";
+ $out .= "\t\t)";
if ($i + 1 < $hasAndBelongsToManyCount) {
$out .= ",";
}
@@ -718,7 +718,7 @@ function bakeTest($className, $useTable = null, $associations = array()) {
$out .= "\tfunction test{$className}Find() {\n";
$out .= "\t\t\$this->{$className}->recursive = -1;\n";
$out .= "\t\t\$results = \$this->{$className}->find('first');\n\t\t\$this->assertTrue(!empty(\$results));\n\n";
- $out .= "\t\t\$expected = array('$className' => array(\n$results\n\t\t\t));\n";
+ $out .= "\t\t\$expected = array('$className' => array(\n$results\n\t\t));\n";
$out .= "\t\t\$this->assertEqual(\$results, \$expected);\n";
$out .= "\t}\n";
$out .= "}\n";
@@ -862,7 +862,7 @@ function fixture($model, $useTable = null) {
$type = $value;
$value = array('type'=> $type);
}
- $col = "\t\t\t'{$field}' => array('type'=>'" . $value['type'] . "', ";
+ $col = "\t\t'{$field}' => array('type'=>'" . $value['type'] . "', ";
switch ($value['type']) {
case 'integer':
@@ -898,11 +898,11 @@ function fixture($model, $useTable = null) {
$insert .= "feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.'";
break;
}
- $records[] = "\t\t\t'$field' => $insert";
+ $records[] = "\t\t'$field' => $insert";
unset($value['type']);
$col .= join(', ', $schema->__values($value));
} else {
- $col = "\t\t\t'indexes' => array(";
+ $col = "\t\t'indexes' => array(";
$props = array();
foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(".join(', ', $schema->__values($index)).")";
@@ -914,11 +914,11 @@ function fixture($model, $useTable = null) {
}
$out .= join(",\n", $cols);
}
- $out .= "\n\t\t\t);\n";
+ $out .= "\n\t);\n";
}
}
$records = join(",\n", $records);
- $out .= "\tvar \$records = array(array(\n$records\n\t\t\t));\n";
+ $out .= "\tvar \$records = array(array(\n$records\n\t));\n";
$out .= "}\n";
$path = TESTS . DS . 'fixtures' . DS;
if (isset($this->plugin)) {
@@ -930,7 +930,7 @@ function fixture($model, $useTable = null) {
$content = "<?php \n/* SVN FILE: $header$ */\n/* ". $model ." Fixture generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
$this->out("\nBaking test fixture for $model...");
if ($this->createFile($path . $filename, $content)) {
- return $records;
+ return str_replace("\t\t", "\t\t\t", $records);
}
return false;
}
@@ -87,19 +87,19 @@ function __interactive($class = null) {
}
while ($class == null) {
+ $cases = array();
+ $this->hr();
+ $this->out("Select a class:");
+ $this->hr();
+
+ $keys = array();
+ foreach ($options as $key => $option) {
+ $this->out(++$key . '. ' . $option);
+ $keys[] = $key;
+ }
+ $keys[] = 'q';
- $this->hr();
- $this->out("Select a class:");
- $this->hr();
-
- $keys = array();
- foreach ($options as $key => $option) {
- $this->out(++$key . '. ' . $option);
- $keys[] = $key;
- }
- $keys[] = 'q';
-
- $key = $this->in(__("Enter the class to test or (q)uit", true), $keys, 'q');
+ $key = $this->in(__("Enter the class to test or (q)uit", true), $keys, 'q');
if ($key != 'q') {
if (isset($options[--$key])) {
@@ -143,7 +143,7 @@ function bake($class, $name = null, $cases = array()) {
}
if (strpos($this->path, $class) === false) {
- $this->path .= 'cases' . DS . Inflector::tableize($class) . DS;
+ $this->filePath = $this->path . 'cases' . DS . Inflector::tableize($class) . DS;
}
$class = Inflector::classify($class);
@@ -175,14 +175,14 @@ function bake($class, $name = null, $cases = array()) {
$this->out("Baking unit test for $name...");
$this->out($out);
- $ok = $this->in(__('Is this correct?'), array('y', 'n'), 'y');
+ $ok = $this->in(__('Is this correct?', true), array('y', 'n'), 'y');
if ($ok == 'n') {
return false;
}
$header = '$Id';
$content = "<?php \n/* SVN FILE: $header$ */\n/* ". $name ." Test cases generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n{$out}?>";
- return $this->createFile($this->path . Inflector::underscore($name) . '.test.php', $content);
+ return $this->createFile($this->filePath . Inflector::underscore($name) . '.test.php', $content);
}
/**
* Handles the extra stuff needed
Oops, something went wrong.

0 comments on commit 4b69023

Please sign in to comment.