@@ -14,13 +14,12 @@ class CzechDictionary extends \Tester\TestCase
1414
1515 public function testCreate () : void
1616 {
17+ $ settings = new \Spameri \ElasticQuery \Mapping \Settings (self ::INDEX );
18+ $ settings ->addAnalyzer (new \Spameri \ElasticQuery \Mapping \Analyzer \Custom \CzechDictionary ());
1719 $ document = new \Spameri \ElasticQuery \Document (
1820 self ::INDEX ,
19- new \Spameri \ElasticQuery \Document \Body \Settings (
20- new \Spameri \ElasticQuery \Mapping \Settings \Analysis \AnalyzerCollection (
21- new \Spameri \ElasticQuery \Mapping \Analyzer \Custom \CzechDictionary ()
22- ),
23- new \Spameri \ElasticQuery \Mapping \Settings \Analysis \FilterCollection ()
21+ new \Spameri \ElasticQuery \Document \Body \Plain (
22+ $ settings ->toArray ()
2423 )
2524 );
2625
@@ -36,10 +35,7 @@ class CzechDictionary extends \Tester\TestCase
3635 \json_encode ($ document ->toArray ()['body ' ])
3736 );
3837
39- $ response = curl_exec ($ ch );
40-
41- // \var_dump($response);
42-
38+ curl_exec ($ ch );
4339
4440 // Fetch settings and test if analyzer is configured
4541
@@ -49,17 +45,15 @@ class CzechDictionary extends \Tester\TestCase
4945
5046 $ responseSettings = \json_decode (curl_exec ($ ch ), TRUE );
5147
52- \var_dump ($ responseSettings );
53-
5448 \Tester \Assert::true (isset (
5549 $ responseSettings [self ::INDEX ]['settings ' ]['index ' ]['analysis ' ]['analyzer ' ]['czechDictionary ' ]
5650 ));
5751 \Tester \Assert::same (
58- 'removeDuplicities ' ,
59- $ responseSettings [self ::INDEX ]['settings ' ]['index ' ]['analysis ' ]['analyzer ' ]['czechDictionary ' ][2 ]
52+ 'dictionary_CZ ' ,
53+ $ responseSettings [self ::INDEX ]['settings ' ]['index ' ]['analysis ' ]['analyzer ' ]['czechDictionary ' ][' filter ' ][ 2 ]
6054 );
6155 \Tester \Assert::same (
62- 'standard ' ,
56+ 'custom ' ,
6357 $ responseSettings [self ::INDEX ]['settings ' ]['index ' ]['analysis ' ]['analyzer ' ]['czechDictionary ' ]['type ' ]
6458 );
6559
@@ -81,17 +75,15 @@ class CzechDictionary extends \Tester\TestCase
8175
8276 protected function tearDown (): void
8377 {
84- $ ch = curl_init ();
85- curl_setopt ($ ch , CURLOPT_URL , 'localhost:9200/ ' . self ::INDEX );
86- curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , 1 );
87- curl_setopt ($ ch , CURLOPT_CUSTOMREQUEST , 'DELETE ' );
88- curl_setopt ($ ch , CURLOPT_HTTPHEADER , ['Content-Type: application/json ' ]);
78+ $ ch = \ curl_init ();
79+ \ curl_setopt ($ ch , CURLOPT_URL , 'localhost:9200/ ' . self ::INDEX );
80+ \ curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , 1 );
81+ \ curl_setopt ($ ch , CURLOPT_CUSTOMREQUEST , 'DELETE ' );
82+ \ curl_setopt ($ ch , CURLOPT_HTTPHEADER , ['Content-Type: application/json ' ]);
8983
90- $ response = curl_exec ($ ch );
84+ \ curl_exec ($ ch );
9185
92- // \var_dump($response);
93-
94- curl_close ($ ch );
86+ \curl_close ($ ch );
9587 }
9688
9789}
0 commit comments