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(); |
|
|
|
|
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
if (isset($uses[DatabaseMigrations::class])) { |
35
|
|
|
/* @phpstan-ignore-next-line */ |
36
|
|
|
$this->runDatabaseMigrations(); |
|
|
|
|
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
if (isset($uses[DatabaseTransactions::class])) { |
40
|
|
|
/* @phpstan-ignore-next-line */ |
41
|
|
|
$this->beginDatabaseTransaction(); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
if (isset($uses[WithoutMiddleware::class])) { |
45
|
|
|
/* @phpstan-ignore-next-line */ |
46
|
|
|
$this->disableMiddlewareForAllTests(); |
|
|
|
|
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if (isset($uses[WithoutEvents::class])) { |
50
|
|
|
/* @phpstan-ignore-next-line */ |
51
|
|
|
$this->disableEventsForAllTests(); |
|
|
|
|
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if (isset($uses[WithFaker::class])) { |
55
|
|
|
/* @phpstan-ignore-next-line */ |
56
|
|
|
$this->setUpFaker(); |
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return $uses; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
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.