server/src/tests/Controllers/DateStatsControllerTest.php
changeset 537 d2e6ee099125
parent 427 695111d1eec9
equal deleted inserted replaced
536:b64c8c35c67d 537:d2e6ee099125
   100                                 "buckets" : []
   100                                 "buckets" : []
   101                             }
   101                             }
   102                         }
   102                         }
   103                     }
   103                     }
   104                 }', true));
   104                 }', true));
   105             $this->get('/api/v1/stats/datestats/')->assertTrue($this->response->isOk(), $this->response->content());
   105             $response = $this->get('/api/v1/stats/datestats/');
   106             $this->seeJsonEquals(["datestats" => []]);
   106             $response
       
   107                 ->assertStatus(200)
       
   108                 ->assertJson(["datestats" => []]);
   107     }
   109     }
   108 
   110 
   109     public function testIndexResult() {
   111     public function testIndexResult() {
   110 
   112 
   111         Es::shouldReceive('search')
   113         Es::shouldReceive('search')
   157                                 } ]
   159                                 } ]
   158                             }
   160                             }
   159                         }
   161                         }
   160                     }
   162                     }
   161                 }', true));
   163                 }', true));
   162             $this->get('/api/v1/stats/datestats/')->assertTrue($this->response->isOk(), $this->response->content());
   164             $response = $this->get('/api/v1/stats/datestats/');
   163             $this->seeJsonEquals(["datestats" => [
   165             $response
       
   166                 ->assertStatus(200)
       
   167                 ->assertJson(["datestats" => [
   164                 "1948" => 3,
   168                 "1948" => 3,
   165                 "1957" => 29,
   169                 "1957" => 29,
   166                 "1963" => 22,
   170                 "1963" => 22,
   167                 "1970" => 404,
   171                 "1970" => 404,
   168                 "1986" => 14,
   172                 "1986" => 14,
   199                                 "value" : null
   203                                 "value" : null
   200                             }
   204                             }
   201                         }
   205                         }
   202                     }
   206                     }
   203                 }', true));
   207                 }', true));
   204         $this->get('/api/v1/stats/dateminmax/')->assertTrue($this->response->isOk(), $this->response->content());
   208         $response = $this->get('/api/v1/stats/dateminmax/');
   205         $this->seeJsonEquals(["dateminmax" => [0, 0]]);
   209         $response
       
   210             ->assertStatus(200)
       
   211             ->assertJson(["dateminmax" => [0, 0]]);
   206     }
   212     }
   207 
   213 
   208     public function testMinMaxResult() {
   214     public function testMinMaxResult() {
   209 
   215 
   210         Es::shouldReceive('search')
   216         Es::shouldReceive('search')
   233                                 "value" : 1948.0
   239                                 "value" : 1948.0
   234                             }
   240                             }
   235                         }
   241                         }
   236                     }
   242                     }
   237                 }', true));
   243                 }', true));
   238         $this->get('/api/v1/stats/dateminmax/')->assertTrue($this->response->isOk(), $this->response->content());
   244         $response = $this->get('/api/v1/stats/dateminmax/');
   239         $this->seeJsonEquals(["dateminmax" => [ 1948, 2015 ]]);
   245         $response
       
   246             ->assertStatus(200)
       
   247             ->assertJson(["dateminmax" => [ 1948, 2015 ]]);
   240     }
   248     }
   241 
   249 
   242 }
   250 }