Passed
Push — next ( aa8376...09a952 )
by Bas
02:36
created

TestCase::setTransactionCollections()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
    protected array $transactionCollections = [];
19
20
    /**
21
     * @var array<string, array<string>> $transactionCollections
22
     */
23
    public function setTransactionCollections(array $transactionCollections): void
24
    {
25
        $this->transactionCollections = $transactionCollections;
26
    }
27
28
    /**
29
     * Boot the testing helper traits.
30
     *
31
     * @return array
32
     */
33
    protected function setUpTraits()
34
    {
35
        $uses = array_flip(class_uses_recursive(static::class));
36
37
        if (isset($uses[RefreshDatabase::class])) {
38
            /* @phpstan-ignore-next-line */
39
            $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

39
            $this->/** @scrutinizer ignore-call */ 
40
                   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...
40
        }
41
42
        if (isset($uses[DatabaseMigrations::class])) {
43
            /* @phpstan-ignore-next-line */
44
            $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

44
            $this->/** @scrutinizer ignore-call */ 
45
                   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...
45
        }
46
47
        if (isset($uses[DatabaseTransactions::class])) {
48
            /* @phpstan-ignore-next-line */
49
            $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

49
            $this->/** @scrutinizer ignore-call */ 
50
                   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...
50
        }
51
52
        if (isset($uses[WithoutMiddleware::class])) {
53
            /* @phpstan-ignore-next-line */
54
            $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

54
            $this->/** @scrutinizer ignore-call */ 
55
                   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...
55
        }
56
57
        if (isset($uses[WithoutEvents::class])) {
58
            /* @phpstan-ignore-next-line */
59
            $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

59
            $this->/** @scrutinizer ignore-call */ 
60
                   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...
60
        }
61
62
        if (isset($uses[WithFaker::class])) {
63
            /* @phpstan-ignore-next-line */
64
            $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

64
            $this->/** @scrutinizer ignore-call */ 
65
                   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...
65
        }
66
67
        return $uses;
68
    }
69
}
70