Browse Source

code style fixes

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
0596fa82fd
  1. 1
      apps/advanced/backend/config/params.php
  2. 4
      apps/advanced/backend/views/layouts/main.php
  3. 1
      apps/advanced/console/config/params.php
  4. 1
      apps/advanced/frontend/config/params.php
  5. 3
      apps/advanced/frontend/views/layouts/main.php
  6. 1
      framework/yii/captcha/Captcha.php
  7. 2
      tests/unit/data/ar/Customer.php
  8. 2
      tests/unit/data/base/InvalidRulesModel.php
  9. 1
      tests/unit/data/base/Singer.php
  10. 1
      tests/unit/data/base/Speaker.php
  11. 5
      tests/unit/data/config.php
  12. 1
      tests/unit/framework/base/BehaviorTest.php
  13. 1
      tests/unit/framework/base/ModelTest.php
  14. 3
      tests/unit/framework/behaviors/AutoTimestampTest.php
  15. 1
      tests/unit/framework/caching/ApcCacheTest.php
  16. 3
      tests/unit/framework/caching/CacheTestCase.php
  17. 2
      tests/unit/framework/caching/DbCacheTest.php
  18. 1
      tests/unit/framework/caching/FileCacheTest.php
  19. 1
      tests/unit/framework/caching/MemCacheTest.php
  20. 1
      tests/unit/framework/caching/MemCachedTest.php
  21. 1
      tests/unit/framework/caching/WinCacheTest.php
  22. 1
      tests/unit/framework/caching/XCacheTest.php
  23. 1
      tests/unit/framework/caching/ZendDataCacheTest.php
  24. 2
      tests/unit/framework/console/controllers/AssetControllerTest.php
  25. 2
      tests/unit/framework/data/SortTest.php
  26. 61
      tests/unit/framework/db/CommandTest.php
  27. 12
      tests/unit/framework/db/ConnectionTest.php
  28. 1
      tests/unit/framework/db/QueryBuilderTest.php
  29. 20
      tests/unit/framework/db/QueryTest.php
  30. 6
      tests/unit/framework/db/mssql/MssqlCommandTest.php
  31. 6
      tests/unit/framework/db/mssql/MssqlConnectionTest.php
  32. 20
      tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
  33. 1
      tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
  34. 1
      tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
  35. 1
      tests/unit/framework/helpers/ConsoleTest.php
  36. 3
      tests/unit/framework/helpers/FileHelperTest.php
  37. 3
      tests/unit/framework/helpers/JsonTest.php
  38. 1
      tests/unit/framework/helpers/StringHelperTest.php
  39. 1
      tests/unit/framework/helpers/VarDumperTest.php
  40. 3
      tests/unit/framework/requirements/YiiRequirementCheckerTest.php
  41. 1
      tests/unit/framework/validators/EmailValidatorTest.php

1
apps/advanced/backend/config/params.php

@ -1,5 +1,4 @@
<?php
return array(
'adminEmail' => 'admin@example.com',
);

4
apps/advanced/backend/views/layouts/main.php

