From c205e7c75a9a8f35e7d9dc97e27b3c493915dca7 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Mon, 29 Sep 2014 22:35:29 +0200 Subject: [PATCH] Adding test for schemaCollection() as a setter --- tests/TestCase/Database/ConnectionTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/TestCase/Database/ConnectionTest.php b/tests/TestCase/Database/ConnectionTest.php index 5f6b6671eb2..19b449be1fa 100644 --- a/tests/TestCase/Database/ConnectionTest.php +++ b/tests/TestCase/Database/ConnectionTest.php @@ -812,4 +812,25 @@ public function testTransactionalWithException() { }); } +/** + * 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()); + } + }