Skip to content

Commit 9f3feb0

Browse files
committed
feat(test): add utility for checking to skip old synonym tests
1 parent 2e837e7 commit 9f3feb0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/TestCase.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Typesense\Client;
77
use Mockery;
88
use Typesense\ApiCall;
9+
use Exception;
910

1011
abstract class TestCase extends BaseTestCase
1112
{
@@ -98,4 +99,25 @@ protected function tearDownTypesense(): void
9899
$this->typesenseClient->collections[$collection['name']]->delete();
99100
}
100101
}
102+
103+
protected function isV30OrAbove(): bool
104+
{
105+
try {
106+
$debug = $this->typesenseClient->debug->retrieve();
107+
$version = $debug['version'];
108+
109+
if ($version === 'nightly') {
110+
return true;
111+
}
112+
113+
if (preg_match('/^v(\d+)/', $version, $matches)) {
114+
$majorVersion = (int) $matches[1];
115+
return $majorVersion >= 30;
116+
}
117+
118+
return false;
119+
} catch (Exception $e) {
120+
return false;
121+
}
122+
}
101123
}

0 commit comments

Comments
 (0)