1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace RafflesArgentina\ResourceController; |
4
|
|
|
|
5
|
|
|
trait BaseTest |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Setup the test environment. |
9
|
|
|
*/ |
10
|
|
|
public function setUp() |
11
|
|
|
{ |
12
|
|
|
parent::setUp(); |
13
|
|
|
|
14
|
|
|
gc_disable(); |
15
|
|
|
|
16
|
|
|
$this->loadMigrationsFrom(__DIR__.'/database/migrations'); |
|
|
|
|
17
|
|
|
|
18
|
|
|
$this->withFactories(__DIR__.'/factories'); |
|
|
|
|
19
|
|
|
|
20
|
|
|
\Route::group([ |
21
|
|
|
'middleware' => [], |
22
|
|
|
'namespace' => 'RafflesArgentina\ResourceController', |
23
|
|
|
], function ($router) { |
|
|
|
|
24
|
|
|
$router->resource('test', 'TestController'); |
25
|
|
|
$router->resource('test2', 'TestUseSoftDeletesController'); |
26
|
|
|
}); |
27
|
|
|
|
28
|
|
|
\View::addLocation(__DIR__.'/Resources/Views'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Define environment setup. |
33
|
|
|
* |
34
|
|
|
* @param \Illuminate\Foundation\Application $app |
35
|
|
|
* @return void |
36
|
|
|
*/ |
37
|
|
|
protected function getEnvironmentSetUp($app) |
38
|
|
|
{ |
39
|
|
|
// Setup default database to use sqlite :memory: |
40
|
|
|
$app['config']->set('database.default', 'testbench'); |
41
|
|
|
$app['config']->set('database.connections.testbench', [ |
42
|
|
|
'driver' => 'sqlite', |
43
|
|
|
'database' => ':memory:', |
44
|
|
|
'prefix' => '', |
45
|
|
|
]); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Get package providers. At a minimum this is the package being tested, but also |
50
|
|
|
* would include packages upon which our package depends, e.g. Cartalyst/Sentry |
51
|
|
|
* In a normal app environment these would be added to the 'providers' array in |
52
|
|
|
* the config/app.php file. |
53
|
|
|
* |
54
|
|
|
* @param \Illuminate\Foundation\Application $app |
55
|
|
|
* |
56
|
|
|
* @return array |
57
|
|
|
*/ |
58
|
|
|
protected function getPackageProviders($app) |
|
|
|
|
59
|
|
|
{ |
60
|
|
|
return [ |
61
|
|
|
// your package service provider, |
62
|
|
|
\Orchestra\Database\ConsoleServiceProvider::class, |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Get package aliases. In a normal app environment these would be added to |
68
|
|
|
* the 'aliases' array in the config/app.php file. If your package exposes an |
69
|
|
|
* aliased facade, you should add the alias here, along with aliases for |
70
|
|
|
* facades upon which your package depends, e.g. Cartalyst/Sentry. |
71
|
|
|
* |
72
|
|
|
* @param \Illuminate\Foundation\Application $app |
73
|
|
|
* |
74
|
|
|
* @return array |
75
|
|
|
*/ |
76
|
|
|
protected function getPackageAliases($app) |
|
|
|
|
77
|
|
|
{ |
78
|
|
|
return [ |
79
|
|
|
// |
80
|
|
|
]; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|