Browse Source

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

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
d6ff097cbb
  1. 11
      tests/unit/framework/db/DatabaseTestCase.php

11
tests/unit/framework/db/DatabaseTestCase.php

@ -1,12 +1,16 @@
<?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
} }
} }
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

Loading…
Cancel
Save