From 3bdb6c31109b15bbc13e760f5a906798c47bab0f Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Sat, 11 May 2013 12:54:13 +0200 Subject: [PATCH] fixed indentation in test files --- tests/unit/DatabaseTestCase.php | 82 ++++++++++++++++++++--------------------- tests/unit/TestCase.php | 4 +- tests/unit/data/config.php | 24 ++++++------ 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/tests/unit/DatabaseTestCase.php b/tests/unit/DatabaseTestCase.php index 0c025e3..9d54173 100644 --- a/tests/unit/DatabaseTestCase.php +++ b/tests/unit/DatabaseTestCase.php @@ -4,48 +4,48 @@ namespace yiiunit; class DatabaseTestCase extends TestCase { - protected $database; - protected $driverName = 'mysql'; - protected $db; + protected $database; + protected $driverName = 'mysql'; + protected $db; - protected function setUp() - { - parent::setUp(); - $databases = $this->getParam('databases'); - $this->database = $databases[$this->driverName]; - $pdo_database = 'pdo_'.$this->driverName; + protected function setUp() + { + parent::setUp(); + $databases = $this->getParam('databases'); + $this->database = $databases[$this->driverName]; + $pdo_database = 'pdo_'.$this->driverName; - if (!extension_loaded('pdo') || !extension_loaded($pdo_database)) { - $this->markTestSkipped('pdo and pdo_'.$pdo_database.' extension are required.'); - } - } + if (!extension_loaded('pdo') || !extension_loaded($pdo_database)) { + $this->markTestSkipped('pdo and pdo_'.$pdo_database.' extension are required.'); + } + } - /** - * @param bool $reset whether to clean up the test database - * @param bool $open whether to open and populate test database - * @return \yii\db\Connection - */ - public function getConnection($reset = true, $open = true) - { - if (!$reset && $this->db) { - return $this->db; - } - $db = new \yii\db\Connection; - $db->dsn = $this->database['dsn']; - if (isset($this->database['username'])) { - $db->username = $this->database['username']; - $db->password = $this->database['password']; - } - if ($open) { - $db->open(); - $lines = explode(';', file_get_contents($this->database['fixture'])); - foreach ($lines as $line) { - if (trim($line) !== '') { - $db->pdo->exec($line); - } - } - } - $this->db = $db; - return $db; - } + /** + * @param bool $reset whether to clean up the test database + * @param bool $open whether to open and populate test database + * @return \yii\db\Connection + */ + public function getConnection($reset = true, $open = true) + { + if (!$reset && $this->db) { + return $this->db; + } + $db = new \yii\db\Connection; + $db->dsn = $this->database['dsn']; + if (isset($this->database['username'])) { + $db->username = $this->database['username']; + $db->password = $this->database['password']; + } + if ($open) { + $db->open(); + $lines = explode(';', file_get_contents($this->database['fixture'])); + foreach ($lines as $line) { + if (trim($line) !== '') { + $db->pdo->exec($line); + } + } + } + $this->db = $db; + return $db; + } } diff --git a/tests/unit/TestCase.php b/tests/unit/TestCase.php index e83e1a8..44cb238 100644 --- a/tests/unit/TestCase.php +++ b/tests/unit/TestCase.php @@ -44,11 +44,11 @@ class TestCase extends \yii\test\TestCase 'id' => 'testapp', 'basePath' => __DIR__, ); - + $appClass = $this->getParam( 'appClass', '\yii\web\Application' ); new $appClass(array_merge($defaultConfig,$config)); } - + /** * Destroys application in Yii::$app by setting it to null. */ diff --git a/tests/unit/data/config.php b/tests/unit/data/config.php index 790521b..3dcf845 100644 --- a/tests/unit/data/config.php +++ b/tests/unit/data/config.php @@ -3,16 +3,16 @@ return array( //'appClass' => '\yii\web\Application', 'appClass' => '\yii\console\Application', - 'databases' => array( - 'mysql' => array( - 'dsn' => 'mysql:host=127.0.0.1;dbname=yiitest', - 'username' => 'travis', - 'password' => '', - 'fixture' => __DIR__ . '/mysql.sql', - ), - 'sqlite' => array( - 'dsn' => 'sqlite::memory:', - 'fixture' => __DIR__ . '/sqlite.sql', - ), - ), + 'databases' => array( + 'mysql' => array( + 'dsn' => 'mysql:host=127.0.0.1;dbname=yiitest', + 'username' => 'travis', + 'password' => '', + 'fixture' => __DIR__ . '/mysql.sql', + ), + 'sqlite' => array( + 'dsn' => 'sqlite::memory:', + 'fixture' => __DIR__ . '/sqlite.sql', + ), + ), );