Skip to content

Commit

Permalink
Updating schema shell test so it doesn't fail in groups.
Browse files Browse the repository at this point in the history
Updating suites to use new method.
  • Loading branch information
markstory committed Sep 25, 2010
1 parent 6124eb6 commit 8e6277c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 34 deletions.
7 changes: 2 additions & 5 deletions cake/tests/cases/console/all_shells.test.php
Expand Up @@ -34,16 +34,13 @@ class AllShellsTest extends PHPUnit_Framework_TestSuite {
* @return void
*/
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('All shell classes');
$suite = new CakeTestSuite('All shell classes');

$path = CORE_TEST_CASES . DS . 'console' . DS . 'libs' . DS;

$suite->addTestFile(CORE_TEST_CASES . DS . 'console' . DS . 'cake.test.php');
$suite->addTestFile(CORE_TEST_CASES . DS . 'console' . DS . 'console_error_handler.test.php');
$tasks = array('schema', 'acl', 'api', 'bake', 'shell');
foreach ($tasks as $task) {
$suite->addTestFile($path . $task . '.test.php');
}
$suite->addTestDirectory($path);
return $suite;
}
}
13 changes: 9 additions & 4 deletions cake/tests/cases/console/libs/schema.test.php
Expand Up @@ -399,6 +399,11 @@ public function testCreateNoArgs() {
* @return void
*/
public function testCreateWithTableArgs() {
$db = ConnectionManager::getDataSource('test');
$sources = $db->listSources();
if (in_array('acos', $sources)) {
$this->markTestSkipped('acos table already exists, cannot try to create it again.');
}
$this->Shell->params = array(
'connection' => 'test',
'name' => 'DbAcl',
Expand All @@ -409,11 +414,11 @@ public function testCreateWithTableArgs() {
$this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
$this->Shell->create();

$db =& ConnectionManager::getDataSource('test');
$db = ConnectionManager::getDataSource('test');
$sources = $db->listSources();
$this->assertTrue(in_array($db->config['prefix'] . 'acos', $sources));
$this->assertFalse(in_array($db->config['prefix'] . 'aros', $sources));
$this->assertFalse(in_array('aros_acos', $sources));
$this->assertTrue(in_array($db->config['prefix'] . 'acos', $sources), 'acos should be present.');
$this->assertFalse(in_array($db->config['prefix'] . 'aros', $sources), 'aros should not be found.');
$this->assertFalse(in_array('aros_acos', $sources), 'aros_acos should not be found.');

$db->execute('DROP TABLE ' . $db->config['prefix'] . 'acos');
}
Expand Down
10 changes: 2 additions & 8 deletions cake/tests/cases/libs/all_cache_engines.test.php
Expand Up @@ -34,16 +34,10 @@ class AllCacheEnginesTest extends PHPUnit_Framework_TestSuite {
* @return void
*/
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('All Cache related class tests');
$suite = new CakeTestSuite('All Cache related class tests');

$suite->addTestFile(CORE_TEST_CASES . DS . 'libs' . DS . 'cache.test.php');

$cacheIterator = new DirectoryIterator(CORE_TEST_CASES . DS . 'libs' . DS . 'cache');
foreach ($cacheIterator as $i => $file) {
if (!$file->isDot()) {
$suite->addTestfile($file->getPathname());
}
}
$suite->addTestDirectory(CORE_TEST_CASES . DS . 'libs' . DS . 'cache');
return $suite;
}
}
10 changes: 2 additions & 8 deletions cake/tests/cases/libs/all_components.test.php
Expand Up @@ -34,17 +34,11 @@ class AllComponentsTest extends PHPUnit_Framework_TestSuite {
* @return void
*/
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('All component class tests');
$suite = new CakeTestSuite('All component class tests');

$suite->addTestFile(CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'component.test.php');
$suite->addTestFile(CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'component_collection.test.php');

$iterator = new DirectoryIterator(CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'components');
foreach ($iterator as $i => $file) {
if (!$file->isDot()) {
$suite->addTestfile($file->getPathname());
}
}
$suite->addTestDirectory(CORE_TEST_CASES . DS . 'libs' . DS . 'controller' . DS . 'components');
return $suite;
}
}
11 changes: 2 additions & 9 deletions cake/tests/cases/libs/all_helpers.test.php
Expand Up @@ -35,18 +35,11 @@ class AllHelpersTest extends PHPUnit_Framework_TestSuite {
* @return void
*/
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('All Helper tests');
$suite = new CakeTestSuite('All Helper tests');

$suite->addTestFile(CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'helper.test.php');
$suite->addTestFile(CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'helper_collection.test.php');

$helperIterator = new DirectoryIterator(CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'helpers' . DS);

foreach ($helperIterator as $i => $file) {
if (!$file->isDot()) {
$suite->addTestfile($file->getPathname());
}
}
$suite->addTestDirectory(CORE_TEST_CASES . DS . 'libs' . DS . 'view' . DS . 'helpers' . DS);
return $suite;
}
}

0 comments on commit 8e6277c

Please sign in to comment.