Browse Source

Fixed className() usage in tests

tags/3.0.0-alpha1
Alexander Makarov 8 years ago
parent
commit
736fb099fb
No known key found for this signature in database
GPG Key ID: 3617B79C6A325E4A
  1. 2
      tests/data/ar/Order.php
  2. 4
      tests/framework/base/ApplicationTest.php
  3. 4
      tests/framework/db/ActiveQueryTest.php
  4. 2
      tests/framework/db/ActiveRecordTest.php
  5. 10
      tests/framework/di/ContainerTest.php
  6. 2
      tests/framework/filters/PageCacheTest.php
  7. 2
      tests/framework/grid/RadiobuttonColumnTest.php
  8. 4
      tests/framework/validators/ValidatorTest.php
  9. 4
      tests/framework/web/ErrorActionTest.php

2
tests/data/ar/Order.php

@ -180,7 +180,7 @@ class Order extends ActiveRecord
public function getLimitedItems()
{
return $this->hasMany(Item::className(), ['id' => 'item_id'])
return $this->hasMany(Item::class, ['id' => 'item_id'])
->onCondition(['item.id' => [3, 5]])
->via('orderItems');
}

4
tests/framework/base/ApplicationTest.php

@ -19,13 +19,13 @@ class ApplicationTest extends TestCase
$this->mockApplication([
'container' => [
'definitions' => [
Dispatcher::className() => DispatcherMock::className()
Dispatcher::class => DispatcherMock::class
]
],
'bootstrap' => ['log']
]);
$this->assertInstanceOf(DispatcherMock::className(), Yii::$app->log);
$this->assertInstanceOf(DispatcherMock::class, Yii::$app->log);
}
}

4
tests/framework/db/ActiveQueryTest.php

@ -134,7 +134,7 @@ abstract class ActiveQueryTest extends DatabaseTestCase
*/
public function testGetQueryTableName_from_not_set()
{
$query = new ActiveQuery(Customer::className());
$query = new ActiveQuery(Customer::class);
$result = $this->invokeMethod($query,'getTableNameAndAlias');
$this->assertEquals(['customer','customer'], $result);
}
@ -142,7 +142,7 @@ abstract class ActiveQueryTest extends DatabaseTestCase
public function testGetQueryTableName_from_set()
{
$options = ['from' => ['alias'=>'customer']];
$query = new ActiveQuery(Customer::className(),$options);
$query = new ActiveQuery(Customer::class,$options);
$result = $this->invokeMethod($query,'getTableNameAndAlias');
$this->assertEquals(['customer','alias'], $result);
}

2
tests/framework/db/ActiveRecordTest.php

@ -55,7 +55,7 @@ abstract class ActiveRecordTest extends DatabaseTestCase
public function getCategoryClass()
{
return Category::className();
return Category::class;
}
public function getOrderWithNullFKClass()

10
tests/framework/di/ContainerTest.php

@ -231,8 +231,8 @@ class ContainerTest extends TestCase
{
$container = new Container();
$container->setDefinitions([
'model.order' => Order::className(),
Cat::className() => Type::className(),
'model.order' => Order::class,
Cat::class => Type::class,
'test\TraversableInterface' => [
['class' => 'yiiunit\data\base\TraversableObject'],
[['item1', 'item2']]
@ -243,8 +243,8 @@ class ContainerTest extends TestCase
]);
$container->setDefinitions([]);
$this->assertInstanceOf(Order::className(), $container->get('model.order'));
$this->assertInstanceOf(Type::className(), $container->get(Cat::className()));
$this->assertInstanceOf(Order::class, $container->get('model.order'));
$this->assertInstanceOf(Type::class, $container->get(Cat::class));
$traversable = $container->get('test\TraversableInterface');
$this->assertInstanceOf('yiiunit\data\base\TraversableObject', $traversable);
@ -257,7 +257,7 @@ class ContainerTest extends TestCase
{
$container = new Container();
$container->setSingletons([
'model.order' => Order::className(),
'model.order' => Order::class,
'test\TraversableInterface' => [
['class' => 'yiiunit\data\base\TraversableObject'],
[['item1', 'item2']]

2
tests/framework/filters/PageCacheTest.php

@ -403,7 +403,7 @@ class PageCacheTest extends TestCase
'cache' => $cache = new ArrayCache(),
'view' => new View(),
'dependency' => [
'class' => ExpressionDependency::className(),
'class' => ExpressionDependency::class,
'expression' => 'Yii::$app->params[\'dependency\']',
]
]);

2
tests/framework/grid/RadiobuttonColumnTest.php

@ -76,7 +76,7 @@ class RadiobuttonColumnTest extends TestCase
'options' => ['id' => 'radio-gridview'],
'columns' => [
[
'class' => RadioButtonColumn::className(),
'class' => RadioButtonColumn::class,
'radioOptions' => function ($model) {
return [
'value' => $model['value'],

4
tests/framework/validators/ValidatorTest.php

@ -188,7 +188,7 @@ class ValidatorTest extends TestCase
$this->assertCount(3, $args);
$this->assertEquals('val_attr_a', $args[0]);
$this->assertEquals(['foo' => 'bar'], $args[1]);
$this->assertInstanceOf(InlineValidator::className(), $args[2]);
$this->assertInstanceOf(InlineValidator::class, $args[2]);
}
public function testClientValidateAttribute()
@ -208,7 +208,7 @@ class ValidatorTest extends TestCase
$this->assertCount(3, $args);
$this->assertEquals('val_attr_a', $args[0]);
$this->assertEquals(['foo' => 'bar'], $args[1]);
$this->assertInstanceOf(InlineValidator::className(), $args[2]);
$this->assertInstanceOf(InlineValidator::class, $args[2]);
}
public function testIsActive()

4
tests/framework/web/ErrorActionTest.php

@ -22,7 +22,7 @@ class ErrorActionTest extends TestCase
$this->mockApplication([
'components' => [
'request' => [
'class' => Request::className(),
'class' => Request::class,
],
],
]);
@ -115,7 +115,7 @@ class TestController extends Controller
{
return [
'error' => array_merge([
'class' => ErrorAction::className(),
'class' => ErrorAction::class,
'view' => '@yiiunit/data/views/error.php',
], $this->actionConfig),
];

Loading…
Cancel
Save