public function test_datatables_make_with_data_and_uses_mdata()
 {
     $builder = $this->setupBuilder();
     // set Input variables
     $this->setupInputVariables();
     $datatables = new Datatables(Request::capture());
     $response = $datatables->usingQueryBuilder($builder)->make(true);
     $actual = $response->getContent();
     $expected = '{"draw":1,"recordsTotal":2,"recordsFiltered":2,"data":[{"id":1,"name":"foo"},{"id":2,"name":"bar"}]}';
     $this->assertInstanceOf('Illuminate\\Http\\JsonResponse', $response);
     $this->assertEquals($expected, $actual);
 }
Пример #2
0
 /**
  * Datatables using Query Builder.
  *
  * @param \Illuminate\Database\Query\Builder $builder
  * @return \Yajra\Datatables\Engines\QueryBuilderEngine 
  * @static 
  */
 public static function usingQueryBuilder($builder)
 {
     return \Yajra\Datatables\Datatables::usingQueryBuilder($builder);
 }