Browse Source

Fixing the DatabaseSuite file for phpunit 4.0

Jose Lorenzo Rodriguez 12 years ago
parent
commit
1eaf49ec74
1 changed files with 15 additions and 3 deletions
  1. 15 3
      tests/TestCase/DatabaseSuite.php

+ 15 - 3
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 @@ class DatabaseSuite extends TestSuite {
 			}
 		];
 
-		$suite = new TestPermutationDecorator($suite, $permutations);
-		return $suite;
+		$tests = [];
+		foreach (parent::getIterator() as $test) {
+			$tests[] = new TestPermutationDecorator($test, $permutations);
+		}
+
+		return new \ArrayIterator($tests);
 	}
 
 }