Passed
Push — next ( 4a2827...9707a2 )
by Bas
07:22
created

TestCase::setUpTraits()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 35
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 35
rs 8.8333
cc 7
nc 64
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\Aranguent\Testing;
6
7
use Illuminate\Foundation\Testing\DatabaseMigrations;
8
use Illuminate\Foundation\Testing\TestCase as IlluminateTestCase;
9
use Illuminate\Foundation\Testing\WithFaker;
10
use Illuminate\Foundation\Testing\WithoutEvents;
11
use Illuminate\Foundation\Testing\WithoutMiddleware;
12
13
abstract class TestCase extends IlluminateTestCase
14
{
15
    /**
16
     * @var array<string, array<string>> $transactionCollections
17
     */
18
    public array $transactionCollections = [];
19
20
    /**
21
     * Boot the testing helper traits.
22
     *
23
     * @return array
24
     */
25
    protected function setUpTraits()
26
    {
27
        $uses = array_flip(class_uses_recursive(static::class));
28
29
        if (isset($uses[RefreshDatabase::class])) {
30
            /* @phpstan-ignore-next-line */
31
            $this->refreshDatabase();
0 ignored issues
show
Bug introduced by
The method refreshDatabase() does not exist on LaravelFreelancerNL\Aranguent\Testing\TestCase. ( Ignorable by Annotation )

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

31
            $this->/** @scrutinizer ignore-call */ 
32
                   refreshDatabase();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
        }
33
34
        if (isset($uses[DatabaseMigrations::class])) {
35
            /* @phpstan-ignore-next-line */
36
            $this->runDatabaseMigrations();
0 ignored issues
show
Bug introduced by
The method runDatabaseMigrations() does not exist on LaravelFreelancerNL\Aranguent\Testing\TestCase. ( Ignorable by Annotation )

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

36
            $this->/** @scrutinizer ignore-call */ 
37
                   runDatabaseMigrations();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
        }
38
39
        if (isset($uses[DatabaseTransactions::class])) {
40
            /* @phpstan-ignore-next-line */
41
            $this->beginDatabaseTransaction();
0 ignored issues
show
Bug introduced by
The method beginDatabaseTransaction() does not exist on LaravelFreelancerNL\Aranguent\Testing\TestCase. ( Ignorable by Annotation )

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

41
            $this->/** @scrutinizer ignore-call */ 
42
                   beginDatabaseTransaction();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
        }
43
44
        if (isset($uses[WithoutMiddleware::class])) {
45
            /* @phpstan-ignore-next-line */
46
            $this->disableMiddlewareForAllTests();
0 ignored issues
show
Bug introduced by
The method disableMiddlewareForAllTests() does not exist on LaravelFreelancerNL\Aranguent\Testing\TestCase. ( Ignorable by Annotation )

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

46
            $this->/** @scrutinizer ignore-call */ 
47
                   disableMiddlewareForAllTests();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
        }
48
49
        if (isset($uses[WithoutEvents::class])) {
50
            /* @phpstan-ignore-next-line */
51
            $this->disableEventsForAllTests();
0 ignored issues
show
Bug introduced by
The method disableEventsForAllTests() does not exist on LaravelFreelancerNL\Aranguent\Testing\TestCase. ( Ignorable by Annotation )

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

51
            $this->/** @scrutinizer ignore-call */ 
52
                   disableEventsForAllTests();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
        }
53
54
        if (isset($uses[WithFaker::class])) {
55
            /* @phpstan-ignore-next-line */
56
            $this->setUpFaker();
0 ignored issues
show
Bug introduced by
The method setUpFaker() does not exist on LaravelFreelancerNL\Aranguent\Testing\TestCase. Did you maybe mean setUp()? ( Ignorable by Annotation )

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

56
            $this->/** @scrutinizer ignore-call */ 
57
                   setUpFaker();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
57
        }
58
59
        return $uses;
60
    }
61
}
62