From 8f0ac0492d3c2ed81ec70497bd0346d1b68d88a9 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Mon, 2 May 2022 15:50:38 +0200 Subject: [PATCH] Replace deprecated method `DbConnection::getConnection()` with `DbConnection::getDbAdapter()` --- library/Icinga/Test/BaseTestCase.php | 4 ++-- .../library/Icinga/Test/BaseTestCaseTest.php | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/library/Icinga/Test/BaseTestCase.php b/library/Icinga/Test/BaseTestCase.php index 4509315ec..6702df02f 100644 --- a/library/Icinga/Test/BaseTestCase.php +++ b/library/Icinga/Test/BaseTestCase.php @@ -305,7 +305,7 @@ namespace Icinga\Test { ); } - $resource->getConnection()->exec($sqlData); + $resource->getDbAdapter()->exec($sqlData); } /** @@ -324,7 +324,7 @@ namespace Icinga\Test { return; } - $adapter = $resource->getConnection(); + $adapter = $resource->getDbAdapter(); try { $adapter->getConnection(); diff --git a/test/php/library/Icinga/Test/BaseTestCaseTest.php b/test/php/library/Icinga/Test/BaseTestCaseTest.php index 5c06ad966..92a8d2f77 100644 --- a/test/php/library/Icinga/Test/BaseTestCaseTest.php +++ b/test/php/library/Icinga/Test/BaseTestCaseTest.php @@ -25,7 +25,7 @@ class BaseTestCaseTest extends BaseTestCase public function testWhetherMySqlProviderAnnotationSetsUpZendDbAdapter($resource) { $this->setupDbProvider($resource); - $this->assertInstanceOf('Zend_Db_Adapter_Pdo_Mysql', $resource->getConnection()); + $this->assertInstanceOf('Zend_Db_Adapter_Pdo_Mysql', $resource->getDbAdapter()); } /** @@ -43,7 +43,7 @@ class BaseTestCaseTest extends BaseTestCase public function testWhetherCreatingTablesWithMySqlAdapterWorks($resource) { $this->setupDbProvider($resource); - $adapter = $resource->getConnection(); + $adapter = $resource->getDbAdapter(); $adapter->exec('CREATE TABLE test(uid INT NOT NULL PRIMARY KEY);'); $tables = $adapter->listTables(); @@ -58,7 +58,7 @@ class BaseTestCaseTest extends BaseTestCase { $this->setupDbProvider($resource); - $tables = $resource->getConnection()->listTables(); + $tables = $resource->getDbAdapter()->listTables(); $this->assertCount(0, $tables); } @@ -68,7 +68,7 @@ class BaseTestCaseTest extends BaseTestCase public function testWhetherPgSqlProviderAnnotationSetsUpZendDbAdapter($resource) { $this->setupDbProvider($resource); - $this->assertInstanceOf('Zend_Db_Adapter_Pdo_Pgsql', $resource->getConnection()); + $this->assertInstanceOf('Zend_Db_Adapter_Pdo_Pgsql', $resource->getDbAdapter()); } /** @@ -86,7 +86,7 @@ class BaseTestCaseTest extends BaseTestCase public function testWhetherCreatingTablesWithPgSqlAdapterWorks($resource) { $this->setupDbProvider($resource); - $adapter = $resource->getConnection(); + $adapter = $resource->getDbAdapter(); $adapter->exec('CREATE TABLE test(uid INT NOT NULL PRIMARY KEY);'); $tables = $adapter->listTables(); @@ -101,7 +101,7 @@ class BaseTestCaseTest extends BaseTestCase { $this->setupDbProvider($resource); - $tables = $resource->getConnection()->listTables(); + $tables = $resource->getDbAdapter()->listTables(); $this->assertCount(0, $tables); } @@ -111,7 +111,7 @@ class BaseTestCaseTest extends BaseTestCase public function testWhetherOciProviderAnnotationSetsUpZendDbAdapter($resource) { $this->setupDbProvider($resource); - $this->assertInstanceOf('Zend_Db_Adapter_Pdo_Oci', $resource->getConnection()); + $this->assertInstanceOf('Zend_Db_Adapter_Pdo_Oci', $resource->getDbAdapter()); } /** @@ -129,7 +129,7 @@ class BaseTestCaseTest extends BaseTestCase public function testWhetherCreatingTablesWithOciAdapterWorks($resource) { $this->setupDbProvider($resource); - $adapter = $resource->getConnection(); + $adapter = $resource->getDbAdapter(); $adapter->exec('CREATE TABLE test(uid INT NOT NULL PRIMARY KEY);'); $tables = $adapter->listTables(); @@ -144,7 +144,7 @@ class BaseTestCaseTest extends BaseTestCase { $this->setupDbProvider($resource); - $tables = $resource->getConnection()->listTables(); + $tables = $resource->getDbAdapter()->listTables(); $this->assertCount(0, $tables); } @@ -176,7 +176,7 @@ class BaseTestCaseTest extends BaseTestCase $this->loadSql($resource, $tempFile); - $count = (int) $resource->getConnection()->fetchOne('SELECT COUNT(*) as cntX from dummyData;'); + $count = (int) $resource->getDbAdapter()->fetchOne('SELECT COUNT(*) as cntX from dummyData;'); $this->assertSame(20, $count); $this->assertTrue(unlink($tempFile));