From b9ed8873c5be8b9fb455fd5ac2421c88cc819400 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Fri, 27 Apr 2018 10:22:25 +0900 Subject: [PATCH] replace deprecated method https://travis-ci.org/ray-di/Ray.CakeDbModule/jobs/370542133 --- tests/CakeDbModuleTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/CakeDbModuleTest.php b/tests/CakeDbModuleTest.php index 0ed78ef..c66e71f 100644 --- a/tests/CakeDbModuleTest.php +++ b/tests/CakeDbModuleTest.php @@ -2,6 +2,7 @@ namespace Ray\CakeDbModule; +use Cake\Database\Connection; use Cake\Datasource\ConnectionManager; use Ray\Di\Injector; @@ -14,7 +15,7 @@ public function testModule() ->getInstance('Cake\Database\Connection'); $this->assertInstanceOf('Cake\Database\Connection', $instance); - $this->assertInstanceOf('Cake\Database\Driver\Sqlite', $instance->driver()); + $this->assertInstanceOf('Cake\Database\Driver\Sqlite', $instance->getDriver()); } public function testWithDsn() @@ -28,15 +29,17 @@ public function testWithDsn() public function testWithPreMadeConnection() { - ConnectionManager::config('default', [ + ConnectionManager::setConfig('default', [ 'className' => 'Cake\Database\Connection', 'driver' => 'Cake\Database\Driver\Sqlite' ]); $module = new CakeDbModule('default'); + /** @var Connection $instance */ $instance = (new Injector($module, $_ENV['TMP_DIR'])) ->getInstance('Cake\Database\Connection'); - - $this->assertSame(ConnectionManager::get('default'), $instance); + $expected = ConnectionManager::getConfig('default'); + $actual = $instance->config(); + $this->assertSame($expected['driver'], $actual['driver']); } public function testTransactional()