-
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathTestCase.php
More file actions
51 lines (40 loc) · 1.02 KB
/
TestCase.php
File metadata and controls
51 lines (40 loc) · 1.02 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
49
50
51
<?php
namespace Styde\Html\Tests;
use Styde\Html\HtmlServiceProvider;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableInterface;
class TestCase extends OrchestraTestCase
{
use TestHelpers;
protected function getPackageProviders($app)
{
return [HtmlServiceProvider::class];
}
protected function aUser()
{
return new TestUser(['role' => 'user']);
}
protected function anEditor()
{
return new TestUser(['role' => 'editor']);
}
protected function anAdmin()
{
return new TestUser(['role' => 'admin']);
}
protected function aUserWithData(array $data)
{
return new TestUser($data);
}
}
class TestUser extends Model implements AuthenticatableInterface
{
use Authenticatable;
protected $guarded = [];
public function isA($role)
{
return $this->role === $role;
}
}