Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop doctrine/cache integration #268

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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