diff --git a/composer.json b/composer.json index 62428dd1..af5e9337 100644 --- a/composer.json +++ b/composer.json @@ -37,8 +37,8 @@ "homepage": "http://www.doctrine-project.org/", "require": { "php": "~8.1.0 || ~8.2.0 || ~8.3.0", - "composer-runtime-api": "^2.0", - "composer/semver": "^3.0", + "composer-runtime-api": "^2.0.0", + "composer/semver": "^3.0.0", "doctrine/annotations": "^2.0.0", "doctrine/cache": "^2.1.0", "doctrine/collections": "^2.0.0", @@ -52,7 +52,6 @@ "laminas/laminas-cache-storage-adapter-memory": "^2.1.0", "laminas/laminas-eventmanager": "^3.5.0", "laminas/laminas-form": "^3.4.1", - "laminas/laminas-modulemanager": "^2.12.0", "laminas/laminas-mvc": "^3.3.5", "laminas/laminas-paginator": "^2.13.0", "laminas/laminas-servicemanager": "^3.17.0", @@ -65,16 +64,13 @@ "doctrine/coding-standard": "^12.0.0", "doctrine/mongodb-odm": "^2.7.1", "doctrine/orm": "^2.20.1", - "jangregor/phpstan-prophecy": "^2", - "laminas/laminas-i18n": "^2.29.0", - "laminas/laminas-log": "^2.17.1", - "laminas/laminas-serializer": "^2.17.0", + "jangregor/phpstan-prophecy": "^2.0.0", + "laminas/laminas-modulemanager": "^2.12.0", "laminas/laminas-session": "^2.22.1", "phpdocumentor/guides-cli": "^1.5.0", "phpstan/phpstan": "^2.0.4", "phpstan/phpstan-phpunit": "^2.0.3", - "phpunit/phpunit": "^10.5.40", - "predis/predis": "^1.1.10" + "phpunit/phpunit": "^10.5.40" }, "conflict": { "doctrine/orm": "2.12.0" diff --git a/src/Module.php b/src/Module.php index a8309c3d..9695e88d 100644 --- a/src/Module.php +++ b/src/Module.php @@ -4,12 +4,10 @@ namespace DoctrineModule; -use Laminas\ModuleManager\Feature\ConfigProviderInterface; - /** * Base module for integration of Doctrine projects with Laminas applications */ -final class Module implements ConfigProviderInterface +final class Module { /** @return array */ public function getConfig(): array diff --git a/tests/Service/CacheFactoryTest.php b/tests/Service/CacheFactoryTest.php index 65897e0d..176c9515 100644 --- a/tests/Service/CacheFactoryTest.php +++ b/tests/Service/CacheFactoryTest.php @@ -4,56 +4,18 @@ namespace DoctrineModuleTest\Service; -use Composer\InstalledVersions; -use Composer\Semver\VersionParser; -use Doctrine\Common\Cache\ArrayCache; -use Doctrine\Common\Cache\ChainCache; -use Doctrine\Common\Cache\PredisCache; use DoctrineModule\Cache\LaminasStorageCache; use DoctrineModule\Service\CacheFactory; use Laminas\Cache\ConfigProvider; use Laminas\Cache\Storage\Adapter\Memory; use Laminas\ServiceManager\ServiceManager; use PHPUnit\Framework\TestCase as BaseTestCase; -use Predis\ClientInterface; - -use function assert; /** * Test for {@see \DoctrineModule\Service\CacheFactory} */ class CacheFactoryTest extends BaseTestCase { - /** @covers \DoctrineModule\Service\CacheFactory::__invoke */ - public function testWillSetNamespace(): void - { - if (! InstalledVersions::satisfies(new VersionParser(), 'doctrine/cache', '^1.0.0')) { - $this->markTestSkipped('This test requires doctrine/cache:^1.0, which is not installed.'); - } - - $factory = new CacheFactory('foo'); - $serviceManager = new ServiceManager(); - $serviceManager->setService( - 'config', - [ - 'doctrine' => [ - 'cache' => [ - 'foo' => [ - 'class' => ArrayCache::class, - 'namespace' => 'bar', - ], - ], - ], - ], - ); - - $service = $factory->__invoke($serviceManager, ArrayCache::class); - assert($service instanceof ArrayCache); - - $this->assertInstanceOf(ArrayCache::class, $service); - $this->assertSame('bar', $service->getNamespace()); - } - /** * @covers \DoctrineModule\Service\CacheFactory::__invoke * @group 547 @@ -85,65 +47,4 @@ public function testCreateLaminasCache(): void $this->assertInstanceOf(LaminasStorageCache::class, $cache); } - - public function testCreatePredisCache(): void - { - if (! InstalledVersions::satisfies(new VersionParser(), 'doctrine/cache', '^1.0.0')) { - $this->markTestSkipped('This test requires doctrine/cache:^1.0, which is not installed.'); - } - - $factory = new CacheFactory('predis'); - $serviceManager = new ServiceManager(); - $serviceManager->setService( - 'config', - [ - 'doctrine' => [ - 'cache' => [ - 'predis' => [ - 'class' => PredisCache::class, - 'instance' => 'my_predis_alias', - 'namespace' => 'DoctrineModule', - ], - ], - ], - ], - ); - $serviceManager->setService( - 'my_predis_alias', - $this->createMock(ClientInterface::class), - ); - $cache = $factory->__invoke($serviceManager, PredisCache::class); - - $this->assertInstanceOf(PredisCache::class, $cache); - } - - public function testUseServiceFactory(): void - { - if (! InstalledVersions::satisfies(new VersionParser(), 'doctrine/cache', '^1.0.0')) { - $this->markTestSkipped('This test requires doctrine/cache:^1.0, which is not installed.'); - } - - $factory = new CacheFactory('chain'); - $serviceManager = new ServiceManager(); - $serviceManager->setService( - 'config', - [ - 'doctrine' => [ - 'cache' => [ - 'chain' => [ - 'class' => ChainCache::class, - ], - ], - ], - ], - ); - - $mock = $this->createMock(ChainCache::class); - - $serviceManager->setFactory(ChainCache::class, static fn () => $mock); - - $cache = $factory->__invoke($serviceManager, ChainCache::class); - - $this->assertSame($mock, $cache); - } }