Browse Source

Adding test for schemaCollection() as a setter

Jose Lorenzo Rodriguez 11 years ago
parent
commit
c205e7c75a
1 changed files with 21 additions and 0 deletions
  1. 21 0
      tests/TestCase/Database/ConnectionTest.php

+ 21 - 0
tests/TestCase/Database/ConnectionTest.php

@@ -812,4 +812,25 @@ class ConnectionTest extends TestCase {
 		});
 	}
 
+/**
+ * Tests it is possible to set a schema collection object
+ *
+ * @return void
+ */
+	public function testSchemaCollection() {
+		$driver = $this->getMockFormDriver();
+		$connection = $this->getMock(
+			'\Cake\Database\Connection',
+			['connect'],
+			[['driver' => $driver]]
+		);
+
+		$schema = $connection->schemaCollection();
+		$this->assertInstanceOf('Cake\Database\Schema\Collection', $schema);
+
+		$schema = $this->getMock('Cake\Database\Schema\Collection', [], [$connection]);
+		$connection->schemaCollection($schema);
+		$this->assertSame($schema, $connection->schemaCollection());
+	}
+
 }