diff --git a/tests/ClickHouseVersion.php b/tests/ClickHouseVersion.php index 87ccfcb..2da7181 100644 --- a/tests/ClickHouseVersion.php +++ b/tests/ClickHouseVersion.php @@ -6,9 +6,8 @@ use RuntimeException; -use function assert; use function explode; -use function is_string; +use function getenv; use function sprintf; use function str_pad; use function strpos; @@ -24,8 +23,10 @@ /** @throws RuntimeException */ public static function get(): int { - $versionString = $_ENV[self::EnvName] ?? '23.12'; - assert(is_string($versionString)); + $versionString = getenv(self::EnvName); + if ($versionString === false) { + $versionString = '23.12'; + } if (strpos($versionString, '.') === false) { throw new RuntimeException(sprintf('Specify also a ClickHouse minor version. "%s" given.', $versionString)); diff --git a/tests/Param/ParamValueConverterRegistryTest.php b/tests/Param/ParamValueConverterRegistryTest.php index 1c404f5..ff2ed6b 100644 --- a/tests/Param/ParamValueConverterRegistryTest.php +++ b/tests/Param/ParamValueConverterRegistryTest.php @@ -158,11 +158,14 @@ public static function providerConvert(): Generator yield 'UUID' => ['UUID', 'de90cd12-7100-436e-bfb8-f77e4c7a224f', 'de90cd12-7100-436e-bfb8-f77e4c7a224f']; yield 'Array IPv4' => ['Array(IPv4)', ['192.0.2.1', '198.51.100.1'], "['192.0.2.1','198.51.100.1']"]; - yield 'Array IPv6' => [ - 'Array(IPv6)', - ['::ffff:192.0.2.1', '2001:db8::1'], - "['::ffff:192.0.2.1','2001:db8::1']", - ]; + + if (ClickHouseVersion::get() >= self::VersionIntervalJson) { + yield 'Array IPv6' => [ + 'Array(IPv6)', + ['::ffff:192.0.2.1', '2001:db8::1'], + "['::ffff:192.0.2.1','2001:db8::1']", + ]; + } yield 'Date' => ['Date', '2023-02-01', '2023-02-01']; yield 'Date (datetime)' => ['Date', new DateTimeImmutable('2023-02-01'), '2023-02-01'];