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