Skip to content

Commit

Permalink
drop doctrine/cache integration (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher authored Nov 27, 2023
1 parent 499dd4d commit 80db33c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 78 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
},
"require-dev": {
"behat/behat": "^3.0",
"doctrine/cache": "^1.12",
"friendsofphp/php-cs-fixer": "^3.27",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^8.0 || ^9.0 || ^10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace DAMA\DoctrineTestBundle\DependencyInjection;

use DAMA\DoctrineTestBundle\Doctrine\Cache\Psr6StaticArrayCache;
use DAMA\DoctrineTestBundle\Doctrine\Cache\StaticArrayCache;
use DAMA\DoctrineTestBundle\Doctrine\DBAL\Middleware;
use Doctrine\Common\Cache\Cache;
use Psr\Cache\CacheItemPoolInterface;
Expand Down Expand Up @@ -128,8 +127,7 @@ private function registerStaticCache(
$cache->setClass(Psr6StaticArrayCache::class);
$cache->setArgument(0, $namespace); // make sure we have no key collisions
} elseif (is_a($originalCacheServiceDefinition->getClass(), Cache::class, true)) {
$cache->setClass(StaticArrayCache::class);
$cache->addMethodCall('setNamespace', [$namespace]); // make sure we have no key collisions
throw new \InvalidArgumentException(sprintf('Configuring "%s" caches is not supported anymore. Upgrade to PSR-6 caches instead.', Cache::class));
} else {
throw new \InvalidArgumentException(sprintf('Unsupported cache class "%s" found on service "%s".', $originalCacheServiceDefinition->getClass(), $cacheServiceId));
}
Expand Down
53 changes: 0 additions & 53 deletions src/DAMA/DoctrineTestBundle/Doctrine/Cache/StaticArrayCache.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
use DAMA\DoctrineTestBundle\DependencyInjection\DAMADoctrineTestExtension;
use DAMA\DoctrineTestBundle\DependencyInjection\DoctrineTestCompilerPass;
use DAMA\DoctrineTestBundle\Doctrine\Cache\Psr6StaticArrayCache;
use DAMA\DoctrineTestBundle\Doctrine\Cache\StaticArrayCache;
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -215,24 +213,6 @@ function (TestCase $testCase): void {
},
];

yield 'legacy doctrine/cache ORM services' => [
$defaultConfig,
function (ContainerBuilder $containerBuilder): void {
foreach (self::CACHE_SERVICE_IDS as $id) {
self::assertFalse($containerBuilder->hasAlias($id));
self::assertEquals(
(new Definition(StaticArrayCache::class))->addMethodCall('setNamespace', [sha1($id)]),
$containerBuilder->getDefinition($id)
);
}
},
function (self $testCase, ContainerBuilder $containerBuilder): void {
foreach (self::CACHE_SERVICE_IDS as $id) {
$containerBuilder->register($id, ArrayCache::class);
}
},
];

yield 'psr6 ORM cache services' => [
$defaultConfig,
function (ContainerBuilder $containerBuilder): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/app/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ doctrine:

replica:
url: '%database.url%'
server_version: 8.0
server_version: 8.0.31
use_savepoints: true
replicas:
replica_one:
Expand Down

0 comments on commit 80db33c

Please sign in to comment.