Skip to content

Commit

Permalink
Merge pull request #795 from driehle/feat/deprecate-doctrine-cache-st…
Browse files Browse the repository at this point in the history
…orage-class

Deprecate decorating adapters from doctrine/cache for laminas-cache
  • Loading branch information
driehle authored Dec 9, 2022
2 parents a970728 + 68e3b24 commit 8a9486e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
convertDeprecationsToExceptions="true"
bootstrap="vendor/autoload.php"
colors="true">
<coverage processUncoveredFiles="false">
Expand Down
2 changes: 2 additions & 0 deletions src/Cache/DoctrineCacheStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 4 additions & 6 deletions tests/Cache/DoctrineCacheStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,7 +28,6 @@
/**
* Tests for the cache bridge
*
* @todo extend \ZendTest\Cache\Storage\CommonAdapterTest instead
* @covers \DoctrineModule\Cache\DoctrineCacheStorage
*/
class DoctrineCacheStorageTest extends TestCase
Expand All @@ -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',
Expand All @@ -73,7 +71,7 @@ protected function tearDown(): void
}

ErrorHandler::stop();
$this->fail('ErrorHandler not stopped');
ErrorHandler::clean();
}

public function testOptionNamesValid(): void
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8a9486e

Please sign in to comment.