diff --git a/app/webroot/test.php b/app/webroot/test.php index 1cb8faa20..8889c08bd 100644 --- a/app/webroot/test.php +++ b/app/webroot/test.php @@ -117,7 +117,21 @@ if(!vendor('simpletest' . DS . 'reporter')) { function CakePHPTestRunMore() { switch (CAKE_TEST_OUTPUT) { case CAKE_TEST_OUTPUT_HTML: - echo "
\n"; + if (isset($_GET['group'])) { + if(isset($_GET['app'])) { + $show = '?show=groups&app=true'; + } else { + $show = '?show=groups'; + } + } + if (isset($_GET['case'])) { + if(isset($_GET['app'])) { + $show = '??show=cases&app=truee'; + } else { + $show = '?show=cases'; + } + } + echo "\n"; break; } } diff --git a/cake/tests/cases/libs/model/datasources/dbo_source.test.php b/cake/tests/cases/libs/model/datasources/dbo_source.test.php index a6a932c68..0eddda1e2 100644 --- a/cake/tests/cases/libs/model/datasources/dbo_source.test.php +++ b/cake/tests/cases/libs/model/datasources/dbo_source.test.php @@ -130,98 +130,98 @@ class DboSourceTest extends UnitTestCase { function testStringConditionsParsing() { $result = $this->db->conditions("Candy.name LIKE 'a' AND HardCandy.name LIKE 'c'"); $expected = " WHERE `Candy`.`name` LIKE 'a' AND `HardCandy`.`name` LIKE 'c'"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("HardCandy.name LIKE 'a' AND Candy.name LIKE 'c'"); $expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("Post.title = '1.1'"); $expected = " WHERE `Post`.`title` = '1.1'"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("SUM(Post.comments_count) > 500"); $expected = " WHERE SUM( `Post`.`comments_count`) > 500"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("(Post.created < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR(Post.created), MONTH(Post.created)"); $expected = " WHERE ( `Post`.`created` < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR( `Post`.`created`), MONTH( `Post`.`created`)"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("score BETWEEN 90.1 AND 95.7"); $expected = " WHERE score BETWEEN 90.1 AND 95.7"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("Aro.rght = Aro.lft + 1.1"); $expected = " WHERE `Aro`.`rght` = `Aro`.`lft` + 1.1"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions("(Post.created < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR(Post.created), MONTH(Post.created)"); $expected = " WHERE ( `Post`.`created` < '" . date('Y-m-d H:i:s') . "') GROUP BY YEAR( `Post`.`created`), MONTH( `Post`.`created`)"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions('Sportstaette.sportstaette LIKE "%ru%" AND Sportstaette.sportstaettenart_id = 2'); $expected = ' WHERE `Sportstaette`.`sportstaette` LIKE "%ru%" AND `Sportstaette`.`sportstaettenart_id` = 2'; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '" . r('%', '_', $expected) . "', got '" . r('%', '_', $result) . "'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions('Sportstaette.sportstaettenart_id = 2 AND Sportstaette.sportstaette LIKE "%ru%"'); $expected = ' WHERE `Sportstaette`.`sportstaettenart_id` = 2 AND `Sportstaette`.`sportstaette` LIKE "%ru%"'; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '" . r('%', '_', $expected) . "', got '" . r('%', '_', $result) . "'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions('SUM(Post.comments_count) > 500 AND NOT Post.title IS NULL AND NOT Post.extended_title IS NULL'); $expected = ' WHERE SUM( `Post`.`comments_count`) > 500 AND NOT `Post`.`title` IS NULL AND NOT `Post`.`extended_title` IS NULL'; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions('NOT Post.title IS NULL AND NOT Post.extended_title IS NULL AND SUM(Post.comments_count) > 500'); $expected = ' WHERE NOT `Post`.`title` IS NULL AND NOT `Post`.`extended_title` IS NULL AND SUM( `Post`.`comments_count`) > 500'; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions('NOT Post.extended_title IS NULL AND NOT Post.title IS NULL AND Post.title != "" AND SPOON(SUM(Post.comments_count) + 1.1) > 500'); $expected = ' WHERE NOT `Post`.`extended_title` IS NULL AND NOT `Post`.`title` IS NULL AND `Post`.`title` != "" AND SPOON(SUM( `Post`.`comments_count`) + 1.1) > 500'; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions('NOT Post.title_extended IS NULL AND NOT Post.title IS NULL AND Post.title_extended != Post.title'); $expected = ' WHERE NOT `Post`.`title_extended` IS NULL AND NOT `Post`.`title` IS NULL AND `Post`.`title_extended` != `Post`.`title`'; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); } function testArrayConditionsParsing() { $result = $this->db->conditions(array('Candy.name' => 'LIKE a', 'HardCandy.name' => 'LIKE c')); $expected = " WHERE `Candy`.`name` LIKE 'a' AND `HardCandy`.`name` LIKE 'c'"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions(array('HardCandy.name' => 'LIKE a', 'Candy.name' => 'LIKE c')); $expected = " WHERE `HardCandy`.`name` LIKE 'a' AND `Candy`.`name` LIKE 'c'"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions(array('score' => 'BETWEEN 90.1 AND 95.7')); $expected = " WHERE `score` BETWEEN '90.1' AND '95.7'"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions(array('Post.title' => 1.1)); $expected = " WHERE `Post`.`title` = 1.1"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); $result = $this->db->conditions(array('SUM(Post.comments_count)' => '> 500')); $expected = " WHERE SUM(`Post`.`comments_count`) > 500"; - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), expected '{$expected}', got '{$result}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::conditions(), %s"); } function testFieldParsing() { $result = $this->db->fields($this->model, 'Post', "CONCAT(REPEAT(' ', COUNT(Parent.name) - 1), Node.name) AS name, Node.created"); $expected = array("CONCAT(REPEAT(' ', COUNT(`Parent`.`name`) - 1), Node.name) AS name", "`Node`.`created`"); - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::fields(), expected '{$expected[0]}', got '{$result[0]}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::fields(), %s"); $result = $this->db->fields($this->model, 'Post', "Node.created, CONCAT(REPEAT(' ', COUNT(Parent.name) - 1), Node.name) AS name"); $expected = array("`Node`.`created`", "CONCAT(REPEAT(' ', COUNT(`Parent`.`name`) - 1), Node.name) AS name"); - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::fields(), expected '{$expected[0]}', got '{$result[0]}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::fields(), %s"); $result = $this->db->fields($this->model, 'Post', "2.2,COUNT(*), SUM(Something.else) as sum, Node.created, CONCAT(REPEAT(' ', COUNT(Parent.name) - 1), Node.name) AS name,Post.title,Post.1,1.1"); $expected = array( '2.2', 'COUNT(*)', 'SUM(`Something`.`else`) as sum', '`Node`.`created`', "CONCAT(REPEAT(' ', COUNT(`Parent`.`name`) - 1), Node.name) AS name", '`Post`.`title`', '`Post`.`1`', '1.1' ); - $this->assertEqual($result, $expected, "Error quoting field names in DboSource::fields(), expected '{$expected[0]}', got '{$result[0]}'."); + $this->assertEqual($result, $expected, "Error quoting field names in DboSource::fields(), %s"); } function testMagicMethodQuerying() { @@ -231,15 +231,15 @@ class DboSourceTest extends UnitTestCase { $result = $this->db->query('findByFieldName', array(array('value1', 'value2', 'value3')), $this->model); $expected = array('TestModel.field_name' => array('value1', 'value2', 'value3')); - $this->assertEqual($result, $expected, "Error computing conditions from magic method with array value."); + $this->assertEqual($result, $expected, "Error computing conditions from magic method with array value. %s"); $result = $this->db->query('findByFieldName', array(null), $this->model); $expected = array('TestModel.field_name' => null); - $this->assertEqual($result, $expected, "Error computing conditions from magic method with null value."); + $this->assertEqual($result, $expected, "Error computing conditions from magic method with null value. %s"); $result = $this->db->query('findByFieldName', array('= a'), $this->model); $expected = array('TestModel.field_name' => '= = a'); - $this->assertEqual($result, $expected, "Error computing conditions from magic method with string value."); + $this->assertEqual($result, $expected, "Error computing conditions from magic method with string value. %s"); } function testSomething() { diff --git a/cake/tests/groups/lib.group.php b/cake/tests/groups/lib.group.php index 003175197..fae42656b 100644 --- a/cake/tests/groups/lib.group.php +++ b/cake/tests/groups/lib.group.php @@ -34,9 +34,9 @@ * @subpackage cake.tests.groups */ class AllCoreLibGroupTest extends GroupTest { + var $label = 'All cake/libs/* (Not yet implemented)'; function AllCoreLibGroupTest() { - $this->GroupTest('All cake/libs/*'); TestManager::addTestCasesFromDirectory($this, CORE_TEST_CASES . DS . 'libs'); } } diff --git a/cake/tests/groups/lib_controller.group.php b/cake/tests/groups/lib_controller.group.php index bdf843cdc..5822e9627 100644 --- a/cake/tests/groups/lib_controller.group.php +++ b/cake/tests/groups/lib_controller.group.php @@ -33,9 +33,9 @@ * @subpackage cake.tests.groups */ class LibControllerGroupTest extends GroupTest { + var $label = 'All cake/libs/controller/* (Not yet implemented)'; function LibControllerGroupTest() { - $this->GroupTest('All cake/libs/controller/*'); TestManager::addTestCasesFromDirectory($this, CORE_TEST_CASES . DS . 'libs' . DS . 'controller'); } } diff --git a/cake/tests/groups/no_database.group.php b/cake/tests/groups/no_database.group.php new file mode 100644 index 000000000..7889ba2c9 --- /dev/null +++ b/cake/tests/groups/no_database.group.php @@ -0,0 +1,49 @@ + + * Copyright 2005-2007, 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-2007, Cake Software Foundation, Inc. + * @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests + * @package cake.tests + * @subpackage cake.tests.groups + * @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 + */ +/** AllCoreLibGroupTest + * + * This test group will run all test in the cases/libs directory. + * + * @package cake.tests + * @subpackage cake.tests.groups + */ +class AllCoreWithOutDatabaseGroupTest extends GroupTest { + var $label = 'All Test without a database connection'; + + function AllCoreWithOutDatabaseGroupTest() { + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'router'); + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'dispatcher'); + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'validation'); + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'helpers' . DS . 'paginator'); + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'socket'); + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'helpers' . DS . 'ajax'); + TestManager::addTestFile($this, CORE_TEST_CASES . DS . 'libs' . DS . 'model' . DS . 'model'); + } +} +?> \ No newline at end of file diff --git a/cake/tests/lib/test_manager.php b/cake/tests/lib/test_manager.php index 259313fca..f0e1ec86e 100644 --- a/cake/tests/lib/test_manager.php +++ b/cake/tests/lib/test_manager.php @@ -105,7 +105,11 @@ class TestManager { $test =& new GroupTest($groupTestName . ' group test'); foreach ($manager->_getGroupTestClassNames($filePath) as $groupTest) { - $test->addTestCase(new $groupTest()); + $testCase = new $groupTest(); + $test->addTestCase($testCase); + if(isset($testCase->label)) { + $test->_label = $testCase->label; + } } $test->run($reporter); } @@ -118,6 +122,11 @@ class TestManager { } } + function addTestFile(&$groupTest, $file) { + $manager =& new TestManager(); + $groupTest->addTestFile($file.'.test.php'); + } + function &getTestCaseList($directory = '.') { $manager =& new TestManager(); $return = $manager->_getTestCaseList($directory);