equal
deleted
inserted
replaced
9 /** |
9 /** |
10 * |
10 * |
11 */ |
11 */ |
12 class LanguageControllerTest extends TestCase { |
12 class LanguageControllerTest extends TestCase { |
13 |
13 |
14 const ES_QUERY = [ |
14 private $ES_QUERY; |
15 'index' => 'corpus', |
15 |
16 'body' => [ |
16 public function setUp() { |
17 "size" => 0, |
17 $this->ES_QUERY = [ |
18 "query" => [ "match_all" => [] ], |
18 'index' => 'corpus', |
19 "aggs" => [ |
19 'body' => [ |
20 "languages" => [ |
20 "size" => 0, |
21 "terms" => [ "field" => "language", "order" => [ "_count" => "desc" ], "size" => 0 ] |
21 "query" => [ "match_all" => (object) null ], |
|
22 "aggs" => [ |
|
23 "languages" => [ |
|
24 "terms" => [ "field" => "language", "order" => [ "_count" => "desc" ], "size" => 2147483647 ] |
|
25 ] |
22 ] |
26 ] |
23 ] |
27 ] |
24 ] |
28 ]; |
25 ]; |
|
26 |
|
27 public function setUp() { |
|
28 parent::setup(); |
29 parent::setup(); |
29 } |
30 } |
30 |
31 |
31 public function tearDown() { |
32 public function tearDown() { |
32 m::close(); |
33 m::close(); |
35 |
36 |
36 public function testIndex() { |
37 public function testIndex() { |
37 |
38 |
38 Es::shouldReceive('search') |
39 Es::shouldReceive('search') |
39 ->once() |
40 ->once() |
40 ->with(self::ES_QUERY) |
41 ->with($this->ES_QUERY) |
41 ->andReturn(json_decode('{ |
42 ->andReturn(json_decode('{ |
42 "took": 92, |
43 "took": 92, |
43 "timed_out": false, |
44 "timed_out": false, |
44 "_shards": { |
45 "_shards": { |
45 "total": 1, |
46 "total": 1, |