You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.0 KiB
45 lines
1.0 KiB
9 years ago
|
<?php
|
||
|
|
||
|
|
||
|
namespace yiiunit\framework\grid;
|
||
|
|
||
|
use yii\data\ArrayDataProvider;
|
||
|
use yii\grid\GridView;
|
||
|
use yiiunit\data\ar\Order;
|
||
|
|
||
|
/**
|
||
|
* @author Dmitry Naumenko <d.naumenko.a@gmail.com>
|
||
|
*
|
||
|
* @group grid
|
||
|
*/
|
||
|
class DataColumnTest extends \yiiunit\TestCase
|
||
|
{
|
||
|
public function setUp()
|
||
|
{
|
||
|
parent::setUp();
|
||
|
$this->mockApplication();
|
||
|
}
|
||
|
|
||
|
public function testColumnLabelsOnEmptyProvider()
|
||
|
{
|
||
|
$grid = new GridView([
|
||
|
'dataProvider' => new ArrayDataProvider([
|
||
|
'allModels' => [],
|
||
|
'totalCount' => 0,
|
||
|
'modelClass' => Order::className()
|
||
|
]),
|
||
|
'columns' => ['customer_id', 'total']
|
||
|
]);
|
||
|
|
||
|
$labels = [];
|
||
|
foreach ($grid->columns as $column) {
|
||
|
$method = new \ReflectionMethod($column, 'getHeaderCellLabel');
|
||
|
$method->setAccessible(true);
|
||
|
$labels[] = $method->invoke($column);
|
||
|
$method->setAccessible(false);
|
||
|
}
|
||
|
|
||
|
$this->assertEquals(['Customer', 'Invoice Total'], $labels);
|
||
|
}
|
||
|
}
|