From 1eaf49ec74fd469163ee74f244b9647962dd656e Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Mon, 10 Mar 2014 19:22:34 +0100 Subject: [PATCH] Fixing the DatabaseSuite file for phpunit 4.0 --- tests/TestCase/DatabaseSuite.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/TestCase/DatabaseSuite.php b/tests/TestCase/DatabaseSuite.php index 5f1aaaa585d..79124b6d524 100644 --- a/tests/TestCase/DatabaseSuite.php +++ b/tests/TestCase/DatabaseSuite.php @@ -33,11 +33,19 @@ class DatabaseSuite extends TestSuite { * @return void */ public static function suite() { - $suite = new TestSuite('Database related tests'); + $suite = new self('Database related tests'); $suite->addTestDirectoryRecursive(__DIR__ . DS . 'Database'); $suite->addTestDirectoryRecursive(__DIR__ . DS . 'ORM'); $suite->addTestDirectoryRecursive(__DIR__ . DS . 'Model'); + return $suite; + } +/** + * Returns an iterator for this test suite. + * + * @return ArrayIterator + */ + public function getIterator() { $permutations = [ 'Identifier Quoting' => function() { ConnectionManager::get('test')->driver()->autoQuoting(true); @@ -47,8 +55,12 @@ public static function suite() { } ]; - $suite = new TestPermutationDecorator($suite, $permutations); - return $suite; + $tests = []; + foreach (parent::getIterator() as $test) { + $tests[] = new TestPermutationDecorator($test, $permutations); + } + + return new \ArrayIterator($tests); } }