diff --git a/src/Provider/Doctrine/Persistence/Helper/PlatformHelper.php b/src/Provider/Doctrine/Persistence/Helper/PlatformHelper.php index 29f99d9..22d91bc 100644 --- a/src/Provider/Doctrine/Persistence/Helper/PlatformHelper.php +++ b/src/Provider/Doctrine/Persistence/Helper/PlatformHelper.php @@ -76,7 +76,7 @@ public static function isJsonSupported(Connection $connection): bool return true; } - return version_compare(self::getMariaDbMysqlVersionNumber($version), '10.2.7', '<'); + return version_compare(self::getMariaDbMysqlVersionNumber($version), '10.2.7', '>='); } return true; diff --git a/tests/Provider/Doctrine/Persistence/Helper/PlatformHelperTest.php b/tests/Provider/Doctrine/Persistence/Helper/PlatformHelperTest.php new file mode 100644 index 0000000..d564189 --- /dev/null +++ b/tests/Provider/Doctrine/Persistence/Helper/PlatformHelperTest.php @@ -0,0 +1,45 @@ +createMock(Connection::class); + $connection->method('getDatabasePlatform') + ->willReturn(new MariaDBPlatform()) + ; + $connection->method('getServerVersion') + ->willReturn($mariaDbVersion) + ; + + $this->assertSame($expectedResult, PlatformHelper::isJsonSupported($connection)); + } + + /** + * @return iterable> + */ + public static function provideMariaDbVersionCases(): iterable + { + yield '10.2.6' => ['10.2.6', false]; + + yield '10.2.7' => ['10.2.7', true]; + + yield '10.11.8-MariaDB-0ubuntu0.24.04.1' => ['10.11.8-MariaDB-0ubuntu0.24.04.1', true]; + } +}