@ -34,8 +34,7 @@ AppAsset::register($this);
);
if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
}
else {
} else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
}
echo Nav::widget(array(
@ -60,7 +59,6 @@ AppAsset::register($this);
</footer>
<?php $this->endBody(); ?>
</div>
</body>
</html>
<?php $this->endPage(); ?>

1
apps/advanced/console/config/params.php

@ -1,5 +1,4 @@
<?php
return array(
'adminEmail' => 'admin@example.com',
);

1
apps/advanced/frontend/config/params.php

@ -1,5 +1,4 @@
<?php
return array(
'adminEmail' => 'admin@example.com',
);

3
apps/advanced/frontend/views/layouts/main.php

@ -38,8 +38,7 @@ AppAsset::register($this);
if (Yii::$app->user->isGuest) {
$menuItems[] = array('label' => 'Signup', 'url' => array('/site/signup'));
$menuItems[] = array('label' => 'Login', 'url' => array('/site/login'));
}
else {
} else {
$menuItems[] = array('label' => 'Logout (' . Yii::$app->user->identity->username .')' , 'url' => array('/site/logout'));
}
echo Nav::widget(array(

1
framework/yii/captcha/Captcha.php

@ -13,7 +13,6 @@ use yii\helpers\Html;
use yii\helpers\Json;
use yii\widgets\InputWidget;
/**
* Captcha renders a CAPTCHA image and an input field that takes user-entered verification code.
*

2
tests/unit/data/ar/Customer.php

@ -1,6 +1,6 @@
<?php
namespace yiiunit\data\ar;
use yii\db\ActiveQuery;
class Customer extends ActiveRecord

2
tests/unit/data/base/InvalidRulesModel.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\data\base;
use yii\base\Model;
/**
@ -13,5 +14,4 @@ class InvalidRulesModel extends Model
array('test'),
);
}
}

1
tests/unit/data/base/Singer.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\data\base;
use yii\base\Model;
/**

1
tests/unit/data/base/Speaker.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\data\base;
use yii\base\Model;
/**

5
tests/unit/data/config.php

@ -1,5 +1,4 @@
<?php
return array(
'databases' => array(
'mysql' => array(
@ -23,6 +22,6 @@ return array(
'username' => 'postgres',
'password' => 'postgres',
'fixture' => __DIR__ . '/postgres.sql',
)
)
),
),
);

1
tests/unit/framework/base/BehaviorTest.php

@ -8,7 +8,6 @@ use yiiunit\TestCase;
class BarClass extends Component
{
}
class FooClass extends Component

1
tests/unit/framework/base/ModelTest.php

@ -1,6 +1,7 @@
<?php
namespace yiiunit\framework\base;
use yii\base\Model;
use yiiunit\TestCase;
use yiiunit\data\base\Speaker;

3
tests/unit/framework/behaviors/AutoTimestampTest.php

@ -26,7 +26,8 @@ class AutoTimestampTest extends TestCase
}
}
public function setUp() {
public function setUp()
{
$this->mockApplication(
array(
'components' => array(

1
tests/unit/framework/caching/ApcCacheTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\ApcCache;
/**

3
tests/unit/framework/caching/CacheTestCase.php

@ -6,7 +6,8 @@ namespace yii\caching;
* Mock for the time() function for caching classes
* @return int
*/
function time() {
function time()
{
return \yiiunit\framework\caching\CacheTestCase::$time ?: \time();
}

2
tests/unit/framework/caching/DbCacheTest.php

@ -35,7 +35,7 @@ class DbCacheTest extends CacheTestCase
* @param bool $reset whether to clean up the test database
* @return \yii\db\Connection
*/
function getConnection($reset = true)
public function getConnection($reset = true)
{
if ($this->_connection === null) {
$databases = $this->getParam('databases');

1
tests/unit/framework/caching/FileCacheTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\FileCache;
/**

1
tests/unit/framework/caching/MemCacheTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\MemCache;
/**

1
tests/unit/framework/caching/MemCachedTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\MemCache;
/**

1
tests/unit/framework/caching/WinCacheTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\WinCache;
/**

1
tests/unit/framework/caching/XCacheTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\XCache;
/**

1
tests/unit/framework/caching/ZendDataCacheTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\caching;
use yii\caching\Cache;
use yii\caching\ZendDataCache;

2
tests/unit/framework/console/controllers/AssetControllerTest.php

@ -226,7 +226,7 @@ class AssetControllerTest extends TestCase
'yii',
),
),
);;
);
$bundleFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'bundle.php';
$configFile = $this->testFilePath . DIRECTORY_SEPARATOR . 'config.php';

2
tests/unit/framework/data/SortTest.php

@ -6,11 +6,11 @@
*/
namespace yiiunit\framework\data;
use yii\web\UrlManager;
use yiiunit\TestCase;
use yii\data\Sort;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0

61
tests/unit/framework/db/CommandTest.php

@ -15,7 +15,7 @@ class CommandTest extends DatabaseTestCase
$this->mockApplication();
}
function testConstruct()
public function testConstruct()
{
$db = $this->getConnection(false);
@ -29,7 +29,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals($sql, $command->sql);
}
function testGetSetSql()
public function testGetSetSql()
{
$db = $this->getConnection(false);
@ -42,7 +42,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals($sql2, $command->sql);
}
function testAutoQuoting()
public function testAutoQuoting()
{
$db = $this->getConnection(false);
@ -51,7 +51,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals("SELECT `id`, `t`.`name` FROM `tbl_customer` t", $command->sql);
}
function testPrepareCancel()
public function testPrepareCancel()
{
$db = $this->getConnection(false);
@ -63,7 +63,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals(null, $command->pdoStatement);
}
function testExecute()
public function testExecute()
{
$db = $this->getConnection();
@ -80,7 +80,7 @@ class CommandTest extends DatabaseTestCase
$command->execute();
}
function testQuery()
public function testQuery()
{
$db = $this->getConnection();
@ -141,7 +141,7 @@ class CommandTest extends DatabaseTestCase
$command->query();
}
function testBindParamValue()
public function testBindParamValue()
{
$db = $this->getConnection();
@ -197,7 +197,7 @@ class CommandTest extends DatabaseTestCase
$this->assertEquals('user5@example.com', $command->queryScalar());
}
function testFetchMode()
public function testFetchMode()
{
$db = $this->getConnection();
@ -221,78 +221,63 @@ class CommandTest extends DatabaseTestCase
$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
tests/unit/framework/db/ConnectionTest.php

@ -12,7 +12,7 @@ class ConnectionTest extends DatabaseTestCase
$this->mockApplication();
}
function testConstruct()
public function testConstruct()
{
$connection = $this->getConnection(false);
$params = $this->database;
@ -22,7 +22,7 @@ class ConnectionTest extends DatabaseTestCase
$this->assertEquals($params['password'], $connection->password);
}
function testOpenClose()
public function testOpenClose()
{
$connection = $this->getConnection(false, false);
@ -43,13 +43,13 @@ class ConnectionTest extends DatabaseTestCase
$connection->open();
}
function testGetDriverName()
public function testGetDriverName()
{
$connection = $this->getConnection(false, false);
$this->assertEquals($this->driverName, $connection->driverName);
}
function testQuoteValue()
public function testQuoteValue()
{
$connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123));
@ -57,7 +57,7 @@ class ConnectionTest extends DatabaseTestCase
$this->assertEquals("'It\\'s interesting'", $connection->quoteValue("It's interesting"));
}
function testQuoteTableName()
public function testQuoteTableName()
{
$connection = $this->getConnection(false);
$this->assertEquals('`table`', $connection->quoteTableName('table'));
@ -68,7 +68,7 @@ class ConnectionTest extends DatabaseTestCase
$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
}
function testQuoteColumnName()
public function testQuoteColumnName()
{
$connection = $this->getConnection(false);
$this->assertEquals('`column`', $connection->quoteColumnName('column'));

1
tests/unit/framework/db/QueryBuilderTest.php

@ -129,5 +129,4 @@ class QueryBuilderTest extends DatabaseTestCase
$tableSchema = $qb->db->getSchema()->getTableSchema($tableName);
$this->assertEquals(0, count($tableSchema->primaryKey));
}
}

20
tests/unit/framework/db/QueryTest.php

@ -15,7 +15,7 @@ class QueryTest extends DatabaseTestCase
$this->mockApplication();
}
function testSelect()
public function testSelect()
{
// default
$query = new Query;
@ -31,14 +31,14 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals('something', $query->selectOption);
}
function testFrom()
public function testFrom()
{
$query = new Query;
$query->from('tbl_user');
$this->assertEquals(array('tbl_user'), $query->from);
}
function testWhere()
public function testWhere()
{
$query = new Query;
$query->where('id = :id', array(':id' => 1));
@ -54,12 +54,11 @@ class QueryTest extends DatabaseTestCase
$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->groupBy('team');
@ -72,7 +71,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array('team', 'company', 'age'), $query->groupBy);
}
function testHaving()
public function testHaving()
{
$query = new Query;
$query->having('id = :id', array(':id' => 1));
@ -88,7 +87,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array(':id' => 1, ':name' => 'something', ':age' => '30'), $query->params);
}
function testOrder()
public function testOrder()
{
$query = new Query;
$query->orderBy('team');
@ -107,7 +106,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(array('team' => false, 'company' => true, 'age' => false), $query->orderBy);
}
function testLimitOffset()
public function testLimitOffset()
{
$query = new Query;
$query->limit(10)->offset(5);
@ -115,8 +114,7 @@ class QueryTest extends DatabaseTestCase
$this->assertEquals(5, $query->offset);
}
function testUnion()
public function testUnion()
{
}
}

6
tests/unit/framework/db/mssql/MssqlCommandTest.php

@ -12,7 +12,7 @@ class MssqlCommandTest extends CommandTest
parent::setUp();
}
function testAutoQuoting()
public function testAutoQuoting()
{
$db = $this->getConnection(false);
@ -21,12 +21,12 @@ class MssqlCommandTest extends CommandTest
$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.');
}
function testBindParamValue()
public function testBindParamValue()
{
$db = $this->getConnection();

6
tests/unit/framework/db/mssql/MssqlConnectionTest.php

@ -12,7 +12,7 @@ class MssqlConnectionTest extends ConnectionTest
parent::setUp();
}
function testQuoteValue()
public function testQuoteValue()
{
$connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123));
@ -20,7 +20,7 @@ class MssqlConnectionTest extends ConnectionTest
$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
}
function testQuoteTableName()
public function testQuoteTableName()
{
$connection = $this->getConnection(false);
$this->assertEquals('[table]', $connection->quoteTableName('table'));
@ -31,7 +31,7 @@ class MssqlConnectionTest extends ConnectionTest
$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
}
function testQuoteColumnName()
public function testQuoteColumnName()
{
$connection = $this->getConnection(false);
$this->assertEquals('[column]', $connection->quoteColumnName('column'));

20
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php

@ -1,28 +1,30 @@
<?php
namespace yiiunit\framework\db\pgsql;
use yiiunit\framework\db\ConnectionTest;
class PostgreSQLConnectionTest extends ConnectionTest {
public function setUp() {
class PostgreSQLConnectionTest extends ConnectionTest
{
public function setUp()
{
$this->driverName = 'pgsql';
parent::setUp();
}
public function testConnection() {
public function testConnection()
{
$connection = $this->getConnection(true);
}
function testQuoteValue() {
public function testQuoteValue()
{
$connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123));
$this->assertEquals("'string'", $connection->quoteValue('string'));
$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
}
function testQuoteTableName()
public function testQuoteTableName()
{
$connection = $this->getConnection(false);
$this->assertEquals('"table"', $connection->quoteTableName('table'));
@ -34,7 +36,7 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
}
function testQuoteColumnName()
public function testQuoteColumnName()
{
$connection = $this->getConnection(false);
$this->assertEquals('"column"', $connection->quoteColumnName('column'));
@ -46,6 +48,4 @@ class PostgreSQLConnectionTest extends ConnectionTest {
$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
$this->assertEquals('(column)', $connection->quoteColumnName('(column)'));
}
}

1
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php

@ -72,5 +72,4 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
array(Schema::TYPE_MONEY . ' NOT NULL', 'numeric(19,4) NOT NULL'),
);
}
}

1
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php

@ -78,5 +78,4 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
$this->setExpectedException('yii\base\NotSupportedException');
parent::testAddDropPrimayKey();
}
}

