diff --git a/src/Db/Adapter/PdoAdapter.php b/src/Db/Adapter/PdoAdapter.php index eab82677..55570ef8 100644 --- a/src/Db/Adapter/PdoAdapter.php +++ b/src/Db/Adapter/PdoAdapter.php @@ -176,6 +176,16 @@ public function getConnection(): Connection return $this->connection; } + /** + * Backwards compatibility shim for migrations 3.x + * + * @return \Cake\Database\Connection + */ + public function getDecoratedConnection(): Connection + { + return $this->getConnection(); + } + /** * @inheritDoc */ diff --git a/tests/TestCase/Db/Adapter/SqliteAdapterTest.php b/tests/TestCase/Db/Adapter/SqliteAdapterTest.php index 593c1d49..36e78af1 100644 --- a/tests/TestCase/Db/Adapter/SqliteAdapterTest.php +++ b/tests/TestCase/Db/Adapter/SqliteAdapterTest.php @@ -78,9 +78,11 @@ protected function tearDown(): void unset($this->adapter, $this->out, $this->io); } - public function testConnection() + public function testGetConnection() { - $this->assertInstanceOf(Connection::class, $this->adapter->getConnection()); + $connection = $this->adapter->getConnection(); + $this->assertInstanceOf(Connection::class, $connection); + $this->assertSame($connection, $this->adapter->getDecoratedConnection()); } public function testBeginTransaction()