diff --git a/cake/libs/model/schema.php b/cake/libs/model/schema.php
index 8ffc6461e..b45481dd3 100644
--- a/cake/libs/model/schema.php
+++ b/cake/libs/model/schema.php
@@ -240,6 +240,7 @@ class CakeSchema extends Object {
}
}
}
+
if (!empty($currentTables)) {
foreach ($currentTables as $table) {
if ($prefix) {
@@ -400,7 +401,7 @@ class CakeSchema extends Object {
}
$diff = array_diff_assoc($old[$table], $fields);
if (!empty($diff)) {
- $tables[$table]['drop'] = $diff;
+ $tables[$table]['drop'] = $diff;
}
}
foreach ($fields as $field => $value) {
@@ -456,7 +457,6 @@ class CakeSchema extends Object {
$fields = $Obj->schema(true);
$columns = $props = array();
foreach ($fields as $name => $value) {
-
if ($Obj->primaryKey == $name) {
$value['key'] = 'primary';
}
diff --git a/cake/tests/cases/libs/test_manager.test.php b/cake/tests/cases/libs/test_manager.test.php
new file mode 100644
index 000000000..7fc7b077d
--- /dev/null
+++ b/cake/tests/cases/libs/test_manager.test.php
@@ -0,0 +1,97 @@
+
+ * Copyright 2005-2008, Cake Software Foundation, Inc.
+ * 1785 E. Sahara Avenue, Suite 490-204
+ * Las Vegas, Nevada 89104
+ *
+ * Licensed under The Open Group Test Suite License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
+ * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
+ * @package cake.tests
+ * @subpackage cake.tests.cases.libs
+ * @since CakePHP(tm) v 1.2.0.4206
+ * @version $Revision$
+ * @modifiedby $LastChangedBy$
+ * @lastmodified $Date$
+ * @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
+ */
+App::import('Core', 'TestManager');
+class TestManagerTest extends CakeTestCase {
+ function testRunAllTests() {
+ $manager = new TestManager();
+ $folder = new Folder($manager->_getTestsPath());
+ $extension = str_replace('.', '\.', Testmanager::getExtension('test'));
+ $out = $folder->findRecursive('.*' . $extension);
+
+ $reporter = new CakeHtmlReporter();
+ $list = TestManager::runAllTests($reporter, true);
+
+ $this->assertEqual(count($out), count($list->_test_cases));
+ }
+/**
+ * undocumented function
+ *
+ * @return void
+ * @access public
+ */
+ function testRunTestCase() {
+
+ }
+/**
+ * undocumented function
+ *
+ * @return void
+ * @access public
+ */
+ function testRunGroupTest() {
+
+ }
+/**
+ * undocumented function
+ *
+ * @return void
+ * @access public
+ */
+ function testAddTestCasesFromDirectory() {
+
+ }
+/**
+ * undocumented function
+ *
+ * @return void
+ * @access public
+ */
+ function testAddTestFile() {
+
+ }
+/**
+ * undocumented function
+ *
+ * @return void
+ * @access public
+ */
+ function testGetTestCaseList() {
+
+ }
+/**
+ * undocumented function
+ *
+ * @return void
+ * @access public
+ */
+ function testGetGroupTestList() {
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/cake/tests/lib/simpletest.php b/cake/tests/lib/simpletest.php
index c3c995333..35eb6e8cf 100644
--- a/cake/tests/lib/simpletest.php
+++ b/cake/tests/lib/simpletest.php
@@ -25,12 +25,13 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
?>
-
-
SimpleTest is not installed
-
You must install SimpleTest to use the CakePHP(tm) Test Suite.
-
SimpleTest can be placed in one of the following directories.
-
-
Download SimpleTest
\ No newline at end of file
+
+
SimpleTest is not installed
+
You must install SimpleTest to use the CakePHP(tm) Test Suite.
+
SimpleTest can be placed in one of the following directories.
+
+
Download SimpleTest
+
\ No newline at end of file
diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php
index e921fc0fb..791d4dd51 100644
--- a/cake/tests/lib/test_manager.php
+++ b/cake/tests/lib/test_manager.php
@@ -61,7 +61,11 @@ class TestManager {
* @access public
*/
function _installSimpleTest() {
- App::import('Vendor', array('simpletest'.DS.'unit_tester', 'simpletest'.DS.'mock_objects', 'simpletest'.DS.'web_tester'));
+ App::import('Vendor', array(
+ 'simpletest' . DS . 'unit_tester',
+ 'simpletest' . DS . 'mock_objects',
+ 'simpletest' . DS . 'web_tester'
+ ));
require_once(CAKE_TESTS_LIB . 'cake_web_test_case.php');
require_once(CAKE_TESTS_LIB . 'cake_test_case.php');
}
@@ -72,7 +76,7 @@ class TestManager {
* @return void
* @access public
*/
- function runAllTests(&$reporter) {
+ function runAllTests(&$reporter, $testing = false) {
$manager =& new TestManager();
$testCases =& $manager->_getTestFileList($manager->_getTestsPath());
@@ -87,6 +91,11 @@ class TestManager {
foreach ($testCases as $testCase) {
$test->addTestFile($testCase);
}
+
+ if ($testing) {
+ return $test;
+ }
+
return $test->run($reporter);
}
/**
@@ -101,7 +110,7 @@ class TestManager {
$manager =& new TestManager();
$testCaseFileWithPath = $manager->_getTestsPath() . DS . $testCaseFile;
- if (! file_exists($testCaseFileWithPath)) {
+ if (!file_exists($testCaseFileWithPath)) {
trigger_error("Test case {$testCaseFile} cannot be found", E_USER_ERROR);
}
$test =& new GroupTest("Individual test case: " . $testCaseFile);
@@ -242,12 +251,11 @@ class TestManager {
function &_getGroupTestClassNames($groupTestFile) {
$file = implode("\n", file($groupTestFile));
preg_match("~lass\s+?(.*)\s+?extends GroupTest~", $file, $matches);
- if (! empty($matches)) {
+ if (!empty($matches)) {
unset($matches[0]);
return $matches;
- } else {
- return array();
}
+ return array();
}
/**
* Gets a recursive list of files from a given directory and matches then against
@@ -335,6 +343,20 @@ class TestManager {
}
return $result;
}
+/**
+ * undocumented function
+ *
+ * @param string $type
+ * @return void
+ * @access public
+ */
+ function getExtension($type = 'test') {
+ $manager =& new TestManager();
+ if ($type == 'test') {
+ return $manager->_testExtension;
+ }
+ return $manager->_groupExtension;
+ }
}
/**
* The CliTestManager ensures that the list of available files are printed in the correct cli format
@@ -411,7 +433,7 @@ class TextTestManager extends TestManager {
$groupTests =& $manager->_getTestGroupList($manager->_getTestsPath('groups'));
$buffer = "Core Test Groups:\n";
- $urlExtra = null;
+ $urlExtra = '';
if ($manager->appTest) {
$buffer = "App Test Groups:\n";
$urlExtra = '&app=true';
@@ -438,7 +460,7 @@ class TextTestManager extends TestManager {
$testCases =& $manager->_getTestCaseList($manager->_getTestsPath());
$buffer = "Core Test Cases:\n";
- $urlExtra = null;
+ $urlExtra = '';
if ($manager->appTest) {
$buffer = "App Test Cases:\n";
$urlExtra = '&app=true';
@@ -510,7 +532,7 @@ class HtmlTestManager extends TestManager {
$buffer .= "
All tests\n";
- foreach ((array)$groupTests as $groupTest) {
+ foreach ($groupTests as $groupTest) {
$buffer .= "
" . $groupTest . "\n";
}
$buffer .= "\n";
@@ -569,10 +591,10 @@ if (function_exists('caketestsgetreporter')) {
case CAKE_TEST_OUTPUT_HTML:
require_once CAKE_TESTS_LIB . 'cake_reporter.php';
$Reporter =& new CakeHtmlReporter();
- break;
+ break;
default:
$Reporter =& new TextReporter();
- break;
+ break;
}
}
return $Reporter;
@@ -618,7 +640,8 @@ if (function_exists('caketestsgetreporter')) {
}
ob_start();
echo "
Run more tests | Show Passes | \n";
- break;
+
+ break;
}
}
/**
@@ -648,7 +671,8 @@ if (function_exists('caketestsgetreporter')) {
$query .= '&code_coverage=true';
ob_start();
echo " Analyze Code Coverage
\n";
- break;
+
+ break;
}
}
/**
@@ -662,11 +686,11 @@ if (function_exists('caketestsgetreporter')) {
case CAKE_TEST_OUTPUT_HTML:
ob_start();
echo HtmlTestManager::getTestCaseList();
- break;
+ break;
case CAKE_TEST_OUTPUT_TEXT:
default:
echo TextTestManager::getTestCaseList();
- break;
+ break;
}
}
/**
@@ -679,7 +703,7 @@ if (function_exists('caketestsgetreporter')) {
switch (CAKE_TEST_OUTPUT) {
case CAKE_TEST_OUTPUT_HTML:
echo HtmlTestManager::getGroupTestList();
- break;
+ break;
case CAKE_TEST_OUTPUT_TEXT:
default:
echo TextTestManager::getGroupTestList();
@@ -705,11 +729,12 @@ if (function_exists('caketestsgetreporter')) {
$baseUrl = BASE;
$characterSet = 'charset=utf-8';
include CAKE_TESTS_LIB . 'header.php';
- break;
+
+ break;
case CAKE_TEST_OUTPUT_TEXT:
default:
header('content-type: text/plain');
- break;
+ break;
}
}
/**
@@ -726,7 +751,7 @@ if (function_exists('caketestsgetreporter')) {
$cases = $_SERVER['PHP_SELF'].'?show=cases';
$plugins = Configure::listObjects('plugin');
include CAKE_TESTS_LIB . 'content.php';
- break;
+ break;
}
}
/**
@@ -741,7 +766,7 @@ if (function_exists('caketestsgetreporter')) {
ob_start();
$baseUrl = BASE;
include CAKE_TESTS_LIB . 'footer.php';
- break;
+ break;
}
}
}