Commit 8c1c3c59 by Alexander Makarov

Better AR connection init in tests

parent 5cf99922
......@@ -12,7 +12,6 @@ abstract class DatabaseTestCase extends TestCase
* @var Connection
*/
protected $db;
protected $initializeAppWithDb = false;
protected function setUp()
{
......@@ -24,9 +23,6 @@ abstract class DatabaseTestCase extends TestCase
if (!extension_loaded('pdo') || !extension_loaded($pdo_database)) {
$this->markTestSkipped('pdo and '.$pdo_database.' extension are required.');
}
if ($this->initializeAppWithDb === true) {
\Yii::$app->setComponent('db', $this->getConnection());
}
$this->mockApplication();
}
......
......@@ -19,12 +19,7 @@ class ExistValidatorTest extends DatabaseTestCase
public function setUp()
{
parent::setUp();
ActiveRecord::$db = Yii::$app->getComponent('db');
}
public function tearDown()
{
parent::tearDown();
ActiveRecord::$db = $this->getConnection();
}
public function testValidateValueExpectedException()
......
......@@ -20,7 +20,7 @@ class UniqueValidatorTest extends DatabaseTestCase
public function setUp()
{
parent::setUp();
ActiveRecord::$db = Yii::$app->getComponent('db');
ActiveRecord::$db = $this->getConnection();
}
public function testAssureMessageSetOnInit()
......
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