package updates
This commit is contained in:
103
vendor/symfony/console/Tests/Helper/TableTest.php
vendored
103
vendor/symfony/console/Tests/Helper/TableTest.php
vendored
@@ -974,6 +974,109 @@ TABLE;
|
||||
Table::getStyleDefinition('absent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider renderSetTitle
|
||||
*/
|
||||
public function testSetTitle($headerTitle, $footerTitle, $style, $expected)
|
||||
{
|
||||
(new Table($output = $this->getOutputStream()))
|
||||
->setHeaderTitle($headerTitle)
|
||||
->setFooterTitle($footerTitle)
|
||||
->setHeaders(array('ISBN', 'Title', 'Author'))
|
||||
->setRows(array(
|
||||
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
|
||||
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
|
||||
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
|
||||
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
|
||||
))
|
||||
->setStyle($style)
|
||||
->render()
|
||||
;
|
||||
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
public function renderSetTitle()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'Books',
|
||||
'Page 1/2',
|
||||
'default',
|
||||
<<<'TABLE'
|
||||
+---------------+----------- Books --------+------------------+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+--------------------------+------------------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
|
||||
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
|
||||
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
|
||||
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
|
||||
+---------------+--------- Page 1/2 -------+------------------+
|
||||
|
||||
TABLE
|
||||
),
|
||||
array(
|
||||
'Books',
|
||||
'Page 1/2',
|
||||
'box',
|
||||
<<<'TABLE'
|
||||
┌───────────────┬─────────── Books ────────┬──────────────────┐
|
||||
│ ISBN │ Title │ Author │
|
||||
├───────────────┼──────────────────────────┼──────────────────┤
|
||||
│ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri │
|
||||
│ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens │
|
||||
│ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien │
|
||||
│ 80-902734-1-6 │ And Then There Were None │ Agatha Christie │
|
||||
└───────────────┴───────── Page 1/2 ───────┴──────────────────┘
|
||||
|
||||
TABLE
|
||||
),
|
||||
array(
|
||||
'Boooooooooooooooooooooooooooooooooooooooooooooooooooooooks',
|
||||
'Page 1/999999999999999999999999999999999999999999999999999',
|
||||
'default',
|
||||
<<<'TABLE'
|
||||
+- Booooooooooooooooooooooooooooooooooooooooooooooooooooo... -+
|
||||
| ISBN | Title | Author |
|
||||
+---------------+--------------------------+------------------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
|
||||
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
|
||||
| 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
|
||||
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
|
||||
+- Page 1/99999999999999999999999999999999999999999999999... -+
|
||||
|
||||
TABLE
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function testColumnMaxWidths()
|
||||
{
|
||||
$table = new Table($output = $this->getOutputStream());
|
||||
$table
|
||||
->setRows(array(
|
||||
array('Divine Comedy', 'A Tale of Two Cities', 'The Lord of the Rings', 'And Then There Were None'),
|
||||
))
|
||||
->setColumnMaxWidth(1, 5)
|
||||
->setColumnMaxWidth(2, 10)
|
||||
->setColumnMaxWidth(3, 15);
|
||||
|
||||
$table->render();
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
+---------------+-------+------------+-----------------+
|
||||
| Divine Comedy | A Tal | The Lord o | And Then There |
|
||||
| | e of | f the Ring | Were None |
|
||||
| | Two C | s | |
|
||||
| | ities | | |
|
||||
+---------------+-------+------------+-----------------+
|
||||
|
||||
TABLE;
|
||||
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
public function testBoxedStyleWithColspan()
|
||||
{
|
||||
$boxed = new TableStyle();
|
||||
|
||||
Reference in New Issue
Block a user