File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed
Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change 33namespace Feature ;
44
55use Tests \TestCase ;
6+ use Exception ;
67
78class AnalyticsEventsTest extends TestCase
89{
@@ -11,6 +12,11 @@ class AnalyticsEventsTest extends TestCase
1112 protected function setUp (): void
1213 {
1314 parent ::setUp ();
15+
16+ if ($ this ->isV30OrAbove ()) {
17+ $ this ->markTestSkipped ('Analytics is deprecated in Typesense v30+ ' );
18+ }
19+
1420 $ this ->client ()->collections ->create ([
1521 "name " => "products " ,
1622 "fields " => [
@@ -52,7 +58,13 @@ protected function setUp(): void
5258 protected function tearDown (): void
5359 {
5460 parent ::tearDown ();
55- $ this ->client ()->analytics ->rules ()->{'product_queries_aggregation ' }->delete ();
61+
62+ if (!$ this ->isV30OrAbove ()) {
63+ try {
64+ $ this ->client ()->analytics ->rules ()->{'product_queries_aggregation ' }->delete ();
65+ } catch (Exception $ e ) {
66+ }
67+ }
5668 }
5769
5870 public function testCanCreateAnEvent (): void
Original file line number Diff line number Diff line change 44
55use Tests \TestCase ;
66use Typesense \Exceptions \ObjectNotFound ;
7+ use Exception ;
78
89class AnalyticsRulesTest extends TestCase
910{
@@ -26,14 +27,26 @@ class AnalyticsRulesTest extends TestCase
2627 protected function setUp (): void
2728 {
2829 parent ::setUp ();
30+
31+ if ($ this ->isV30OrAbove ()) {
32+ $ this ->markTestSkipped ('Analytics is deprecated in Typesense v30+ ' );
33+ }
34+
2935 $ this ->ruleUpsertResponse = $ this ->client ()->analytics ->rules ()->upsert ($ this ->ruleName , $ this ->ruleConfiguration );
3036 }
3137
3238 protected function tearDown (): void
3339 {
34- $ rules = $ this ->client ()->analytics ->rules ()->retrieve ();
35- foreach ($ rules ['rules ' ] as $ rule ) {
36- $ this ->client ()->analytics ->rules ()->{$ rule ['name ' ]}->delete ();
40+ if (!$ this ->isV30OrAbove ()) {
41+ try {
42+ $ rules = $ this ->client ()->analytics ->rules ()->retrieve ();
43+ if (is_array ($ rules ) && isset ($ rules ['rules ' ])) {
44+ foreach ($ rules ['rules ' ] as $ rule ) {
45+ $ this ->client ()->analytics ->rules ()->{$ rule ['name ' ]}->delete ();
46+ }
47+ }
48+ } catch (Exception $ e ) {
49+ }
3750 }
3851 }
3952
Original file line number Diff line number Diff line change @@ -17,6 +17,11 @@ class SynonymsTest extends TestCase
1717 protected function setUp (): void
1818 {
1919 parent ::setUp ();
20+
21+ if ($ this ->isV30OrAbove ()) {
22+ $ this ->markTestSkipped ('Synonyms is deprecated in Typesense v30+, use SynonymSets instead ' );
23+ }
24+
2025 $ this ->setUpCollection ('books ' );
2126
2227 $ this ->synonyms = $ this ->client ()->collections ['books ' ]->synonyms ;
You can’t perform that action at this time.
0 commit comments