Conditions | 3 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 16 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | 152 | protected function initializeTestDatabaseTransactions(): void |
|
10 | { |
||
11 | 152 | $database = $this->app->make('db'); |
|
12 | |||
13 | 152 | foreach ($this->connectionsToTransact() as $name) { |
|
|
|||
14 | 152 | $connection = $database->connection($name); |
|
15 | 152 | $dispatcher = $connection->getEventDispatcher(); |
|
16 | |||
17 | 152 | $connection->unsetEventDispatcher(); |
|
18 | 152 | $connection->beginTransaction($this->transactionCollections); |
|
19 | 152 | $connection->setEventDispatcher($dispatcher); |
|
20 | } |
||
21 | |||
22 | 152 | $this->beforeApplicationDestroyed(function () use ($database) { |
|
23 | 152 | foreach ($this->connectionsToTransact() as $name) { |
|
24 | 152 | $connection = $database->connection($name); |
|
25 | 152 | $dispatcher = $connection->getEventDispatcher(); |
|
26 | |||
27 | 152 | $connection->unsetEventDispatcher(); |
|
28 | 152 | $connection->rollback(); |
|
29 | 152 | $connection->setEventDispatcher($dispatcher); |
|
30 | 152 | $connection->disconnect(); |
|
31 | } |
||
35 |