-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFilterableTest.php
38 lines (33 loc) · 968 Bytes
/
FilterableTest.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
<?php
namespace Zarate\Filterable\Tests;
use Illuminate\Support\Facades\Hash;
use Zarate\Filterable\Tests\Models\User;
class FilterableTest extends TestCase
{
public function test_can_filter_users()
{
User::create($this->attributes(['name' => 'jonathan']));
User::create($this->attributes(['name' => 'ellie']));
$this->get('users?name=jonathan')
->assertJsonFragment([
[
'id' => 1,
'name' => 'jonathan',
]
])
->assertJsonMissing([
[
'id' => 2,
'name' => 'ellie',
]
]);
}
protected function attributes(array $overrides = [])
{
return array_merge([
'name' => 'User Test',
'email' => "{$overrides['name']}@test.com",
'password' => Hash::make('password'),
], $overrides);
}
}