Commit d6ff097c by Carsten Brandt

avoid hanging test on bindValue problems (close db connection in tearDown)

parent 825258ef
<?php <?php
namespace yiiunit\framework\db; namespace yiiunit\framework\db;
use yii\db\Connection;
use yiiunit\TestCase as TestCase; use yiiunit\TestCase as TestCase;
abstract class DatabaseTestCase extends TestCase abstract class DatabaseTestCase extends TestCase
{ {
protected $database; protected $database;
protected $driverName = 'mysql'; protected $driverName = 'mysql';
/**
* @var Connection
*/
protected $db; protected $db;
protected function setUp() protected function setUp()
...@@ -22,6 +26,13 @@ abstract class DatabaseTestCase extends TestCase ...@@ -22,6 +26,13 @@ abstract class DatabaseTestCase extends TestCase
} }
} }
protected function tearDown()
{
if ($this->db) {
$this->db->close();
}
}
/** /**
* @param bool $reset whether to clean up the test database * @param bool $reset whether to clean up the test database
* @param bool $open whether to open and populate test database * @param bool $open whether to open and populate test database
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment