server/src/tests/Controllers/GeoStatsControllerTest.php
author ymh <ymh.work@gmail.com>
Thu, 03 Nov 2016 01:52:26 +0100
changeset 387 7fba86fa8604
parent 320 0fce13da58af
child 407 2dba812c7ef2
permissions -rw-r--r--
Sparql client implementation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
308
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
class GeoStatsControllerTest extends TestCase
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
{
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
   public function testGetIndex()
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
    {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
        $query = [
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
            'index' => env('ELASTICSEARCH_INDEX'),
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
            'body' => [
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
                "size" => 0,
320
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    11
                "query" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    12
                    'match_all' => []
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    13
                ],
308
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
                "aggs" => [
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
                    "geos" => [
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
                        "terms" => [
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
                            "size" => 0,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
                            "field" => "geonames_hierarchy"
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
                        ]
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
                    ]
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
                ]
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
            ]
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
        ];
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
        Es::shouldReceive('search')
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
                    ->once()
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
                    ->with($query)
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
                    ->andReturn(json_decode("{
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
  \"took\" : 17,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
  \"timed_out\" : false,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
  \"_shards\" : {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
    \"total\" : 1,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
    \"successful\" : 1,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
    \"failed\" : 0
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
  },
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
  \"hits\" : {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
    \"total\" : 3011,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
    \"max_score\" : 0.0,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
    \"hits\" : [ ]
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
  },
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
  \"aggregations\" : {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
    \"geos\" : {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
      \"doc_count_error_upper_bound\" : 0,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
      \"sum_other_doc_count\" : 0,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
      \"buckets\" : [ {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
        \"key\" : 6255148,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
        \"doc_count\" : 2684
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
      }, {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
        \"key\" : 3017382,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
        \"doc_count\" : 2674
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
      }, {
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
        \"key\" : 3027939,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
        \"doc_count\" : 851
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
      } ]
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
    }
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
  }
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
}", true));
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
        $this->get('/api/v1/stats/geostats/')->assertTrue($this->response->isOk(), $this->response->content());
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
        $this->seeJsonEquals(["geostats" => [
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
            '6255148' => 2684,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
            '3017382' => 2674,
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
            '3027939' => 851
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
        ]]);
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
    }
320
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    66
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    67
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    68
    public function testGetIndexEarth()
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    69
    {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    70
        $query = [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    71
            'index' => env('ELASTICSEARCH_INDEX'),
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    72
            'body' => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    73
                "size" => 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    74
                "query" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    75
                    'match_all' => []
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    76
                ],
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    77
                "aggs" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    78
                    "geos" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    79
                        "terms" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    80
                            "size" => 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    81
                            "field" => "geonames_hierarchy"
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    82
                        ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    83
                    ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    84
                ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    85
            ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    86
        ];
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    87
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    88
        Es::shouldReceive('search')
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    89
                ->once()
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    90
                ->with($query)
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    91
                ->andReturn(json_decode("{
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    92
  \"took\" : 17,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    93
  \"timed_out\" : false,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    94
  \"_shards\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    95
    \"total\" : 1,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    96
    \"successful\" : 1,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    97
    \"failed\" : 0
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    98
  },
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
    99
  \"hits\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   100
    \"total\" : 3011,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   101
    \"max_score\" : 0.0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   102
    \"hits\" : [ ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   103
  },
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   104
  \"aggregations\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   105
    \"geos\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   106
      \"doc_count_error_upper_bound\" : 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   107
      \"sum_other_doc_count\" : 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   108
      \"buckets\" : []
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   109
    }
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   110
  }
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   111
}", true));
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   112
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   113
        $this->get('/api/v1/stats/geostats/?area='.config('corpusparole.geonames_earth_geonamesid'))->assertTrue($this->response->isOk(), $this->response->content());
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   114
    }
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   115
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   116
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   117
    public function testGetIndexArea()
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   118
    {
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   119
320
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   120
        $query = [
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   121
            "index" => env('ELASTICSEARCH_INDEX'),
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   122
            "body" => [
320
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   123
                "size" => 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   124
                "query" => [
387
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   125
                    "constant_score" => [
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   126
                        "filter" => [
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   127
                            "bool" => [
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   128
                                "must" => [ [
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   129
                                    "term" => [ "geonames_hierarchy" => "code_area" ]
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   130
                                ] ]
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   131
                            ]
7fba86fa8604 Sparql client implementation
ymh <ymh.work@gmail.com>
parents: 320
diff changeset
   132
                        ]
320
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   133
                    ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   134
                ],
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   135
                "aggs" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   136
                    "geos" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   137
                        "terms" => [
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   138
                            "size" => 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   139
                            "field" => "geonames_hierarchy"
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   140
                        ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   141
                    ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   142
                ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   143
            ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   144
        ];
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   145
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   146
        Es::shouldReceive('search')
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   147
                ->once()
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   148
                ->with($query)
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   149
                ->andReturn(json_decode("{
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   150
  \"took\" : 17,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   151
  \"timed_out\" : false,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   152
  \"_shards\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   153
    \"total\" : 1,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   154
    \"successful\" : 1,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   155
    \"failed\" : 0
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   156
  },
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   157
  \"hits\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   158
    \"total\" : 3011,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   159
    \"max_score\" : 0.0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   160
    \"hits\" : [ ]
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   161
  },
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   162
  \"aggregations\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   163
    \"geos\" : {
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   164
      \"doc_count_error_upper_bound\" : 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   165
      \"sum_other_doc_count\" : 0,
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   166
      \"buckets\" : []
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   167
    }
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   168
  }
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   169
}", true));
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   170
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   171
        $this->get('/api/v1/stats/geostats/?area=code_area')->assertTrue($this->response->isOk(), $this->response->content());
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   172
    }
0fce13da58af filter geostat by area + tests
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
   173
308
e032d686d88e add hierarchy info in document indexation + geostats api controllers + add some keys to geonames resolver
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
}