Passed
Branch master (e30549)
by noitran
04:00
created

TestCase::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Noitran\RQL\Tests;
4
5
use Orchestra\Testbench\TestCase as OrchestraTestCase;
6
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
7
8
/**
9
 * Class TestCase
10
 */
11
abstract class TestCase extends OrchestraTestCase
12
{
13
    /**
14
     * Setup the test environment.
15
     */
16
    protected function setUp(): void
17
    {
18
        parent::setUp();
19
20
        $this->loadMigrationsFrom(__DIR__ . '/database/migrations');
21
        $this->registerEloquentFactoriesFrom(__DIR__ . '/database/factories');
22
23
        $this->artisan('db:seed', [
24
            '--class' => PostTestSeeder::class,
25
        ]);
26
    }
27
28
    /**
29
     * Register factories.
30
     *
31
     * @param string $path
32
     *
33
     * @return void
34
     */
35
    protected function registerEloquentFactoriesFrom($path): void
36
    {
37
        $this->app->make(EloquentFactory::class)->load($path);
38
    }
39
}
40