From 544e412af824487bba1911b509a25f1d7ee99108 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 6 Sep 2013 15:03:25 +0200 Subject: [PATCH] unit test cleanup --- tests/unit/framework/db/CommandTest.php | 6 ------ tests/unit/framework/db/ConnectionTest.php | 6 ------ tests/unit/framework/db/DatabaseTestCase.php | 3 ++- tests/unit/framework/db/QueryBuilderTest.php | 6 ------ tests/unit/framework/db/QueryTest.php | 6 ------ tests/unit/framework/db/cubrid/CubridActiveRecordTest.php | 6 +----- tests/unit/framework/db/cubrid/CubridCommandTest.php | 6 +----- tests/unit/framework/db/cubrid/CubridConnectionTest.php | 6 +----- tests/unit/framework/db/cubrid/CubridQueryTest.php | 6 +----- tests/unit/framework/db/mssql/MssqlActiveRecordTest.php | 6 +----- tests/unit/framework/db/mssql/MssqlCommandTest.php | 6 +----- tests/unit/framework/db/mssql/MssqlConnectionTest.php | 6 +----- tests/unit/framework/db/mssql/MssqlQueryTest.php | 6 +----- tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php | 6 +----- tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php | 6 +----- tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php | 2 -- tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php | 6 +----- tests/unit/framework/db/sqlite/SqliteCommandTest.php | 6 +----- tests/unit/framework/db/sqlite/SqliteConnectionTest.php | 6 +----- tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php | 2 +- tests/unit/framework/db/sqlite/SqliteQueryTest.php | 6 +----- 21 files changed, 17 insertions(+), 98 deletions(-) diff --git a/tests/unit/framework/db/CommandTest.php b/tests/unit/framework/db/CommandTest.php index 52fd046..229545d 100644 --- a/tests/unit/framework/db/CommandTest.php +++ b/tests/unit/framework/db/CommandTest.php @@ -9,12 +9,6 @@ use yii\db\DataReader; class CommandTest extends DatabaseTestCase { - protected function setUp() - { - parent::setUp(); - $this->mockApplication(); - } - public function testConstruct() { $db = $this->getConnection(false); diff --git a/tests/unit/framework/db/ConnectionTest.php b/tests/unit/framework/db/ConnectionTest.php index 42b470b..f2895f1 100644 --- a/tests/unit/framework/db/ConnectionTest.php +++ b/tests/unit/framework/db/ConnectionTest.php @@ -6,12 +6,6 @@ use yii\db\Connection; class ConnectionTest extends DatabaseTestCase { - protected function setUp() - { - parent::setUp(); - $this->mockApplication(); - } - public function testConstruct() { $connection = $this->getConnection(false); diff --git a/tests/unit/framework/db/DatabaseTestCase.php b/tests/unit/framework/db/DatabaseTestCase.php index 1dd8cfc..d8d2916 100644 --- a/tests/unit/framework/db/DatabaseTestCase.php +++ b/tests/unit/framework/db/DatabaseTestCase.php @@ -16,7 +16,6 @@ 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; @@ -24,6 +23,7 @@ abstract class DatabaseTestCase extends TestCase if (!extension_loaded('pdo') || !extension_loaded($pdo_database)) { $this->markTestSkipped('pdo and pdo_'.$pdo_database.' extension are required.'); } + $this->mockApplication(); } protected function tearDown() @@ -31,6 +31,7 @@ abstract class DatabaseTestCase extends TestCase if ($this->db) { $this->db->close(); } + $this->destroyApplication(); } /** diff --git a/tests/unit/framework/db/QueryBuilderTest.php b/tests/unit/framework/db/QueryBuilderTest.php index 81a8156..a2815e8 100644 --- a/tests/unit/framework/db/QueryBuilderTest.php +++ b/tests/unit/framework/db/QueryBuilderTest.php @@ -12,12 +12,6 @@ use yii\db\cubrid\QueryBuilder as CubridQueryBuilder; class QueryBuilderTest extends DatabaseTestCase { - protected function setUp() - { - parent::setUp(); - $this->mockApplication(); - } - /** * @throws \Exception * @return QueryBuilder diff --git a/tests/unit/framework/db/QueryTest.php b/tests/unit/framework/db/QueryTest.php index 5d1f1a9..dfb6c9f 100644 --- a/tests/unit/framework/db/QueryTest.php +++ b/tests/unit/framework/db/QueryTest.php @@ -9,12 +9,6 @@ use yii\db\DataReader; class QueryTest extends DatabaseTestCase { - protected function setUp() - { - parent::setUp(); - $this->mockApplication(); - } - public function testSelect() { // default diff --git a/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php b/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php index b30880b..6633e11 100644 --- a/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php +++ b/tests/unit/framework/db/cubrid/CubridActiveRecordTest.php @@ -5,9 +5,5 @@ use yiiunit\framework\db\ActiveRecordTest; class CubridActiveRecordTest extends ActiveRecordTest { - protected function setUp() - { - $this->driverName = 'cubrid'; - parent::setUp(); - } + public $driverName = 'cubrid'; } diff --git a/tests/unit/framework/db/cubrid/CubridCommandTest.php b/tests/unit/framework/db/cubrid/CubridCommandTest.php index 6f10113..5fe8848 100644 --- a/tests/unit/framework/db/cubrid/CubridCommandTest.php +++ b/tests/unit/framework/db/cubrid/CubridCommandTest.php @@ -5,11 +5,7 @@ use yiiunit\framework\db\CommandTest; class CubridCommandTest extends CommandTest { - protected function setUp() - { - $this->driverName = 'cubrid'; - parent::setUp(); - } + public $driverName = 'cubrid'; public function testBindParamValue() { diff --git a/tests/unit/framework/db/cubrid/CubridConnectionTest.php b/tests/unit/framework/db/cubrid/CubridConnectionTest.php index bfd2c90..6924883 100644 --- a/tests/unit/framework/db/cubrid/CubridConnectionTest.php +++ b/tests/unit/framework/db/cubrid/CubridConnectionTest.php @@ -5,11 +5,7 @@ use yiiunit\framework\db\ConnectionTest; class CubridConnectionTest extends ConnectionTest { - protected function setUp() - { - $this->driverName = 'cubrid'; - parent::setUp(); - } + public $driverName = 'cubrid'; public function testQuoteValue() { diff --git a/tests/unit/framework/db/cubrid/CubridQueryTest.php b/tests/unit/framework/db/cubrid/CubridQueryTest.php index 0503fbc..2c68a35 100644 --- a/tests/unit/framework/db/cubrid/CubridQueryTest.php +++ b/tests/unit/framework/db/cubrid/CubridQueryTest.php @@ -5,9 +5,5 @@ use yiiunit\framework\db\QueryTest; class CubridQueryTest extends QueryTest { - protected function setUp() - { - $this->driverName = 'cubrid'; - parent::setUp(); - } + public $driverName = 'cubrid'; } diff --git a/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php b/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php index 5647411..92e4da2 100644 --- a/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php +++ b/tests/unit/framework/db/mssql/MssqlActiveRecordTest.php @@ -6,9 +6,5 @@ use yiiunit\framework\db\ActiveRecordTest; class MssqlActiveRecordTest extends ActiveRecordTest { - protected function setUp() - { - $this->driverName = 'sqlsrv'; - parent::setUp(); - } + protected $driverName = 'sqlsrv'; } diff --git a/tests/unit/framework/db/mssql/MssqlCommandTest.php b/tests/unit/framework/db/mssql/MssqlCommandTest.php index e27fcee..1908f65 100644 --- a/tests/unit/framework/db/mssql/MssqlCommandTest.php +++ b/tests/unit/framework/db/mssql/MssqlCommandTest.php @@ -6,11 +6,7 @@ use yiiunit\framework\db\CommandTest; class MssqlCommandTest extends CommandTest { - public function setUp() - { - $this->driverName = 'sqlsrv'; - parent::setUp(); - } + protected $driverName = 'sqlsrv'; public function testAutoQuoting() { diff --git a/tests/unit/framework/db/mssql/MssqlConnectionTest.php b/tests/unit/framework/db/mssql/MssqlConnectionTest.php index 7bbaae7..854c81f 100644 --- a/tests/unit/framework/db/mssql/MssqlConnectionTest.php +++ b/tests/unit/framework/db/mssql/MssqlConnectionTest.php @@ -6,11 +6,7 @@ use yiiunit\framework\db\ConnectionTest; class MssqlConnectionTest extends ConnectionTest { - public function setUp() - { - $this->driverName = 'sqlsrv'; - parent::setUp(); - } + protected $driverName = 'sqlsrv'; public function testQuoteValue() { diff --git a/tests/unit/framework/db/mssql/MssqlQueryTest.php b/tests/unit/framework/db/mssql/MssqlQueryTest.php index 4f37c14..e07ac1d 100644 --- a/tests/unit/framework/db/mssql/MssqlQueryTest.php +++ b/tests/unit/framework/db/mssql/MssqlQueryTest.php @@ -6,9 +6,5 @@ use yiiunit\framework\db\QueryTest; class MssqlQueryTest extends QueryTest { - public function setUp() - { - $this->driverName = 'sqlsrv'; - parent::setUp(); - } + protected $driverName = 'sqlsrv'; } diff --git a/tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php b/tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php index 2836223..aef09fd 100644 --- a/tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php +++ b/tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php @@ -6,9 +6,5 @@ use yiiunit\framework\db\ActiveRecordTest; class PostgreSQLActiveRecordTest extends ActiveRecordTest { - protected function setUp() - { - $this->driverName = 'pgsql'; - parent::setUp(); - } + protected $driverName = 'pgsql'; } diff --git a/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php b/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php index 7ac65c5..cd76a97 100644 --- a/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php +++ b/tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php @@ -5,11 +5,7 @@ use yiiunit\framework\db\ConnectionTest; class PostgreSQLConnectionTest extends ConnectionTest { - public function setUp() - { - $this->driverName = 'pgsql'; - parent::setUp(); - } + protected $driverName = 'pgsql'; public function testConnection() { diff --git a/tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php b/tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php index 7c31190..bf2dd73 100644 --- a/tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php +++ b/tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php @@ -2,13 +2,11 @@ namespace yiiunit\framework\db\pgsql; -use yii\base\NotSupportedException; use yii\db\pgsql\Schema; use yiiunit\framework\db\QueryBuilderTest; class PostgreSQLQueryBuilderTest extends QueryBuilderTest { - public $driverName = 'pgsql'; public function columnTypes() diff --git a/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php b/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php index 2e76162..1088280 100644 --- a/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php +++ b/tests/unit/framework/db/sqlite/SqliteActiveRecordTest.php @@ -5,9 +5,5 @@ use yiiunit\framework\db\ActiveRecordTest; class SqliteActiveRecordTest extends ActiveRecordTest { - protected function setUp() - { - $this->driverName = 'sqlite'; - parent::setUp(); - } + protected $driverName = 'sqlite'; } diff --git a/tests/unit/framework/db/sqlite/SqliteCommandTest.php b/tests/unit/framework/db/sqlite/SqliteCommandTest.php index e330c7e..af9a323 100644 --- a/tests/unit/framework/db/sqlite/SqliteCommandTest.php +++ b/tests/unit/framework/db/sqlite/SqliteCommandTest.php @@ -5,11 +5,7 @@ use yiiunit\framework\db\CommandTest; class SqliteCommandTest extends CommandTest { - protected function setUp() - { - $this->driverName = 'sqlite'; - parent::setUp(); - } + protected $driverName = 'sqlite'; public function testAutoQuoting() { diff --git a/tests/unit/framework/db/sqlite/SqliteConnectionTest.php b/tests/unit/framework/db/sqlite/SqliteConnectionTest.php index 2065200..f1d5b94 100644 --- a/tests/unit/framework/db/sqlite/SqliteConnectionTest.php +++ b/tests/unit/framework/db/sqlite/SqliteConnectionTest.php @@ -5,11 +5,7 @@ use yiiunit\framework\db\ConnectionTest; class SqliteConnectionTest extends ConnectionTest { - protected function setUp() - { - $this->driverName = 'sqlite'; - parent::setUp(); - } + protected $driverName = 'sqlite'; public function testConstruct() { diff --git a/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php b/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php index 3291187..2e3a615 100644 --- a/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php +++ b/tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php @@ -8,7 +8,7 @@ use yiiunit\framework\db\QueryBuilderTest; class SqliteQueryBuilderTest extends QueryBuilderTest { - public $driverName = 'sqlite'; + protected $driverName = 'sqlite'; public function columnTypes() { diff --git a/tests/unit/framework/db/sqlite/SqliteQueryTest.php b/tests/unit/framework/db/sqlite/SqliteQueryTest.php index ebbb1bb..3f112dc 100644 --- a/tests/unit/framework/db/sqlite/SqliteQueryTest.php +++ b/tests/unit/framework/db/sqlite/SqliteQueryTest.php @@ -5,9 +5,5 @@ use yiiunit\framework\db\QueryTest; class SqliteQueryTest extends QueryTest { - protected function setUp() - { - $this->driverName = 'sqlite'; - parent::setUp(); - } + protected $driverName = 'sqlite'; }