Commit f2e57b2e by Qiang Xue

Fixed test breaks.

parent 12c48d1a
...@@ -33,6 +33,12 @@ class BarBehavior extends Behavior ...@@ -33,6 +33,12 @@ class BarBehavior extends Behavior
class BehaviorTest extends TestCase class BehaviorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testAttachAndAccessing() public function testAttachAndAccessing()
{ {
$bar = new BarClass(); $bar = new BarClass();
......
...@@ -27,6 +27,7 @@ class ComponentTest extends TestCase ...@@ -27,6 +27,7 @@ class ComponentTest extends TestCase
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
$this->mockApplication();
$this->component = new NewComponent(); $this->component = new NewComponent();
} }
......
...@@ -12,6 +12,12 @@ use yiiunit\data\base\InvalidRulesModel; ...@@ -12,6 +12,12 @@ use yiiunit\data\base\InvalidRulesModel;
*/ */
class ModelTest extends TestCase class ModelTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testGetAttributeLabel() public function testGetAttributeLabel()
{ {
$speaker = new Speaker(); $speaker = new Speaker();
......
...@@ -17,6 +17,7 @@ class ObjectTest extends TestCase ...@@ -17,6 +17,7 @@ class ObjectTest extends TestCase
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
$this->mockApplication();
$this->object = new NewObject; $this->object = new NewObject;
} }
......
...@@ -20,6 +20,7 @@ class AssetControllerTest extends TestCase ...@@ -20,6 +20,7 @@ class AssetControllerTest extends TestCase
public function setUp() public function setUp()
{ {
$this->mockApplication();
$this->testFilePath = Yii::getAlias('@yiiunit/runtime') . DIRECTORY_SEPARATOR . get_class($this); $this->testFilePath = Yii::getAlias('@yiiunit/runtime') . DIRECTORY_SEPARATOR . get_class($this);
$this->createDir($this->testFilePath); $this->createDir($this->testFilePath);
$this->testAssetsBasePath = $this->testFilePath . DIRECTORY_SEPARATOR . 'assets'; $this->testAssetsBasePath = $this->testFilePath . DIRECTORY_SEPARATOR . 'assets';
......
...@@ -14,6 +14,7 @@ class ActiveRecordTest extends DatabaseTestCase ...@@ -14,6 +14,7 @@ class ActiveRecordTest extends DatabaseTestCase
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
$this->mockApplication();
ActiveRecord::$db = $this->getConnection(); ActiveRecord::$db = $this->getConnection();
} }
......
...@@ -9,6 +9,12 @@ use yii\db\DataReader; ...@@ -9,6 +9,12 @@ use yii\db\DataReader;
class CommandTest extends DatabaseTestCase class CommandTest extends DatabaseTestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
function testConstruct() function testConstruct()
{ {
$db = $this->getConnection(false); $db = $this->getConnection(false);
......
...@@ -6,6 +6,12 @@ use yii\db\Connection; ...@@ -6,6 +6,12 @@ use yii\db\Connection;
class ConnectionTest extends DatabaseTestCase class ConnectionTest extends DatabaseTestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
function testConstruct() function testConstruct()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
......
...@@ -12,6 +12,7 @@ abstract class DatabaseTestCase extends TestCase ...@@ -12,6 +12,7 @@ abstract class DatabaseTestCase extends TestCase
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
$this->mockApplication();
$databases = $this->getParam('databases'); $databases = $this->getParam('databases');
$this->database = $databases[$this->driverName]; $this->database = $databases[$this->driverName];
$pdo_database = 'pdo_'.$this->driverName; $pdo_database = 'pdo_'.$this->driverName;
......
...@@ -11,6 +11,11 @@ use yii\db\pgsql\QueryBuilder as PgsqlQueryBuilder; ...@@ -11,6 +11,11 @@ use yii\db\pgsql\QueryBuilder as PgsqlQueryBuilder;
class QueryBuilderTest extends DatabaseTestCase class QueryBuilderTest extends DatabaseTestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
/** /**
* @throws \Exception * @throws \Exception
......
...@@ -9,6 +9,12 @@ use yii\db\DataReader; ...@@ -9,6 +9,12 @@ use yii\db\DataReader;
class QueryTest extends DatabaseTestCase class QueryTest extends DatabaseTestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
function testSelect() function testSelect()
{ {
// default // default
......
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