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

RefreshDatabaseBeforeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A runDatabaseMigrations() 0 8 1
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