TestCase::getEnvironmentSetUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Canylmz\Rating\Test;
4
5
use Canylmz\Rating\RatingServiceProvider;
6
use Orchestra\Testbench\TestCase as Orchestra;
7
8
abstract class TestCase extends Orchestra
9
{
10
    public function setUp(): void
11
    {
12
        parent::setUp();
13
14
        $this->loadLaravelMigrations(['--database' => 'testbench']);
15
        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
16
        $this->loadMigrationsFrom(__DIR__.'/database/migrations');
17
        $this->withFactories(__DIR__.'/database/factories');
18
19
        $this->artisan('migrate', ['--database' => 'testbench'])->run();
20
    }
21
22
    /**
23
     * Define package providers.
24
     *
25
     * @param  \Illuminate\Foundation\Application  $app
26
     * @return array
27
     */
28
    protected function getPackageProviders($app)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    protected function getPackageProviders(/** @scrutinizer ignore-unused */ $app)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        return [
31
            RatingServiceProvider::class,
32
        ];
33
    }
34
35
    /**
36
     * Define environment setup.
37
     *
38
     * @param  \Illuminate\Foundation\Application  $app
39
     * @return void
40
     */
41
    protected function getEnvironmentSetUp($app)
42
    {
43
        // Setup default database to use sqlite :memory:
44
        $app['config']->set('database.default', 'testbench');
45
        $app['config']->set('database.connections.testbench', [
46
            'driver'   => 'sqlite',
47
            'database' => ':memory:',
48
            'prefix'   => '',
49
        ]);
50
    }
51
}
52