Passed
Push — master ( 67253e...1a1f73 )
by Arthur
04:53 queued 11s
created

RefreshDatabaseBeforeTest::runDatabaseMigrations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 11.10.18
6
 * Time: 22:53
7
 */
8
9
namespace Foundation\Traits;
10
11
12
use Illuminate\Foundation\Testing\DatabaseMigrations;
13
use Illuminate\Foundation\Testing\RefreshDatabaseState;
14
15
trait RefreshDatabaseBeforeTest
16
{
17
    use DatabaseMigrations {
18
        DatabaseMigrations::runDatabaseMigrations as parentMethod;
19
    }
20
21 17
    public function runDatabaseMigrations()
22
    {
23 17
        $this->artisan('migrate:fresh');
0 ignored issues
show
Bug introduced by
It seems like artisan() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

23
        $this->/** @scrutinizer ignore-call */ 
24
               artisan('migrate:fresh');
Loading history...
24 17
        $this->artisan('db:seed');
25
26
        $this->beforeApplicationDestroyed(function () {
0 ignored issues
show
Bug introduced by
It seems like beforeApplicationDestroyed() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

26
        $this->/** @scrutinizer ignore-call */ 
27
               beforeApplicationDestroyed(function () {
Loading history...
27 17
            $this->artisan('migrate:rollback');
28 17
            RefreshDatabaseState::$migrated = false;
29 17
        });
30 17
    }
31
32
}
33