"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/framework/console/widgets/TableTest.php" between
yii2-2.0.35.tar.gz and yii2-2.0.36.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

TableTest.php  (yii2-2.0.35):TableTest.php  (yii2-2.0.36)
<?php <?php
/** /**
* @link http://www.yiiframework.com/ * @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC * @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yiiunit\framework\console; namespace yiiunit\framework\console;
use yii\console\widgets\Table; use yii\console\widgets\Table;
use yii\helpers\Console;
use yiiunit\TestCase; use yiiunit\TestCase;
/** /**
* @group console * @group console
*/ */
class TableTest extends TestCase class TableTest extends TestCase
{ {
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
skipping to change at line 316 skipping to change at line 317
$table $table
->setHeaders(['test1', 'test2']) ->setHeaders(['test1', 'test2'])
->setRows([ ->setRows([
['0', []], ['0', []],
['0.0', []], ['0.0', []],
]) ])
->setScreenWidth(200) ->setScreenWidth(200)
->run() ->run()
); );
} }
public function testColorizedInput()
{
$table = new Table();
$expected = <<<"EXPECTED"
╔═══════╤═══════╤══════════╗
║ test1 │ test2 │ test3 ║
╟───────┼───────┼──────────╢
║ col1 │ \e[33mcol2\e[0m │ col3 ║
╟───────┼───────┼──────────╢
║ col1 │ col2 │ • col3-0 ║
║ │ │ • \e[31mcol3-1\e[0m ║
║ │ │ • col3-2 ║
╚═══════╧═══════╧══════════╝
EXPECTED;
$this->assertEqualsWithoutLE(
$expected,
$table
->setHeaders(['test1', 'test2', 'test3'])
->setRows([
['col1', Console::renderColoredString('%ycol2%n'), 'col3'],
['col1', 'col2', ['col3-0', Console::renderColoredString('%r
col3-1%n'), 'col3-2']],
])
->run()
);
}
public function testColorizedInputStripsANSIMarkersInternally()
{
$table = new Table();
$table
->setHeaders(['t1', 't2', 't3'])
->setRows([
['col1', Console::renderColoredString('%ycol2%n'), 'col3'],
['col1', 'col2', ['col3-0', Console::renderColoredString('%rcol3
-1%n'), 'col3-2']],
])
->setScreenWidth(200)
->run();
$columnWidths = \PHPUnit_Framework_Assert::readAttribute($table, "column
Widths");
$this->assertArrayHasKey(1, $columnWidths);
$this->assertEquals(4+2, $columnWidths[1]);
$this->assertArrayHasKey(2, $columnWidths);
$this->assertEquals(8+2, $columnWidths[2]);
}
public function testCalculateRowHeightShouldNotThrowDivisionByZeroException(
)
{
$rows = [
['XXXXXX', 'XXXXXXXXXXXXXXXXXXXX', '', '', 'XXXXXXXXXXXXXXXXXX', 'X'
, 'XXX'],
['XXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', '', '', ''],
['XXXXXX', 'XXXXXXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX', '', '', '', ''],
];
$table = Table::widget([
'headers' => ['XX', 'XXXX'],
'rows' => $rows
]);
$this->assertEqualsWithoutLE($table, $table);
}
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 74 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)