| Total Complexity | 5 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | trait WithMemoryDbConnection |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Setup the test environment. |
||
| 13 | * |
||
| 14 | * @return void |
||
| 15 | */ |
||
| 16 | protected function setUp(): void |
||
| 17 | { |
||
| 18 | parent::setUp(); |
||
| 19 | |||
| 20 | DB::purge('testing'); |
||
| 21 | DB::setDefaultConnection('testing'); |
||
| 22 | |||
| 23 | Artisan::call('migrate'); |
||
| 24 | |||
| 25 | foreach ($this->seeders() as $seeder) { |
||
| 26 | // Instantiated seeder class (likely with constructor params) |
||
| 27 | if ($seeder instanceof Seeder) { |
||
| 28 | $seeder->run(); |
||
|
|
|||
| 29 | } |
||
| 30 | |||
| 31 | // Seeder class string to be used in Artisan command |
||
| 32 | else { |
||
| 33 | $this->seed($seeder); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Performs assertions shared by all tests of a test case. |
||
| 40 | * |
||
| 41 | * This method is called between setUp() and test. |
||
| 42 | * |
||
| 43 | * @return void |
||
| 44 | */ |
||
| 45 | protected function assertPreConditions(): void |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Clean up the testing environment before the next test. |
||
| 52 | * |
||
| 53 | * @return void |
||
| 54 | */ |
||
| 55 | protected function tearDown(): void |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Retrieve an array of Seeders to be run within the `setUp()` method. |
||
| 66 | * |
||
| 67 | * @return array |
||
| 68 | */ |
||
| 69 | abstract protected function seeders(): array; |
||
| 70 | } |
||
| 71 |
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.