1
tests/unit/framework/helpers/ConsoleTest.php

@ -75,5 +75,4 @@ class ConsoleTest extends TestCase
sleep(1);
}
}*/
}

3
tests/unit/framework/helpers/FileHelperTest.php

@ -268,7 +268,8 @@ class FileHelperTest extends TestCase
$this->assertEquals(array($dirName . DIRECTORY_SEPARATOR . $fileName), $foundFiles);
}
public function testMkdir() {
public function testMkdir()
{
$basePath = $this->testFilePath;
$dirName = $basePath . DIRECTORY_SEPARATOR . 'test_dir_level_1' . DIRECTORY_SEPARATOR . 'test_dir_level_2';
FileHelper::mkdir($dirName);

3
tests/unit/framework/helpers/JsonTest.php

@ -23,7 +23,8 @@ class JsonTest extends TestCase
// simple object encoding
$data = new \stdClass();
$data->a = 1; $data->b = 2;
$data->a = 1;
$data->b = 2;
$this->assertSame('{"a":1,"b":2}', Json::encode($data));
// expression encoding

1
tests/unit/framework/helpers/StringHelperTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\StringHelper as StringHelper;
use yii\test\TestCase;

1
tests/unit/framework/helpers/VarDumperTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\VarDumper;
use yii\test\TestCase;

3
tests/unit/framework/requirements/YiiRequirementCheckerTest.php

@ -60,7 +60,8 @@ class YiiRequirementCheckerTest extends TestCase
/**
* @depends testCheck
*/
public function testCheckEval() {
public function testCheckEval()
{
$requirementsChecker = new YiiRequirementChecker();
$requirements = array(

1
tests/unit/framework/validators/EmailValidatorTest.php

@ -1,5 +1,6 @@
<?php
namespace yiiunit\framework\validators;
use yii\validators\EmailValidator;
use yiiunit\TestCase;

Loading…
Cancel
Save