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->usingCollection($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 Collection.
  *
  * @param \Illuminate\Support\Collection $builder
  * @return \Yajra\Datatables\Engines\CollectionEngine 
  * @static 
  */
 public static function usingCollection($builder)
 {
     return \Yajra\Datatables\Datatables::usingCollection($builder);
 }