| 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 | 106 | protected function initializeTestDatabaseTransactions(): void |
|
| 10 | { |
||
| 11 | 106 | $database = $this->app->make('db'); |
|
| 12 | |||
| 13 | 106 | foreach ($this->connectionsToTransact() as $name) { |
|
|
|
|||
| 14 | 106 | $connection = $database->connection($name); |
|
| 15 | 106 | $dispatcher = $connection->getEventDispatcher(); |
|
| 16 | |||
| 17 | 106 | $connection->unsetEventDispatcher(); |
|
| 18 | 106 | $connection->beginTransaction($this->transactionCollections); |
|
| 19 | 106 | $connection->setEventDispatcher($dispatcher); |
|
| 20 | } |
||
| 21 | |||
| 22 | 106 | $this->beforeApplicationDestroyed(function () use ($database) { |
|
| 23 | 106 | foreach ($this->connectionsToTransact() as $name) { |
|
| 24 | 106 | $connection = $database->connection($name); |
|
| 25 | 106 | $dispatcher = $connection->getEventDispatcher(); |
|
| 26 | |||
| 27 | 106 | $connection->unsetEventDispatcher(); |
|
| 28 | 106 | $connection->rollback(); |
|
| 29 | 106 | $connection->setEventDispatcher($dispatcher); |
|
| 30 | 106 | $connection->disconnect(); |
|
| 31 | } |
||
| 35 |