Permalink
Browse files

Merge branch '1.3-misc' into 1.3

  • Loading branch information...
2 parents 0456298 + 8e22e8c commit d8e7aa929c66c79dab1bf935bc6be7dcda2e65b1 @markstory markstory committed Jan 12, 2010
Showing with 2,061 additions and 1,426 deletions.
  1. +3 −80 app/webroot/test.php
  2. +11 −4 cake/console/libs/tasks/fixture.php
  3. +6 −5 cake/console/libs/tasks/model.php
  4. +38 −6 cake/console/libs/tasks/test.php
  5. +2 −2 cake/console/libs/tasks/view.php
  6. +128 −114 cake/console/libs/testsuite.php
  7. +1 −1 cake/libs/controller/components/auth.php
  8. +3 −3 cake/libs/controller/components/request_handler.php
  9. +148 −139 cake/libs/l10n.php
  10. +27 −5 cake/libs/model/model.php
  11. +21 −0 cake/libs/router.php
  12. +42 −11 cake/libs/sanitize.php
  13. +21 −2 cake/libs/validation.php
  14. +9 −44 cake/libs/view/helpers/cache.php
  15. +4 −5 cake/tests/cases/dispatcher.test.php
  16. +5 −5 cake/tests/cases/libs/code_coverage_manager.test.php
  17. +25 −0 cake/tests/cases/libs/controller/components/auth.test.php
  18. +4 −4 cake/tests/cases/libs/controller/components/request_handler.test.php
  19. +151 −157 cake/tests/cases/libs/l10n.test.php
  20. +52 −0 cake/tests/cases/libs/router.test.php
  21. +37 −15 cake/tests/cases/libs/sanitize.test.php
  22. +6 −7 cake/tests/cases/libs/test_manager.test.php
  23. +11 −0 cake/tests/cases/libs/validation.test.php
  24. +77 −13 cake/tests/cases/libs/view/helpers/cache.test.php
  25. +1 −0 cake/tests/cases/libs/view/view.test.php
  26. +249 −0 cake/tests/lib/cake_test_suite_dispatcher.php
  27. +0 −60 cake/tests/lib/cake_text_reporter.php
  28. +0 −101 cake/tests/lib/cli_reporter.php
  29. +107 −90 cake/tests/lib/code_coverage_manager.php
  30. +226 −0 cake/tests/lib/reporter/cake_base_reporter.php
  31. +179 −0 cake/tests/lib/reporter/cake_cli_reporter.php
  32. +163 −56 cake/tests/lib/{cake_reporter.php → reporter/cake_html_reporter.php}
  33. +199 −0 cake/tests/lib/reporter/cake_text_reporter.php
  34. +7 −1 cake/tests/lib/{ → templates}/footer.php
  35. +2 −2 cake/tests/lib/{ → templates}/header.php
  36. +2 −2 cake/tests/lib/{content.php → templates/menu.php}
  37. +4 −2 cake/tests/lib/{ → templates}/simpletest.php
  38. +8 −5 cake/tests/lib/{ → templates}/xdebug.php
  39. +82 −485 cake/tests/lib/test_manager.php
