Skip to content

Commit

Permalink
refs Codeception#3456 \Codeception\TestCase\Test does not close datab…
Browse files Browse the repository at this point in the history
…ase connection when running haveFixtures on Yii2 (Codeception#3586)

Close db connections if exists after Yii2-tests (\Codeception\Module\Yii2::_after)
  • Loading branch information
pchapl authored and bulzgkri committed Jun 16, 2017
1 parent 3242c5a commit 5b76e25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Codeception/Module/Yii2.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ public function _after(\Codeception\TestInterface $test)
if (isset(\Yii::$app) && \Yii::$app->has('session', true)) {
\Yii::$app->session->close();
}

// Close connections if exists
if (isset(\Yii::$app) && \Yii::$app->has('db', true)) {
\Yii::$app->db->close();
}

parent::_after($test);
}

Expand Down

0 comments on commit 5b76e25

Please sign in to comment.