1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Modules\Notification\Tests; |
4
|
|
|
|
5
|
|
|
use Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider; |
6
|
|
|
use Modules\Core\Providers\CoreServiceProvider; |
7
|
|
|
use Modules\Notification\Providers\NotificationServiceProvider; |
8
|
|
|
use Nwidart\Modules\LaravelModulesServiceProvider; |
9
|
|
|
use Orchestra\Testbench\TestCase; |
10
|
|
|
|
11
|
|
|
abstract class BaseTestCase extends TestCase |
12
|
|
|
{ |
13
|
|
|
public function setUp() |
14
|
|
|
{ |
15
|
|
|
parent::setUp(); |
16
|
|
|
|
17
|
|
|
$this->resetDatabase(); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
protected function getPackageProviders($app) |
21
|
|
|
{ |
22
|
|
|
return [ |
23
|
|
|
\Collective\Html\HtmlServiceProvider::class, |
24
|
|
|
LaravelLocalizationServiceProvider::class, |
25
|
|
|
LaravelModulesServiceProvider::class, |
26
|
|
|
CoreServiceProvider::class, |
27
|
|
|
NotificationServiceProvider::class, |
28
|
|
|
]; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
protected function getPackageAliases($app) |
32
|
|
|
{ |
33
|
|
|
return [ |
34
|
|
|
'Eloquent' => 'Illuminate\Database\Eloquent\Model', |
35
|
|
|
'LaravelLocalization' => \Mcamara\LaravelLocalization\Facades\LaravelLocalization::class, |
36
|
|
|
'Form' => \Collective\Html\FormFacade::class, |
37
|
|
|
'Html' => \Collective\Html\HtmlFacade::class, |
38
|
|
|
]; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
protected function getEnvironmentSetUp($app) |
42
|
|
|
{ |
43
|
|
|
$app['path.base'] = __DIR__ . '/..'; |
44
|
|
|
$app['config']->set('database.default', 'sqlite'); |
45
|
|
|
$app['config']->set('database.connections.sqlite', array( |
46
|
|
|
'driver' => 'sqlite', |
47
|
|
|
'database' => ':memory:', |
48
|
|
|
'prefix' => '', |
49
|
|
|
)); |
50
|
|
|
$app['config']->set('translatable.locales', ['en', 'fr']); |
51
|
|
|
$app['config']->set('modules.paths.modules', __DIR__ . '/../Modules'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
private function resetDatabase() |
55
|
|
|
{ |
56
|
|
|
// Makes sure the migrations table is created |
57
|
|
|
$this->artisan('migrate', [ |
58
|
|
|
'--database' => 'sqlite', |
59
|
|
|
]); |
60
|
|
|
// We empty all tables |
61
|
|
|
$this->artisan('migrate:reset', [ |
62
|
|
|
'--database' => 'sqlite', |
63
|
|
|
]); |
64
|
|
|
// Migrate |
65
|
|
|
$this->artisan('migrate', [ |
66
|
|
|
'--database' => 'sqlite', |
67
|
|
|
]); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|