View
@@ -18,7 +18,6 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
set_time_limit(0);
-ini_set('memory_limit','128M');
ini_set('display_errors', 1);
/**
* Use the DS to separate the directories in other defines
@@ -85,89 +84,13 @@
define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
}
-require_once CAKE_TESTS_LIB . 'test_manager.php';
-
if (Configure::read('debug') < 1) {
die(__('Debug setting does not allow access to this url.', true));
}
-if (!isset($_SERVER['SERVER_NAME'])) {
- $_SERVER['SERVER_NAME'] = '';
-}
-if (empty( $_GET['output'])) {
- $_GET['output'] = 'html';
-}
-/**
- *
- * Used to determine output to display
- */
-define('CAKE_TEST_OUTPUT_HTML', 1);
-define('CAKE_TEST_OUTPUT_TEXT', 2);
-
-if (isset($_GET['output']) && $_GET['output'] == 'html') {
- define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML);
-} else {
- Debugger::output('txt');
- define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT);
-}
-
-if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
- CakePHPTestHeader();
- include CAKE_TESTS_LIB . 'simpletest.php';
- CakePHPTestSuiteFooter();
- exit();
-}
-
-$analyzeCodeCoverage = false;
-if (isset($_GET['code_coverage'])) {
- $analyzeCodeCoverage = true;
- require_once CAKE_TESTS_LIB . 'code_coverage_manager.php';
- if (!extension_loaded('xdebug')) {
- CakePHPTestHeader();
- include CAKE_TESTS_LIB . 'xdebug.php';
- CakePHPTestSuiteFooter();
- exit();
- }
-}
-
-CakePHPTestHeader();
-CakePHPTestSuiteHeader();
-define('RUN_TEST_LINK', $_SERVER['PHP_SELF']);
-
-if (isset($_GET['group'])) {
- if ('all' == $_GET['group']) {
- TestManager::runAllTests(CakeTestsGetReporter());
- } else {
- if ($analyzeCodeCoverage) {
- CodeCoverageManager::start($_GET['group'], CakeTestsGetReporter());
- }
- TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter());
- if ($analyzeCodeCoverage) {
- CodeCoverageManager::report();
- }
- }
+require_once CAKE_TESTS_LIB . 'cake_test_suite_dispatcher.php';
- CakePHPTestRunMore();
- CakePHPTestAnalyzeCodeCoverage();
-} elseif (isset($_GET['case'])) {
- if ($analyzeCodeCoverage) {
- CodeCoverageManager::start($_GET['case'], CakeTestsGetReporter());
- }
-
- TestManager::runTestCase($_GET['case'], CakeTestsGetReporter());
-
- if ($analyzeCodeCoverage) {
- CodeCoverageManager::report();
- }
+$Dispatcher = new CakeTestSuiteDispatcher();
+$Dispatcher->dispatch();
- CakePHPTestRunMore();
- CakePHPTestAnalyzeCodeCoverage();
-} elseif (isset($_GET['show']) && $_GET['show'] == 'cases') {
- CakePHPTestCaseList();
-} else {
- CakePHPTestGroupTestList();
-}
-CakePHPTestSuiteFooter();
-$output = ob_get_clean();
-echo $output;
?>
@@ -54,13 +54,15 @@ class FixtureTask extends Shell {
* The db connection being used for baking
*
* @var string
+ * @access public
*/
var $connection = null;
/**
* Schema instance
*
* @var object
+ * @access protected
*/
var $_Schema = null;
@@ -140,6 +142,7 @@ function __interactive() {
*
* @param string $modelName Name of model you are dealing with.
* @return array Array of import options.
+ * @access public
*/
function importOptions($modelName) {
$options = array();
@@ -167,8 +170,8 @@ function importOptions($modelName) {
* @param string $model Name of model to bake.
* @param string $useTable Name of table to use.
* @param array $importOptions Options for var $import
- * @return string Baked fixture
- * @access private
+ * @return string Baked fixture content
+ * @access public
*/
function bake($model, $useTable = false, $importOptions = array()) {
if (!class_exists('CakeSchema')) {
@@ -228,8 +231,8 @@ function bake($model, $useTable = false, $importOptions = array()) {
*
* @param string $model name of the model being generated
* @param string $fixture Contents of the fixture file.
+ * @return string Content saved into fixture file.
* @access public
- * @return void
*/
function generateFixtureFile($model, $otherVars) {
$defaults = array('table' => null, 'schema' => null, 'records' => null, 'import' => null, 'fields' => null);
@@ -255,6 +258,7 @@ function generateFixtureFile($model, $otherVars) {
*
* @param array $table Table schema array
* @return string fields definitions
+ * @access protected
*/
function _generateSchema($tableInfo) {
$schema = $this->_Schema->generateTable('f', $tableInfo);
@@ -266,6 +270,7 @@ function _generateSchema($tableInfo) {
*
* @param array $table Table schema array
* @return array Array of records to use in the fixture.
+ * @access protected
*/
function _generateRecords($tableInfo, $recordCount = 1) {
$records = array();
@@ -337,6 +342,7 @@ function _generateRecords($tableInfo, $recordCount = 1) {
*
* @param array $records Array of records to be converted to string
* @return string A string value of the $records array.
+ * @access protected
*/
function _makeRecordString($records) {
$out = "array(\n";
@@ -360,6 +366,7 @@ function _makeRecordString($records) {
* @param string $modelName name of the model to take records from.
* @param string $useTable Name of table to use.
* @return array Array of records.
+ * @access protected
*/
function _getRecordsFromTable($modelName, $useTable = null) {
if ($this->interactive) {
@@ -378,7 +385,7 @@ function _getRecordsFromTable($modelName, $useTable = null) {
'recursive' => -1
));
$db =& ConnectionManager::getDataSource($modelObject->useDbConfig);
- $schema = $modelObject->schema();
+ $schema = $modelObject->schema(true);
$out = array();
foreach ($records as $record) {
$row = array();
@@ -186,7 +186,7 @@ function __interactive() {
if (in_array($useTable, $this->__tables)) {
$tempModel = new Model(array('name' => $currentModelName, 'table' => $useTable, 'ds' => $this->connection));
- $fields = $tempModel->schema();
+ $fields = $tempModel->schema(true);
if (!array_key_exists('id', $fields)) {
$primaryKey = $this->findPrimaryKey($fields);
}
@@ -447,7 +447,7 @@ function doAssociations(&$model) {
$this->out(__('One moment while the associations are detected.', true));
}
- $fields = $model->schema();
+ $fields = $model->schema(true);
if (empty($fields)) {
return false;
}
@@ -487,7 +487,7 @@ function doAssociations(&$model) {
* @return array $associations with belongsTo added in.
*/
function findBelongsTo(&$model, $associations) {
- $fields = $model->schema();
+ $fields = $model->schema(true);
foreach ($fields as $fieldName => $field) {
$offset = strpos($fieldName, '_id');
if ($fieldName != $model->primaryKey && $fieldName != 'parent_id' && $offset !== false) {
@@ -562,7 +562,7 @@ function findHasAndBelongsToMany(&$model, $associations) {
$foreignKey = $this->_modelKey($model->name);
foreach ($this->__tables as $otherTable) {
$tempOtherModel = $this->_getModelObject($this->_modelName($otherTable), $otherTable);
- $modelFieldsTemp = $tempOtherModel->schema();
+ $modelFieldsTemp = $tempOtherModel->schema(true);
$offset = strpos($otherTable, $model->table . '_');
$otherOffset = strpos($otherTable, '_' . $model->table);
@@ -695,7 +695,7 @@ function _generatePossibleKeys() {
$possible = array();
foreach ($this->__tables as $otherTable) {
$tempOtherModel = & new Model(array('table' => $otherTable, 'ds' => $this->connection));
- $modelFieldsTemp = $tempOtherModel->schema();
+ $modelFieldsTemp = $tempOtherModel->schema(true);
foreach ($modelFieldsTemp as $fieldName => $field) {
if ($field['type'] == 'integer' || $field['type'] == 'string') {
$possible[$otherTable][] = $fieldName;
@@ -821,6 +821,7 @@ function getAllTables($useDbConfig = null) {
$tables = array();
$db =& ConnectionManager::getDataSource($useDbConfig);
+ $db->cacheSources = false;
$usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix'];
if ($usePrefix) {
foreach ($db->listSources() as $table) {
Oops, something went wrong. Retry.

0 comments on commit d8e7aa9

Please sign in to comment.