From f2e57b2eec5172c9280bbac5b0c0ee8e1121525f Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 2 Jul 2013 22:19:05 -0400 Subject: [PATCH] Fixed test breaks. --- tests/unit/framework/base/BehaviorTest.php | 6 ++++++ tests/unit/framework/base/ComponentTest.php | 1 + tests/unit/framework/base/ModelTest.php | 6 ++++++ tests/unit/framework/base/ObjectTest.php | 1 + tests/unit/framework/console/controllers/AssetControllerTest.php | 1 + tests/unit/framework/db/ActiveRecordTest.php | 1 + tests/unit/framework/db/CommandTest.php | 6 ++++++ tests/unit/framework/db/ConnectionTest.php | 6 ++++++ tests/unit/framework/db/DatabaseTestCase.php | 1 + tests/unit/framework/db/QueryBuilderTest.php | 5 +++++ tests/unit/framework/db/QueryTest.php | 6 ++++++ 11 files changed, 40 insertions(+) diff --git a/tests/unit/framework/base/BehaviorTest.php b/tests/unit/framework/base/BehaviorTest.php index 11fbe7f..95b7220 100644 --- a/tests/unit/framework/base/BehaviorTest.php +++ b/tests/unit/framework/base/BehaviorTest.php @@ -33,6 +33,12 @@ class BarBehavior extends Behavior class BehaviorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testAttachAndAccessing() { $bar = new BarClass(); diff --git a/tests/unit/framework/base/ComponentTest.php b/tests/unit/framework/base/ComponentTest.php index f1c0ba9..712a515 100644 --- a/tests/unit/framework/base/ComponentTest.php +++ b/tests/unit/framework/base/ComponentTest.php @@ -27,6 +27,7 @@ class ComponentTest extends TestCase protected function setUp() { parent::setUp(); + $this->mockApplication(); $this->component = new NewComponent(); } diff --git a/tests/unit/framework/base/ModelTest.php b/tests/unit/framework/base/ModelTest.php index c292af7..ff20d42 100644 --- a/tests/unit/framework/base/ModelTest.php +++ b/tests/unit/framework/base/ModelTest.php @@ -12,6 +12,12 @@ use yiiunit\data\base\InvalidRulesModel; */ class ModelTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testGetAttributeLabel() { $speaker = new Speaker(); diff --git a/tests/unit/framework/base/ObjectTest.php b/tests/unit/framework/base/ObjectTest.php index df002cc..9e4944a 100644 --- a/tests/unit/framework/base/ObjectTest.php +++ b/tests/unit/framework/base/ObjectTest.php @@ -17,6 +17,7 @@ class ObjectTest extends TestCase protected function setUp() { parent::setUp(); + $this->mockApplication(); $this->object = new NewObject; } diff --git a/tests/unit/framework/console/controllers/AssetControllerTest.php b/tests/unit/framework/console/controllers/AssetControllerTest.php index 9d7dd28..3e119fc 100644 --- a/tests/unit/framework/console/controllers/AssetControllerTest.php +++ b/tests/unit/framework/console/controllers/AssetControllerTest.php @@ -20,6 +20,7 @@ class AssetControllerTest extends TestCase public function setUp() { + $this->mockApplication(); $this->testFilePath = Yii::getAlias('@yiiunit/runtime') . DIRECTORY_SEPARATOR . get_class($this); $this->createDir($this->testFilePath); $this->testAssetsBasePath = $this->testFilePath . DIRECTORY_SEPARATOR . 'assets'; diff --git a/tests/unit/framework/db/ActiveRecordTest.php b/tests/unit/framework/db/ActiveRecordTest.php index c510cb0..6d88c44 100644 --- a/tests/unit/framework/db/ActiveRecordTest.php +++ b/tests/unit/framework/db/ActiveRecordTest.php @@ -14,6 +14,7 @@ class ActiveRecordTest extends DatabaseTestCase protected function setUp() { parent::setUp(); + $this->mockApplication(); ActiveRecord::$db = $this->getConnection(); } diff --git a/tests/unit/framework/db/CommandTest.php b/tests/unit/framework/db/CommandTest.php index 946c31f..3bd4f4d 100644 --- a/tests/unit/framework/db/CommandTest.php +++ b/tests/unit/framework/db/CommandTest.php @@ -9,6 +9,12 @@ use yii\db\DataReader; class CommandTest extends DatabaseTestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + function testConstruct() { $db = $this->getConnection(false); diff --git a/tests/unit/framework/db/ConnectionTest.php b/tests/unit/framework/db/ConnectionTest.php index d5aa26a..d32c9c7 100644 --- a/tests/unit/framework/db/ConnectionTest.php +++ b/tests/unit/framework/db/ConnectionTest.php @@ -6,6 +6,12 @@ use yii\db\Connection; class ConnectionTest extends DatabaseTestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + function testConstruct() { $connection = $this->getConnection(false); diff --git a/tests/unit/framework/db/DatabaseTestCase.php b/tests/unit/framework/db/DatabaseTestCase.php index 7ce9bec..1fd2d56 100644 --- a/tests/unit/framework/db/DatabaseTestCase.php +++ b/tests/unit/framework/db/DatabaseTestCase.php @@ -12,6 +12,7 @@ abstract class DatabaseTestCase extends TestCase protected function setUp() { parent::setUp(); + $this->mockApplication(); $databases = $this->getParam('databases'); $this->database = $databases[$this->driverName]; $pdo_database = 'pdo_'.$this->driverName; diff --git a/tests/unit/framework/db/QueryBuilderTest.php b/tests/unit/framework/db/QueryBuilderTest.php index 869b501..56cca00 100644 --- a/tests/unit/framework/db/QueryBuilderTest.php +++ b/tests/unit/framework/db/QueryBuilderTest.php @@ -11,6 +11,11 @@ use yii\db\pgsql\QueryBuilder as PgsqlQueryBuilder; class QueryBuilderTest extends DatabaseTestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } /** * @throws \Exception diff --git a/tests/unit/framework/db/QueryTest.php b/tests/unit/framework/db/QueryTest.php index 8362906..237652f 100644 --- a/tests/unit/framework/db/QueryTest.php +++ b/tests/unit/framework/db/QueryTest.php @@ -9,6 +9,12 @@ use yii\db\DataReader; class QueryTest extends DatabaseTestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + function testSelect() { // default