Commit 0596fa82 by Alexander Makarov

code style fixes

parent edb77393
<?php <?php
return array( return array(
'adminEmail' => 'admin@example.com', 'adminEmail' => 'admin@example.com',
); );
...@@ -34,8 +34,7 @@ AppAsset::register($this); ...@@ -34,8 +34,7 @@ AppAsset::register($this);
); );
if (Yii::$app->user->isGuest) { if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login')); $menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
} } else {
else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')); $menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
} }
echo Nav::widget(array( echo Nav::widget(array(
...@@ -60,7 +59,6 @@ AppAsset::register($this); ...@@ -60,7 +59,6 @@ AppAsset::register($this);
</footer> </footer>
<?php $this->endBody(); ?> <?php $this->endBody(); ?>
</div>
</body> </body>
</html> </html>
<?php $this->endPage(); ?> <?php $this->endPage(); ?>
<?php <?php
return array( return array(
'adminEmail' => 'admin@example.com', 'adminEmail' => 'admin@example.com',
); );
<?php <?php
return array( return array(
'adminEmail' => 'admin@example.com', 'adminEmail' => 'admin@example.com',
); );
...@@ -38,8 +38,7 @@ AppAsset::register($this); ...@@ -38,8 +38,7 @@ AppAsset::register($this);
if (Yii::$app->user->isGuest) { if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Signup', 'url' => array('/site/signup')); $menuItems[] = array('label' => 'Signup', 'url' => array('/site/signup'));
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login')); $menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
} } else {
else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout')); $menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
} }
echo Nav::widget(array( echo Nav::widget(array(
......
...@@ -33,7 +33,7 @@ class ClassmapController extends Controller ...@@ -33,7 +33,7 @@ class ClassmapController extends Controller
$mapFile = YII_PATH . '/classes.php'; $mapFile = YII_PATH . '/classes.php';
} }
$options = array( $options = array(
'filter' => function($path) { 'filter' => function ($path) {
if (is_file($path)) { if (is_file($path)) {
$file = basename($path); $file = basename($path);
if ($file[0] < 'A' || $file[0] > 'Z') { if ($file[0] < 'A' || $file[0] > 'Z') {
......
...@@ -46,7 +46,7 @@ class ViewRenderer extends BaseViewRenderer ...@@ -46,7 +46,7 @@ class ViewRenderer extends BaseViewRenderer
'cache' => Yii::getAlias($this->cachePath), 'cache' => Yii::getAlias($this->cachePath),
), $this->options)); ), $this->options));
$this->twig->addFunction('path', new \Twig_Function_Function(function($path, $args = array()){ $this->twig->addFunction('path', new \Twig_Function_Function(function ($path, $args = array()) {
return Html::url(array_merge(array($path), $args)); return Html::url(array_merge(array($path), $args));
})); }));
......
...@@ -13,7 +13,6 @@ use yii\helpers\Html; ...@@ -13,7 +13,6 @@ use yii\helpers\Html;
use yii\helpers\Json; use yii\helpers\Json;
use yii\widgets\InputWidget; use yii\widgets\InputWidget;
/** /**
* Captcha renders a CAPTCHA image and an input field that takes user-entered verification code. * Captcha renders a CAPTCHA image and an input field that takes user-entered verification code.
* *
......
...@@ -45,7 +45,7 @@ abstract class TestCase extends \yii\test\TestCase ...@@ -45,7 +45,7 @@ abstract class TestCase extends \yii\test\TestCase
'basePath' => __DIR__, 'basePath' => __DIR__,
); );
new $appClass(array_merge($defaultConfig,$config)); new $appClass(array_merge($defaultConfig, $config));
} }
/** /**
......
<?php <?php
namespace yiiunit\data\ar; namespace yiiunit\data\ar;
use yii\db\ActiveQuery; use yii\db\ActiveQuery;
class Customer extends ActiveRecord class Customer extends ActiveRecord
......
...@@ -22,7 +22,7 @@ class Order extends ActiveRecord ...@@ -22,7 +22,7 @@ class Order extends ActiveRecord
public function getItems() public function getItems()
{ {
return $this->hasMany('Item', array('id' => 'item_id')) return $this->hasMany('Item', array('id' => 'item_id'))
->via('orderItems', function($q) { ->via('orderItems', function ($q) {
// additional query configuration // additional query configuration
})->orderBy('id'); })->orderBy('id');
} }
......
<?php <?php
namespace yiiunit\data\base; namespace yiiunit\data\base;
use yii\base\Model; use yii\base\Model;
/** /**
...@@ -13,5 +14,4 @@ class InvalidRulesModel extends Model ...@@ -13,5 +14,4 @@ class InvalidRulesModel extends Model
array('test'), array('test'),
); );
} }
} }
<?php <?php
namespace yiiunit\data\base; namespace yiiunit\data\base;
use yii\base\Model; use yii\base\Model;
/** /**
......
<?php <?php
namespace yiiunit\data\base; namespace yiiunit\data\base;
use yii\base\Model; use yii\base\Model;
/** /**
......
<?php <?php
return array( return array(
'databases' => array( 'databases' => array(
'mysql' => array( 'mysql' => array(
...@@ -23,6 +22,6 @@ return array( ...@@ -23,6 +22,6 @@ return array(
'username' => 'postgres', 'username' => 'postgres',
'password' => 'postgres', 'password' => 'postgres',
'fixture' => __DIR__ . '/postgres.sql', 'fixture' => __DIR__ . '/postgres.sql',
) ),
) ),
); );
...@@ -8,7 +8,6 @@ use yiiunit\TestCase; ...@@ -8,7 +8,6 @@ use yiiunit\TestCase;
class BarClass extends Component class BarClass extends Component
{ {
} }
class FooClass extends Component class FooClass extends Component
......
...@@ -194,7 +194,7 @@ class ComponentTest extends TestCase ...@@ -194,7 +194,7 @@ class ComponentTest extends TestCase
$this->assertFalse($this->component->event->handled); $this->assertFalse($this->component->event->handled);
$eventRaised = false; $eventRaised = false;
$this->component->on('click', function($event) use (&$eventRaised) { $this->component->on('click', function ($event) use (&$eventRaised) {
$eventRaised = true; $eventRaised = true;
}); });
$this->component->raiseEvent(); $this->component->raiseEvent();
...@@ -202,7 +202,7 @@ class ComponentTest extends TestCase ...@@ -202,7 +202,7 @@ class ComponentTest extends TestCase
// raise event w/o parameters // raise event w/o parameters
$eventRaised = false; $eventRaised = false;
$this->component->on('test', function($event) use (&$eventRaised) { $this->component->on('test', function ($event) use (&$eventRaised) {
$eventRaised = true; $eventRaised = true;
}); });
$this->component->trigger('test'); $this->component->trigger('test');
...@@ -331,7 +331,7 @@ class NewComponent extends Component ...@@ -331,7 +331,7 @@ class NewComponent extends Component
public function getExecute() public function getExecute()
{ {
return function($param) { return function ($param) {
return $param * 2; return $param * 2;
}; };
} }
......
<?php <?php
namespace yiiunit\framework\base; namespace yiiunit\framework\base;
use yii\base\Model; use yii\base\Model;
use yiiunit\TestCase; use yiiunit\TestCase;
use yiiunit\data\base\Speaker; use yiiunit\data\base\Speaker;
......
...@@ -175,7 +175,7 @@ class NewObject extends Object ...@@ -175,7 +175,7 @@ class NewObject extends Object
public function getExecute() public function getExecute()
{ {
return function($param) { return function ($param) {
return $param * 2; return $param * 2;
}; };
} }
......
...@@ -26,7 +26,8 @@ class AutoTimestampTest extends TestCase ...@@ -26,7 +26,8 @@ class AutoTimestampTest extends TestCase
} }
} }
public function setUp() { public function setUp()
{
$this->mockApplication( $this->mockApplication(
array( array(
'components' => array( 'components' => array(
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\ApcCache; use yii\caching\ApcCache;
/** /**
...@@ -20,7 +21,7 @@ class ApcCacheTest extends CacheTestCase ...@@ -20,7 +21,7 @@ class ApcCacheTest extends CacheTestCase
$this->markTestSkipped("APC cli is not enabled. Skipping."); $this->markTestSkipped("APC cli is not enabled. Skipping.");
} }
if(!ini_get("apc.enabled") || !ini_get("apc.enable_cli")) { if (!ini_get("apc.enabled") || !ini_get("apc.enable_cli")) {
$this->markTestSkipped("APC is installed but not enabled. Skipping."); $this->markTestSkipped("APC is installed but not enabled. Skipping.");
} }
......
...@@ -6,7 +6,8 @@ namespace yii\caching; ...@@ -6,7 +6,8 @@ namespace yii\caching;
* Mock for the time() function for caching classes * Mock for the time() function for caching classes
* @return int * @return int
*/ */
function time() { function time()
{
return \yiiunit\framework\caching\CacheTestCase::$time ?: \time(); return \yiiunit\framework\caching\CacheTestCase::$time ?: \time();
} }
......
...@@ -35,7 +35,7 @@ class DbCacheTest extends CacheTestCase ...@@ -35,7 +35,7 @@ class DbCacheTest extends CacheTestCase
* @param bool $reset whether to clean up the test database * @param bool $reset whether to clean up the test database
* @return \yii\db\Connection * @return \yii\db\Connection
*/ */
function getConnection($reset = true) public function getConnection($reset = true)
{ {
if ($this->_connection === null) { if ($this->_connection === null) {
$databases = $this->getParam('databases'); $databases = $this->getParam('databases');
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\FileCache; use yii\caching\FileCache;
/** /**
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\MemCache; use yii\caching\MemCache;
/** /**
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\MemCache; use yii\caching\MemCache;
/** /**
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\WinCache; use yii\caching\WinCache;
/** /**
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\XCache; use yii\caching\XCache;
/** /**
......
<?php <?php
namespace yiiunit\framework\caching; namespace yiiunit\framework\caching;
use yii\caching\Cache; use yii\caching\Cache;
use yii\caching\ZendDataCache; use yii\caching\ZendDataCache;
......
...@@ -226,7 +226,7 @@ class AssetControllerTest extends TestCase ...@@ -226,7 +226,7 @@ class AssetControllerTest extends TestCase
'yii', 'yii',
), ),
), ),
);; );
$bundleFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'bundle.php'; $bundleFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'bundle.php';
$configFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'config.php'; $configFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'config.php';
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
*/ */
namespace yiiunit\framework\data; namespace yiiunit\framework\data;
use yii\web\UrlManager; use yii\web\UrlManager;
use yiiunit\TestCase; use yiiunit\TestCase;
use yii\data\Sort; use yii\data\Sort;
/** /**
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
......
...@@ -85,7 +85,7 @@ class ActiveRecordTest extends DatabaseTestCase ...@@ -85,7 +85,7 @@ class ActiveRecordTest extends DatabaseTestCase
$this->assertTrue($customers['user3'] instanceof Customer); $this->assertTrue($customers['user3'] instanceof Customer);
// indexBy callable // indexBy callable
$customers = Customer::find()->indexBy(function($customer) { $customers = Customer::find()->indexBy(function ($customer) {
return $customer->id . '-' . $customer->name; return $customer->id . '-' . $customer->name;
})->orderBy('id')->all(); })->orderBy('id')->all();
$this->assertEquals(3, count($customers)); $this->assertEquals(3, count($customers));
......
...@@ -15,7 +15,7 @@ class CommandTest extends DatabaseTestCase ...@@ -15,7 +15,7 @@ class CommandTest extends DatabaseTestCase
$this->mockApplication(); $this->mockApplication();
} }
function testConstruct() public function testConstruct()
{ {
$db = $this->getConnection(false); $db = $this->getConnection(false);
...@@ -29,7 +29,7 @@ class CommandTest extends DatabaseTestCase ...@@ -29,7 +29,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals($sql, $command->sql); $this->assertEquals($sql, $command->sql);
} }
function testGetSetSql() public function testGetSetSql()
{ {
$db = $this->getConnection(false); $db = $this->getConnection(false);
...@@ -42,7 +42,7 @@ class CommandTest extends DatabaseTestCase ...@@ -42,7 +42,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals($sql2, $command->sql); $this->assertEquals($sql2, $command->sql);
} }
function testAutoQuoting() public function testAutoQuoting()
{ {
$db = $this->getConnection(false); $db = $this->getConnection(false);
...@@ -51,7 +51,7 @@ class CommandTest extends DatabaseTestCase ...@@ -51,7 +51,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals("SELECT `id`, `t`.`name` FROM `tbl_customer` t", $command->sql); $this->assertEquals("SELECT `id`, `t`.`name` FROM `tbl_customer` t", $command->sql);
} }
function testPrepareCancel() public function testPrepareCancel()
{ {
$db = $this->getConnection(false); $db = $this->getConnection(false);
...@@ -63,7 +63,7 @@ class CommandTest extends DatabaseTestCase ...@@ -63,7 +63,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals(null, $command->pdoStatement); $this->assertEquals(null, $command->pdoStatement);
} }
function testExecute() public function testExecute()
{ {
$db = $this->getConnection(); $db = $this->getConnection();
...@@ -80,7 +80,7 @@ class CommandTest extends DatabaseTestCase ...@@ -80,7 +80,7 @@ class CommandTest extends DatabaseTestCase
$command->execute(); $command->execute();
} }
function testQuery() public function testQuery()
{ {
$db = $this->getConnection(); $db = $this->getConnection();
...@@ -141,7 +141,7 @@ class CommandTest extends DatabaseTestCase ...@@ -141,7 +141,7 @@ class CommandTest extends DatabaseTestCase
$command->query(); $command->query();
} }
function testBindParamValue() public function testBindParamValue()
{ {
$db = $this->getConnection(); $db = $this->getConnection();
...@@ -197,7 +197,7 @@ class CommandTest extends DatabaseTestCase ...@@ -197,7 +197,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals('user5@example.com', $command->queryScalar()); $this->assertEquals('user5@example.com', $command->queryScalar());
} }
function testFetchMode() public function testFetchMode()
{ {
$db = $this->getConnection(); $db = $this->getConnection();
...@@ -221,78 +221,63 @@ class CommandTest extends DatabaseTestCase ...@@ -221,78 +221,63 @@ class CommandTest extends DatabaseTestCase
$this->assertTrue(is_array($result) && isset($result[0])); $this->assertTrue(is_array($result) && isset($result[0]));
} }
function testInsert() public function testInsert()
{ {
} }
function testUpdate() public function testUpdate()
{ {
} }
function testDelete() public function testDelete()
{ {
} }
function testCreateTable() public function testCreateTable()
{ {
} }
function testRenameTable() public function testRenameTable()
{ {
} }
function testDropTable() public function testDropTable()
{ {
} }
function testTruncateTable() public function testTruncateTable()
{ {
} }
function testAddColumn() public function testAddColumn()
{ {
} }
function testDropColumn() public function testDropColumn()
{ {
} }
function testRenameColumn() public function testRenameColumn()
{ {
} }
function testAlterColumn() public function testAlterColumn()
{ {
} }
function testAddForeignKey() public function testAddForeignKey()
{ {
} }
function testDropForeignKey() public function testDropForeignKey()
{ {
} }
function testCreateIndex() public function testCreateIndex()
{ {
} }
function testDropIndex() public function testDropIndex()
{ {
} }
} }
...@@ -12,7 +12,7 @@ class ConnectionTest extends DatabaseTestCase ...@@ -12,7 +12,7 @@ class ConnectionTest extends DatabaseTestCase
$this->mockApplication(); $this->mockApplication();
} }
function testConstruct() public function testConstruct()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$params = $this->database; $params = $this->database;
...@@ -22,7 +22,7 @@ class ConnectionTest extends DatabaseTestCase ...@@ -22,7 +22,7 @@ class ConnectionTest extends DatabaseTestCase
$this->assertEquals($params['password'], $connection->password); $this->assertEquals($params['password'], $connection->password);
} }
function testOpenClose() public function testOpenClose()
{ {
$connection = $this->getConnection(false, false); $connection = $this->getConnection(false, false);
...@@ -43,13 +43,13 @@ class ConnectionTest extends DatabaseTestCase ...@@ -43,13 +43,13 @@ class ConnectionTest extends DatabaseTestCase
$connection->open(); $connection->open();
} }
function testGetDriverName() public function testGetDriverName()
{ {
$connection = $this->getConnection(false, false); $connection = $this->getConnection(false, false);
$this->assertEquals($this->driverName, $connection->driverName); $this->assertEquals($this->driverName, $connection->driverName);
} }
function testQuoteValue() public function testQuoteValue()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123)); $this->assertEquals(123, $connection->quoteValue(123));
...@@ -57,7 +57,7 @@ class ConnectionTest extends DatabaseTestCase ...@@ -57,7 +57,7 @@ class ConnectionTest extends DatabaseTestCase
$this->assertEquals("'It\\'s interesting'", $connection->quoteValue("It's interesting")); $this->assertEquals("'It\\'s interesting'", $connection->quoteValue("It's interesting"));
} }
function testQuoteTableName() public function testQuoteTableName()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals('`table`', $connection->quoteTableName('table')); $this->assertEquals('`table`', $connection->quoteTableName('table'));
...@@ -68,7 +68,7 @@ class ConnectionTest extends DatabaseTestCase ...@@ -68,7 +68,7 @@ class ConnectionTest extends DatabaseTestCase
$this->assertEquals('(table)', $connection->quoteTableName('(table)')); $this->assertEquals('(table)', $connection->quoteTableName('(table)'));
} }
function testQuoteColumnName() public function testQuoteColumnName()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals('`column`', $connection->quoteColumnName('column')); $this->assertEquals('`column`', $connection->quoteColumnName('column'));
......
...@@ -129,5 +129,4 @@ class QueryBuilderTest extends DatabaseTestCase ...@@ -129,5 +129,4 @@ class QueryBuilderTest extends DatabaseTestCase
$tableSchema = $qb->db->getSchema()->getTableSchema($tableName); $tableSchema = $qb->db->getSchema()->getTableSchema($tableName);
$this->assertEquals(0, count($tableSchema->primaryKey)); $this->assertEquals(0, count($tableSchema->primaryKey));
} }
} }
...@@ -15,7 +15,7 @@ class QueryTest extends DatabaseTestCase ...@@ -15,7 +15,7 @@ class QueryTest extends DatabaseTestCase
$this->mockApplication(); $this->mockApplication();
} }
function testSelect() public function testSelect()
{ {
// default // default
$query = new Query; $query = new Query;
...@@ -31,14 +31,14 @@ class QueryTest extends DatabaseTestCase ...@@ -31,14 +31,14 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals('something', $query->selectOption); $this->assertEquals('something', $query->selectOption);
} }
function testFrom() public function testFrom()
{ {
$query = new Query; $query = new Query;
$query->from('tbl_user'); $query->from('tbl_user');
$this->assertEquals(array('tbl_user'), $query->from); $this->assertEquals(array('tbl_user'), $query->from);
} }
function testWhere() public function testWhere()
{ {
$query = new Query; $query = new Query;
$query->where('id = :id', array(':id' => 1)); $query->where('id = :id', array(':id' => 1));
...@@ -54,12 +54,11 @@ class QueryTest extends DatabaseTestCase ...@@ -54,12 +54,11 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array(':id' => 1, ':name' => 'something', ':age' => '30'), $query->params); $this->assertEquals(array(':id' => 1, ':name' => 'something', ':age' => '30'), $query->params);
} }
function testJoin() public function testJoin()
{ {
} }
function testGroup() public function testGroup()
{ {
$query = new Query; $query = new Query;
$query->groupBy('team'); $query->groupBy('team');
...@@ -72,7 +71,7 @@ class QueryTest extends DatabaseTestCase ...@@ -72,7 +71,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array('team', 'company', 'age'), $query->groupBy); $this->assertEquals(array('team', 'company', 'age'), $query->groupBy);
} }
function testHaving() public function testHaving()
{ {
$query = new Query; $query = new Query;
$query->having('id = :id', array(':id' => 1)); $query->having('id = :id', array(':id' => 1));
...@@ -88,7 +87,7 @@ class QueryTest extends DatabaseTestCase ...@@ -88,7 +87,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array(':id' => 1, ':name' => 'something', ':age' => '30'), $query->params); $this->assertEquals(array(':id' => 1, ':name' => 'something', ':age' => '30'), $query->params);
} }
function testOrder() public function testOrder()
{ {
$query = new Query; $query = new Query;
$query->orderBy('team'); $query->orderBy('team');
...@@ -107,7 +106,7 @@ class QueryTest extends DatabaseTestCase ...@@ -107,7 +106,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array('team' => false, 'company' => true, 'age' => false), $query->orderBy); $this->assertEquals(array('team' => false, 'company' => true, 'age' => false), $query->orderBy);
} }
function testLimitOffset() public function testLimitOffset()
{ {
$query = new Query; $query = new Query;
$query->limit(10)->offset(5); $query->limit(10)->offset(5);
...@@ -115,8 +114,7 @@ class QueryTest extends DatabaseTestCase ...@@ -115,8 +114,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(5, $query->offset); $this->assertEquals(5, $query->offset);
} }
function testUnion() public function testUnion()
{ {
} }
} }
...@@ -12,7 +12,7 @@ class MssqlCommandTest extends CommandTest ...@@ -12,7 +12,7 @@ class MssqlCommandTest extends CommandTest
parent::setUp(); parent::setUp();
} }
function testAutoQuoting() public function testAutoQuoting()
{ {
$db = $this->getConnection(false); $db = $this->getConnection(false);
...@@ -21,12 +21,12 @@ class MssqlCommandTest extends CommandTest ...@@ -21,12 +21,12 @@ class MssqlCommandTest extends CommandTest
$this->assertEquals("SELECT [id], [t].[name] FROM [tbl_customer] t", $command->sql); $this->assertEquals("SELECT [id], [t].[name] FROM [tbl_customer] t", $command->sql);
} }
function testPrepareCancel() public function testPrepareCancel()
{ {
$this->markTestSkipped('MSSQL driver does not support this feature.'); $this->markTestSkipped('MSSQL driver does not support this feature.');
} }
function testBindParamValue() public function testBindParamValue()
{ {
$db = $this->getConnection(); $db = $this->getConnection();
......
...@@ -12,7 +12,7 @@ class MssqlConnectionTest extends ConnectionTest ...@@ -12,7 +12,7 @@ class MssqlConnectionTest extends ConnectionTest
parent::setUp(); parent::setUp();
} }
function testQuoteValue() public function testQuoteValue()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123)); $this->assertEquals(123, $connection->quoteValue(123));
...@@ -20,7 +20,7 @@ class MssqlConnectionTest extends ConnectionTest ...@@ -20,7 +20,7 @@ class MssqlConnectionTest extends ConnectionTest
$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting")); $this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
} }
function testQuoteTableName() public function testQuoteTableName()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals('[table]', $connection->quoteTableName('table')); $this->assertEquals('[table]', $connection->quoteTableName('table'));
...@@ -31,7 +31,7 @@ class MssqlConnectionTest extends ConnectionTest ...@@ -31,7 +31,7 @@ class MssqlConnectionTest extends ConnectionTest
$this->assertEquals('(table)', $connection->quoteTableName('(table)')); $this->assertEquals('(table)', $connection->quoteTableName('(table)'));
} }
function testQuoteColumnName() public function testQuoteColumnName()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals('[column]', $connection->quoteColumnName('column')); $this->assertEquals('[column]', $connection->quoteColumnName('column'));
......
<?php <?php
namespace yiiunit\framework\db\pgsql; namespace yiiunit\framework\db\pgsql;
use yiiunit\framework\db\ConnectionTest; use yiiunit\framework\db\ConnectionTest;
class PostgreSQLConnectionTest extends ConnectionTest { class PostgreSQLConnectionTest extends ConnectionTest
{
public function setUp() { public function setUp()
{
$this->driverName = 'pgsql'; $this->driverName = 'pgsql';
parent::setUp(); parent::setUp();
} }
public function testConnection() { public function testConnection()
{
$connection = $this->getConnection(true); $connection = $this->getConnection(true);
} }
function testQuoteValue() { public function testQuoteValue()
{
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123)); $this->assertEquals(123, $connection->quoteValue(123));
$this->assertEquals("'string'", $connection->quoteValue('string')); $this->assertEquals("'string'", $connection->quoteValue('string'));
$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting")); $this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
} }
function testQuoteTableName() public function testQuoteTableName()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals('"table"', $connection->quoteTableName('table')); $this->assertEquals('"table"', $connection->quoteTableName('table'));
...@@ -34,7 +36,7 @@ class PostgreSQLConnectionTest extends ConnectionTest { ...@@ -34,7 +36,7 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$this->assertEquals('(table)', $connection->quoteTableName('(table)')); $this->assertEquals('(table)', $connection->quoteTableName('(table)'));
} }
function testQuoteColumnName() public function testQuoteColumnName()
{ {
$connection = $this->getConnection(false); $connection = $this->getConnection(false);
$this->assertEquals('"column"', $connection->quoteColumnName('column')); $this->assertEquals('"column"', $connection->quoteColumnName('column'));
...@@ -46,6 +48,4 @@ class PostgreSQLConnectionTest extends ConnectionTest { ...@@ -46,6 +48,4 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}')); $this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
$this->assertEquals('(column)', $connection->quoteColumnName('(column)')); $this->assertEquals('(column)', $connection->quoteColumnName('(column)'));
} }
} }
...@@ -72,5 +72,4 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest ...@@ -72,5 +72,4 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
array(Schema::TYPE_MONEY . ' NOT NULL', 'numeric(19,4) NOT NULL'), array(Schema::TYPE_MONEY . ' NOT NULL', 'numeric(19,4) NOT NULL'),
); );
} }
} }
...@@ -78,5 +78,4 @@ class SqliteQueryBuilderTest extends QueryBuilderTest ...@@ -78,5 +78,4 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
$this->setExpectedException('yii\base\NotSupportedException'); $this->setExpectedException('yii\base\NotSupportedException');
parent::testAddDropPrimayKey(); parent::testAddDropPrimayKey();
} }
} }
...@@ -75,5 +75,4 @@ class ConsoleTest extends TestCase ...@@ -75,5 +75,4 @@ class ConsoleTest extends TestCase
sleep(1); sleep(1);
} }
}*/ }*/
} }
...@@ -100,7 +100,7 @@ class FileHelperTest extends TestCase ...@@ -100,7 +100,7 @@ class FileHelperTest extends TestCase
* @param string $fileName file name. * @param string $fileName file name.
* @param string $message error message * @param string $message error message
*/ */
protected function assertFileMode($expectedMode, $fileName, $message='') protected function assertFileMode($expectedMode, $fileName, $message = '')
{ {
$expectedMode = sprintf('%o', $expectedMode); $expectedMode = sprintf('%o', $expectedMode);
$this->assertEquals($expectedMode, $this->getMode($fileName), $message); $this->assertEquals($expectedMode, $this->getMode($fileName), $message);
...@@ -236,7 +236,7 @@ class FileHelperTest extends TestCase ...@@ -236,7 +236,7 @@ class FileHelperTest extends TestCase
$dirName = $basePath . DIRECTORY_SEPARATOR . $dirName; $dirName = $basePath . DIRECTORY_SEPARATOR . $dirName;
$options = array( $options = array(
'filter' => function($path) use ($passedFileName) { 'filter' => function ($path) use ($passedFileName) {
return $passedFileName == basename($path); return $passedFileName == basename($path);
} }
); );
...@@ -268,7 +268,8 @@ class FileHelperTest extends TestCase ...@@ -268,7 +268,8 @@ class FileHelperTest extends TestCase
$this->assertEquals(array($dirName . DIRECTORY_SEPARATOR . $fileName), $foundFiles); $this->assertEquals(array($dirName . DIRECTORY_SEPARATOR . $fileName), $foundFiles);
} }
public function testMkdir() { public function testMkdir()
{
$basePath = $this->testFilePath; $basePath = $this->testFilePath;
$dirName = $basePath . DIRECTORY_SEPARATOR . 'test_dir_level_1' . DIRECTORY_SEPARATOR . 'test_dir_level_2'; $dirName = $basePath . DIRECTORY_SEPARATOR . 'test_dir_level_1' . DIRECTORY_SEPARATOR . 'test_dir_level_2';
FileHelper::mkdir($dirName); FileHelper::mkdir($dirName);
......
...@@ -414,7 +414,7 @@ EOD; ...@@ -414,7 +414,7 @@ EOD;
EOD; EOD;
$this->assertEqualsWithoutLE($expected, Html::ul($data, array( $this->assertEqualsWithoutLE($expected, Html::ul($data, array(
'class' => 'test', 'class' => 'test',
'item' => function($item, $index) { 'item' => function ($item, $index) {
return "<li class=\"item-$index\">$item</li>"; return "<li class=\"item-$index\">$item</li>";
} }
))); )));
...@@ -444,7 +444,7 @@ EOD; ...@@ -444,7 +444,7 @@ EOD;
EOD; EOD;
$this->assertEqualsWithoutLE($expected, Html::ol($data, array( $this->assertEqualsWithoutLE($expected, Html::ol($data, array(
'class' => 'test', 'class' => 'test',
'item' => function($item, $index) { 'item' => function ($item, $index) {
return "<li class=\"item-$index\">$item</li>"; return "<li class=\"item-$index\">$item</li>";
} }
))); )));
......
...@@ -23,7 +23,8 @@ class JsonTest extends TestCase ...@@ -23,7 +23,8 @@ class JsonTest extends TestCase
// simple object encoding // simple object encoding
$data = new \stdClass(); $data = new \stdClass();
$data->a = 1; $data->b = 2; $data->a = 1;
$data->b = 2;
$this->assertSame('{"a":1,"b":2}', Json::encode($data)); $this->assertSame('{"a":1,"b":2}', Json::encode($data));
// expression encoding // expression encoding
......
<?php <?php
namespace yiiunit\framework\helpers; namespace yiiunit\framework\helpers;
use \yii\helpers\StringHelper as StringHelper; use \yii\helpers\StringHelper as StringHelper;
use yii\test\TestCase; use yii\test\TestCase;
......
<?php <?php
namespace yiiunit\framework\helpers; namespace yiiunit\framework\helpers;
use \yii\helpers\VarDumper; use \yii\helpers\VarDumper;
use yii\test\TestCase; use yii\test\TestCase;
......
...@@ -60,7 +60,8 @@ class YiiRequirementCheckerTest extends TestCase ...@@ -60,7 +60,8 @@ class YiiRequirementCheckerTest extends TestCase
/** /**
* @depends testCheck * @depends testCheck
*/ */
public function testCheckEval() { public function testCheckEval()
{
$requirementsChecker = new YiiRequirementChecker(); $requirementsChecker = new YiiRequirementChecker();
$requirements = array( $requirements = array(
......
<?php <?php
namespace yiiunit\framework\validators; namespace yiiunit\framework\validators;
use yii\validators\EmailValidator; use yii\validators\EmailValidator;
use yiiunit\TestCase; use yiiunit\TestCase;
......
...@@ -33,6 +33,6 @@ class SpacelessTest extends \yiiunit\TestCase ...@@ -33,6 +33,6 @@ class SpacelessTest extends \yiiunit\TestCase
$expected="<body>\n<div class='wrapper'><div class='left-column'><p>This is a left bar!</p>". $expected="<body>\n<div class='wrapper'><div class='left-column'><p>This is a left bar!</p>".
"</div><div class='right-column'><p>This is a right bar!</p></div></div>\t<p>Bye!</p>\n</body>\n"; "</div><div class='right-column'><p>This is a right bar!</p></div></div>\t<p>Bye!</p>\n</body>\n";
$this->assertEquals($expected,ob_get_clean()); $this->assertEquals($expected, ob_get_clean());
} }
} }
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