-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathRelationshipTest.php
More file actions
48 lines (41 loc) · 1.23 KB
/
RelationshipTest.php
File metadata and controls
48 lines (41 loc) · 1.23 KB
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
<?php
namespace Freshbitsweb\Laratables\Tests;
class RelationshipTest extends TestCase
{
/**
* @test
*/
public function test_it_returns_the_relationship_column_value()
{
$users = $this->createUsers();
$response = $this->json('GET', '/datatables-simple', $this->getDatatablesUrlParameters());
$response->assertJson([
'recordsTotal' => 1,
'data' => [[
'0' => 1,
'1' => $users->first()->name,
'2' => $users->first()->email,
'3' => '<a>1</a>',
'4' => $users->first()->country->name,
]],
]);
}
/**
* @test
*/
public function test_it_uses_the_custom_relationship_query()
{
$users = $this->createUsers();
$response = $this->json('GET', '/datatables-custom-relation-query', $this->getDatatablesUrlParameters());
$response->assertJson([
'recordsTotal' => 1,
'data' => [[
'0' => 1,
'1' => $users->first()->name,
'2' => $users->first()->email,
'3' => '<a>1</a>',
'4' => $users->first()->country->code,
]],
]);
}
}