Browse Source

Altering the all tests suite so it runs all database tests with the
permutations decorator, fixing some tests that were poluting th
eenvironment and breaking the run when repeated

Jose Lorenzo Rodriguez 12 years ago
parent
commit
9734bdefc8

+ 4 - 1
Cake/Test/TestCase/ORM/TableRegistryTest.php

@@ -136,7 +136,10 @@ class TableRegistryTest extends TestCase {
 			->method('defaultConnectionName')
 			->will($this->returnValue('test'));
 
-		class_alias($class, 'MyPlugin\Model\Repository\SuperTestTable');
+		if (!class_exists('MyPlugin\Model\Repository\SuperTestTable')) {
+			class_alias($class, 'MyPlugin\Model\Repository\SuperTestTable');
+		}
+
 		$table = TableRegistry::get('MyPlugin.SuperTest');
 		$this->assertInstanceOf($class, $table);
 	}

+ 10 - 2
Cake/Test/TestCase/ORM/TableTest.php

@@ -793,7 +793,11 @@ class TableTest extends \Cake\TestSuite\TestCase {
  */
 	public function testRepositoryClassInAPP() {
 		$class = $this->getMockClass('\Cake\ORM\Entity');
-		class_alias($class, 'TestApp\Model\Entity\TestUser');
+
+		if (!class_exists('TestApp\Model\Entity\TestUser')) {
+			class_alias($class, 'TestApp\Model\Entity\TestUser');
+		}
+
 		$table = new Table();
 		$this->assertEquals('TestApp\Model\Entity\TestUser', $table->entityClass('TestUser'));
 	}
@@ -806,7 +810,11 @@ class TableTest extends \Cake\TestSuite\TestCase {
  */
 	public function testRepositoryClassInPlugin() {
 		$class = $this->getMockClass('\Cake\ORM\Entity');
-		class_alias($class, 'MyPlugin\Model\Entity\SuperUser');
+
+		if (!class_exists('MyPlugin\Model\Entity\SuperUser')) {
+			class_alias($class, 'MyPlugin\Model\Entity\SuperUser');
+		}
+		
 		$table = new Table();
 		$this->assertEquals(
 			'MyPlugin\Model\Entity\SuperUser',

+ 3 - 0
phpunit.xml.dist

@@ -15,7 +15,10 @@
 	<testsuites>
 		<testsuite name="CakePHP Test Suite">
 			<directory>./Cake/Test/TestCase/</directory>
+			<exclude>./Cake/Test/TestCase/Database/</exclude>
 			<exclude>./Cake/Test/TestCase/Model/</exclude>
+			<exclude>./Cake/Test/TestCase/ORM/</exclude>
+			<file>./Cake/Test/TestCase/DatabaseSuite.php</file>
 		</testsuite>
 	</testsuites>
 	<listeners>