diff -r cf0f23803a53 -r 2dba812c7ef2 server/src/tests/Controllers/DateStatsControllerTest.php --- a/server/src/tests/Controllers/DateStatsControllerTest.php Wed Nov 09 15:05:41 2016 +0100 +++ b/server/src/tests/Controllers/DateStatsControllerTest.php Wed Nov 09 23:41:15 2016 +0100 @@ -6,29 +6,34 @@ class DateStatsControllerTest extends TestCase { - const ES_QUERY = [ - 'index' => 'corpus', - 'body' => [ - "size" => 0, - "query" => [ "match_all" => [] ], - "aggs" => [ - "datestats" => [ - "nested"=> [ - "path" => "creation_years" - ], - "aggs" => [ - "years" => [ - "terms"=> [ - "field" => "creation_years.year", - "size" => 0, - "order" => [ - "_term" => "asc" - ] - ], - "aggs" => [ - "year_count" => [ - "sum" => [ - "field" => "creation_years.weight" + private $ES_QUERY; + + public function setUp() { + parent::setup(); + $this->ES_QUERY = [ + 'index' => 'corpus', + 'body' => [ + "size" => 0, + "query" => [ "match_all" => (object) null ], + "aggs" => [ + "datestats" => [ + "nested"=> [ + "path" => "creation_years" + ], + "aggs" => [ + "years" => [ + "terms"=> [ + "field" => "creation_years.year", + "size" => 2147483647, + "order" => [ + "_term" => "asc" + ] + ], + "aggs" => [ + "year_count" => [ + "sum" => [ + "field" => "creation_years.weight" + ] ] ] ] @@ -36,12 +41,7 @@ ] ] ] - ] - ]; - - public function setUp() { - - parent::setup(); + ]; } public function tearDown() { @@ -54,7 +54,7 @@ Es::shouldReceive('search') ->once() - ->with(self::ES_QUERY) + ->with($this->ES_QUERY) ->andReturn(json_decode('{ "took" : 132, "timed_out" : false, @@ -87,7 +87,7 @@ Es::shouldReceive('search') ->once() - ->with(self::ES_QUERY) + ->with($this->ES_QUERY) ->andReturn(json_decode('{ "took" : 132, "timed_out" : false,