1- <?php namespace Quince \Pelastic \Tests \Unit ;
1+ <?php namespace Quince \Pelastic \Tests \Unit \ Queries ;
22
3- use Quince \Pelastic \Exceptions \PelasticInvalidArgumentException ;
43use Quince \Pelastic \Contracts \ArrayableInterface ;
54use Quince \Pelastic \Contracts \Queries \QueryInterface ;
65use Quince \Pelastic \Contracts \Queries \TermQueryInterface ;
6+ use Quince \Pelastic \Exceptions \PelasticInvalidArgumentException ;
77use Quince \Pelastic \Queries \TermQuery ;
8+ use Quince \Pelastic \Tests \Unit \BaseTestCase ;
89
910class TermQueryTest extends BaseTestCase {
1011
11- /**
12- * @var TermQuery
13- */
14- protected $ mainObject ;
12+ /**
13+ * @var TermQuery
14+ */
15+ protected $ mainObject ;
1516
16- public function setUp ()
17- {
18- $ this ->mainObject = new TermQuery ('title ' , 'This is a title ' );
19- parent ::setUp ();
20- }
17+ public function setUp ()
18+ {
19+ $ this ->mainObject = new TermQuery ('title ' , 'This is a title ' );
20+ parent ::setUp ();
21+ }
2122
22- public function test_class_implements_the_needed_interfaces ()
23- {
24- $ needs = [QueryInterface::class, TermQueryInterface::class, ArrayableInterface::class];
23+ public function test_class_implements_the_needed_interfaces ()
24+ {
25+ $ needs = [QueryInterface::class, TermQueryInterface::class, ArrayableInterface::class];
2526
26- foreach ($ needs as $ need ) {
27+ foreach ($ needs as $ need ) {
2728
28- $ this ->assertTrue (is_a ($ this ->mainObject , $ need ));
29+ $ this ->assertTrue (is_a ($ this ->mainObject , $ need ));
2930
30- }
31- }
31+ }
32+ }
3233
33- public function test_final_generated_array_with_and_without_construct ()
34- {
35- $ expected = [
36- 'term ' => [
37- 'title ' => [
38- 'value ' => $ string = 'some query string '
39- ]
40- ]
41- ];
34+ public function test_final_generated_array_with_and_without_construct ()
35+ {
36+ $ expected = [
37+ 'term ' => [
38+ 'title ' => [
39+ 'value ' => $ string = 'some query string '
40+ ]
41+ ]
42+ ];
4243
43- $ this ->mainObject = new TermQuery ();
44+ $ this ->mainObject = new TermQuery ();
4445
45- $ this ->mainObject ->setField ('title ' );
46+ $ this ->mainObject ->setField ('title ' );
4647
47- $ this ->mainObject ->setQuery ($ string );
48+ $ this ->mainObject ->setQuery ($ string );
4849
49- $ this ->assertEquals ($ expected , $ this ->mainObject ->toArray ());
50+ $ this ->assertEquals ($ expected , $ this ->mainObject ->toArray ());
5051
51- $ this ->mainObject ->setQuery ('ss ' );
52+ $ this ->mainObject ->setQuery ('ss ' );
5253
53- $ this ->assertNotEquals ($ expected , $ this ->mainObject ->toArray ());
54+ $ this ->assertNotEquals ($ expected , $ this ->mainObject ->toArray ());
5455
55- $ this ->mainObject ->setValue ($ string );
56+ $ this ->mainObject ->setValue ($ string );
5657
57- $ this ->assertEquals ($ expected , $ this ->mainObject ->toArray ());
58+ $ this ->assertEquals ($ expected , $ this ->mainObject ->toArray ());
5859
59- $ expected ['term ' ]['title ' ]['boost ' ] = 500 ;
60+ $ expected ['term ' ]['title ' ]['boost ' ] = 500 ;
6061
61- $ this ->mainObject ->setBoost (500 );
62+ $ this ->mainObject ->setBoost (500 );
6263
63- $ this ->assertEquals ($ expected , $ this ->mainObject ->toArray ());
64+ $ this ->assertEquals ($ expected , $ this ->mainObject ->toArray ());
6465
65- $ this ->setExpectedException (PelasticInvalidArgumentException::class);
66+ $ this ->setExpectedException (PelasticInvalidArgumentException::class);
6667
67- $ this ->mainObject ->setBoost ('salam ' );
68- }
69- }
68+ $ this ->mainObject ->setBoost ('salam ' );
69+ }
70+ }
0 commit comments