From 68e3b24b17faee35a2a1f8fca951b8653e40aa80 Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Fri, 9 Dec 2022 15:00:29 +0100 Subject: [PATCH] deprecate decorating adapters from doctrine/cache for laminas-cache --- composer.json | 2 +- phpunit.xml.dist | 1 + src/Cache/DoctrineCacheStorage.php | 2 ++ tests/Cache/DoctrineCacheStorageTest.php | 10 ++++------ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 9b78005c..ce6303d9 100644 --- a/composer.json +++ b/composer.json @@ -70,7 +70,7 @@ "laminas/laminas-session": "^2.13.0", "phpstan/phpstan": "^1.9.2", "phpstan/phpstan-phpunit": "^1.3.0", - "phpunit/phpunit": "^9.5.26", + "phpunit/phpunit": "^9.5.27", "predis/predis": "^1.1.10", "vimeo/psalm": "^4.30.0" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dcf63aab..5835e874 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,7 @@ diff --git a/src/Cache/DoctrineCacheStorage.php b/src/Cache/DoctrineCacheStorage.php index f425f033..f1bde553 100644 --- a/src/Cache/DoctrineCacheStorage.php +++ b/src/Cache/DoctrineCacheStorage.php @@ -10,6 +10,8 @@ /** * Bridge class that allows usage of a Doctrine Cache Storage as a Laminas Cache Storage + * + * @deprecated 5.3.0 Usage of cache adapters from doctrine/cache is deprecated, please switch to laminas-cache. */ class DoctrineCacheStorage extends AbstractAdapter { diff --git a/tests/Cache/DoctrineCacheStorageTest.php b/tests/Cache/DoctrineCacheStorageTest.php index 8415f99b..11977342 100644 --- a/tests/Cache/DoctrineCacheStorageTest.php +++ b/tests/Cache/DoctrineCacheStorageTest.php @@ -4,7 +4,7 @@ namespace DoctrineModuleTest\Cache; -use Doctrine\Common\Cache\ArrayCache; +use Doctrine\Common\Cache\ArrayCache as DoctrineArrayCache; use DoctrineModule\Cache\DoctrineCacheStorage; use Laminas\Cache\Storage\Adapter\AdapterOptions; use Laminas\Cache\Storage\StorageInterface; @@ -28,7 +28,6 @@ /** * Tests for the cache bridge * - * @todo extend \ZendTest\Cache\Storage\CommonAdapterTest instead * @covers \DoctrineModule\Cache\DoctrineCacheStorage */ class DoctrineCacheStorageTest extends TestCase @@ -50,8 +49,7 @@ class DoctrineCacheStorageTest extends TestCase protected function setUp(): void { $this->options = new AdapterOptions(); - // @todo fix constructor as it is messy - $this->storage = new DoctrineCacheStorage($this->options, new ArrayCache()); + $this->storage = new DoctrineCacheStorage($this->options, new DoctrineArrayCache()); $this->assertInstanceOf( 'Laminas\Cache\Storage\StorageInterface', @@ -73,7 +71,7 @@ protected function tearDown(): void } ErrorHandler::stop(); - $this->fail('ErrorHandler not stopped'); + ErrorHandler::clean(); } public function testOptionNamesValid(): void @@ -729,7 +727,7 @@ public function testSetItemAndSetItemsCallSaveWithTtl(): void { $ttl = rand(); - $provider = $this->createMock('Doctrine\Common\Cache\ArrayCache'); + $provider = $this->createMock(DoctrineArrayCache::class); $provider->expects($this->exactly(4)) ->method('save') ->with($this->anything(), $this->anything(), $ttl);