-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTestCase.php
63 lines (48 loc) · 1.66 KB
/
TestCase.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
declare(strict_types=1);
namespace UseTheFork\Synapse\Tests;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Orchestra\Testbench\Concerns\WithWorkbench;
use Orchestra\Testbench\TestCase as Orchestra;
use UseTheFork\Synapse\SynapseServiceProvider;
use function Orchestra\Testbench\workbench_path;
abstract class TestCase extends Orchestra
{
use WithWorkbench;
use RefreshDatabase;
/**
* Define database migrations.
*/
protected function defineDatabaseMigrations(): void
{
// Testing migrations are located in workbench database/migrations
$this->loadMigrationsFrom(
__DIR__.'/../database/migrations'
);
$this->loadMigrationsFrom(
workbench_path('database/migrations')
);
}
protected function defineDatabaseSeeders(): void {}
protected function defineEnvironment($app): void {}
protected function getEnvironmentSetUp($app): void
{
// make sure, our .env file is loaded
$app->useEnvironmentPath(__DIR__.'/..');
$app->bootstrapWith([LoadEnvironmentVariables::class]);
// Loads our config instead of manually setting it.
$synapseConfig = require __DIR__.'/../config/synapse.php';
tap($app['config'], function (Repository $config) use ($synapseConfig) {
$config->set('synapse', $synapseConfig);
});
parent::getEnvironmentSetUp($app);
}
protected function getPackageProviders($app): array
{
return [
SynapseServiceProvider::class,
];
}
}