diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e54001a..0b3d4d9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,8 @@ jobs: - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: - coverage: "none" + coverage: "xdebug" + extensions: redis php-version: "${{ matrix.php-version }}" - name: "Composer install" @@ -55,4 +56,4 @@ jobs: # Replace `linux` below with the appropriate OS curl -Os https://uploader.codecov.io/latest/linux/codecov chmod +x codecov - ./codecov -t ${CODECOV_TOKEN} \ No newline at end of file + ./codecov -t ${CODECOV_TOKEN} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ffe2dd6..b6b6d2c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,22 +16,14 @@ tests/Unit - - - src/ - - src + - - - - - \ No newline at end of file + diff --git a/src/Business/Redis/RedisManager.php b/src/Business/Redis/RedisManager.php index a71b6d2..0af6791 100644 --- a/src/Business/Redis/RedisManager.php +++ b/src/Business/Redis/RedisManager.php @@ -25,7 +25,7 @@ class RedisManager implements RedisManagerInterface public function __construct( private readonly RedisFactoryInterface $redisFactory, - private readonly RedisPluginConfigurationInterface $redisPluginConfiguration + private readonly RedisPluginConfigurationInterface $redisPluginConfiguration, ) { $this->redisCollection = []; } diff --git a/src/Configuration/RedisClientConfiguration.php b/src/Configuration/RedisClientConfiguration.php index 550fc68..ad62bbe 100644 --- a/src/Configuration/RedisClientConfiguration.php +++ b/src/Configuration/RedisClientConfiguration.php @@ -57,7 +57,7 @@ public function connectionType(): string { $connectionType = $this->get(self::CFG_CONNECTION_TYPE, self::CONNECTION_TYPE_DEFAULT); if (!\in_array($connectionType, $this->getAvailableConnectionTypes(), true)) { - throw new InvalidConfigurationException(sprintf('Configuration key "%s" has invalid value. Redis: connection type %s is not available', $this->cfg(self::CFG_CONNECTION_TYPE), $connectionType)); + throw new InvalidConfigurationException(\sprintf('Configuration key "%s" has invalid value. Redis: connection type %s is not available', $this->cfg(self::CFG_CONNECTION_TYPE), $connectionType)); } return $connectionType; diff --git a/src/RedisPlugin.php b/src/RedisPlugin.php index 38fd2f2..b136fd6 100644 --- a/src/RedisPlugin.php +++ b/src/RedisPlugin.php @@ -32,12 +32,12 @@ class RedisPlugin implements DependencyProviderInterface, ConfigurableInterface public function provideDependencies(Container $container): void { - $container->register(\Micro\Plugin\Redis\Facade\RedisFacadeInterface::class, function (): Facade\RedisFacadeInterface { + $container->register(Facade\RedisFacadeInterface::class, function (): Facade\RedisFacadeInterface { return $this->createRedisFacade(); }); - $container->register(RedisFacadeInterface::class, function (Container $container) { // Deprecation support - return $container->get(\Micro\Plugin\Redis\Facade\RedisFacadeInterface::class); + $container->register(RedisFacadeInterface::class, static function () use ($container): Facade\RedisFacadeInterface { // Deprecation support + return $container->get(Facade\RedisFacadeInterface::class); }); } diff --git a/tests/Unit/Business/Redis/RedisManagerTest.php b/tests/Unit/Business/Redis/RedisManagerTest.php index b210930..c8eeb54 100644 --- a/tests/Unit/Business/Redis/RedisManagerTest.php +++ b/tests/Unit/Business/Redis/RedisManagerTest.php @@ -20,7 +20,7 @@ class RedisManagerTest extends TestCase { - public function testGetClient() + public function testGetClient(): void { $factory = $this->createMock(RedisFactoryInterface::class); $cfg = $this->createMock(RedisPluginConfigurationInterface::class); diff --git a/tests/Unit/Facade/RedisFacadeTest.php b/tests/Unit/Facade/RedisFacadeTest.php index 0206106..c6f4a55 100644 --- a/tests/Unit/Facade/RedisFacadeTest.php +++ b/tests/Unit/Facade/RedisFacadeTest.php @@ -19,7 +19,7 @@ class RedisFacadeTest extends TestCase { - public function testGetClient() + public function testGetClient(): void { $manager = $this->createMock(RedisManagerInterface::class); $manager->expects($this->once())->method('getClient')->with('test'); diff --git a/tests/Unit/RedisPluginTest.php b/tests/Unit/RedisPluginTest.php index 3708117..8dfbaeb 100644 --- a/tests/Unit/RedisPluginTest.php +++ b/tests/Unit/RedisPluginTest.php @@ -20,7 +20,7 @@ class RedisPluginTest extends TestCase { - public function testPlugin() + public function testPlugin(): void { $kernel = new AppKernel( [], @@ -31,12 +31,13 @@ public function testPlugin() $kernel->run(); - $this->expectException(\RedisException::class); - $this->expectExceptionMessage('Connection refused'); $facade = $kernel->container()->get(RedisFacadeInterface::class); $facadeDeprecated = $kernel->container()->get(\Micro\Plugin\Redis\RedisFacadeInterface::class); - $this->assertEquals($facade, $facadeDeprecated); + $this->assertSame($facade, $facadeDeprecated); + + $this->expectException(\RedisException::class); + $this->expectExceptionMessage('Connection refused'); $kernel->container()->get(RedisFacadeInterface::class)->getClient(); }