forked from Chumper/Datatable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDatatableTest.php
56 lines (44 loc) · 1.55 KB
/
DatatableTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
use Chumper\Datatable\Datatable;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Config;
class DatatableTest extends PHPUnit_Framework_TestCase {
/**
* @var Datatable
*/
private $dt;
protected function setUp()
{
// set up config
Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::engine")->andReturn(
array(
'exactWordSearch' => false,
)
);
Config::shouldReceive('get')->zeroOrMoreTimes()->with("datatable::table")->andReturn(
array(
'class' => 'table table-bordered',
'id' => '',
'options' => array(
"sPaginationType" => "full_numbers",
"bProcessing" => false
),
'callbacks' => array(),
'noScript' => false,
'table_view' => 'datatable::template',
'script_view' => 'datatable::javascript',
)
);
$this->dt = new Datatable;
$this->mock = Mockery::mock('Illuminate\Database\Query\Builder');
}
public function testReturnInstances()
{
$api = $this->dt->query($this->mock);
$this->assertInstanceOf('Chumper\Datatable\Engines\QueryEngine', $api);
$api = $this->dt->collection(new Collection());
$this->assertInstanceOf('Chumper\Datatable\Engines\CollectionEngine', $api);
$table = $this->dt->table();
$this->assertInstanceOf('Chumper\Datatable\Table', $table);
}
}