-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathsetUp.php
34 lines (29 loc) · 1.05 KB
/
setUp.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
<?php
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Route;
class setUp
{
public static function run()
{
self::defineRoutes();
self::mock();
}
public static function defineRoutes()
{
Route::get('/welcome', 'HomeController@index')->name('welcome.name');
Route::get('/welcome1', function () {
return view('welcome');
})->name('welcome1.name');
}
private static function mock()
{
Gate::shouldReceive('define')->andReturn(true);
Gate::shouldReceive('allows')->with('heyman.youShouldHaveRole', ['reader'])->andReturn(false);
Gate::shouldReceive('allows')->with('heyman.youShouldHaveRole', ['writer'])->andReturn(true);
Gate::shouldReceive('allows')->with('heyman.youShouldHaveRole', ['writer', 'payload'])->andReturn(true);
Gate::shouldReceive('allows')->andReturn(false);
Gate::shouldReceive('define')->andReturn(true);
Auth::shouldReceive('guest')->andReturn(false);
}
}