コード例 #1
0
 public function testCanShowWidgetWithTimeranges()
 {
     $widget = new Widget();
     $widget->name = "New widget";
     $widget->metric = "Users";
     $widget->submetric = "per_time";
     $widget->charttype = "LineChart";
     $widget->filters = [];
     $widget->timegroup = "DAY";
     $widget->col = 0;
     $widget->row = 0;
     $widget->size_x = 1;
     $widget->size_y = 2;
     $widget->save();
     $timeranges = ["all", "today", "yesterday", "last_7", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year"];
     foreach ($timeranges as $timerange) {
         Session::set("cockpit.time_range", $timerange);
         $this->visit("/cockpit/api/" . $widget->getKey());
         $this->seeStatusCode(200);
         $this->assertContains('<div id="chart_' . $widget->getKey() . '">', $this->response->getContent());
     }
 }