Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
156
vendor/symfony/console/Tests/Helper/TableTest.php
vendored
156
vendor/symfony/console/Tests/Helper/TableTest.php
vendored
@@ -12,10 +12,12 @@
|
||||
namespace Symfony\Component\Console\Tests\Helper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Helper\TableCell;
|
||||
use Symfony\Component\Console\Helper\TableSeparator;
|
||||
use Symfony\Component\Console\Helper\TableStyle;
|
||||
use Symfony\Component\Console\Output\ConsoleSectionOutput;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
|
||||
class TableTest extends TestCase
|
||||
@@ -136,6 +138,45 @@ TABLE
|
||||
80-902734-1-6 And Then There Were None Agatha Christie
|
||||
=============== ========================== ==================
|
||||
|
||||
TABLE
|
||||
),
|
||||
array(
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
$books,
|
||||
'box',
|
||||
<<<'TABLE'
|
||||
┌───────────────┬──────────────────────────┬──────────────────┐
|
||||
│ 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 │
|
||||
└───────────────┴──────────────────────────┴──────────────────┘
|
||||
|
||||
TABLE
|
||||
),
|
||||
array(
|
||||
array('ISBN', 'Title', 'Author'),
|
||||
array(
|
||||
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
|
||||
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
|
||||
new TableSeparator(),
|
||||
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'),
|
||||
),
|
||||
'box-double',
|
||||
<<<'TABLE'
|
||||
╔═══════════════╤══════════════════════════╤══════════════════╗
|
||||
║ 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 ║
|
||||
╚═══════════════╧══════════════════════════╧══════════════════╝
|
||||
|
||||
TABLE
|
||||
),
|
||||
array(
|
||||
@@ -610,9 +651,9 @@ TABLE;
|
||||
{
|
||||
$style = new TableStyle();
|
||||
$style
|
||||
->setHorizontalBorderChar('.')
|
||||
->setVerticalBorderChar('.')
|
||||
->setCrossingChar('.')
|
||||
->setHorizontalBorderChars('.')
|
||||
->setVerticalBorderChars('.')
|
||||
->setDefaultCrossingChar('.')
|
||||
;
|
||||
|
||||
Table::setStyleDefinition('dotfull', $style);
|
||||
@@ -805,6 +846,115 @@ TABLE;
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
public function testSectionOutput()
|
||||
{
|
||||
$sections = array();
|
||||
$stream = $this->getOutputStream(true);
|
||||
$output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter());
|
||||
$table = new Table($output);
|
||||
$table
|
||||
->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))
|
||||
->setRows(array(
|
||||
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'),
|
||||
));
|
||||
|
||||
$table->render();
|
||||
|
||||
$table->appendRow(array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'));
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
+---------------+---------------+-----------------+-------+
|
||||
|\033[32m ISBN \033[39m|\033[32m Title \033[39m|\033[32m Author \033[39m|\033[32m Price \033[39m|
|
||||
+---------------+---------------+-----------------+-------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | 9.95 |
|
||||
+---------------+---------------+-----------------+-------+
|
||||
\x1b[5A\x1b[0J+---------------+----------------------+-----------------+--------+
|
||||
|\033[32m ISBN \033[39m|\033[32m Title \033[39m|\033[32m Author \033[39m|\033[32m Price \033[39m|
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | 9.95 |
|
||||
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | 139.25 |
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
|
||||
TABLE;
|
||||
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
public function testSectionOutputDoesntClearIfTableIsntRendered()
|
||||
{
|
||||
$sections = array();
|
||||
$stream = $this->getOutputStream(true);
|
||||
$output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter());
|
||||
$table = new Table($output);
|
||||
$table
|
||||
->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))
|
||||
->setRows(array(
|
||||
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'),
|
||||
));
|
||||
|
||||
$table->appendRow(array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'));
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
|\033[32m ISBN \033[39m|\033[32m Title \033[39m|\033[32m Author \033[39m|\033[32m Price \033[39m|
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | 9.95 |
|
||||
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | 139.25 |
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
|
||||
TABLE;
|
||||
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
public function testSectionOutputWithoutDecoration()
|
||||
{
|
||||
$sections = array();
|
||||
$stream = $this->getOutputStream();
|
||||
$output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter());
|
||||
$table = new Table($output);
|
||||
$table
|
||||
->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))
|
||||
->setRows(array(
|
||||
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'),
|
||||
));
|
||||
|
||||
$table->render();
|
||||
|
||||
$table->appendRow(array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'));
|
||||
|
||||
$expected =
|
||||
<<<TABLE
|
||||
+---------------+---------------+-----------------+-------+
|
||||
| ISBN | Title | Author | Price |
|
||||
+---------------+---------------+-----------------+-------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | 9.95 |
|
||||
+---------------+---------------+-----------------+-------+
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
| ISBN | Title | Author | Price |
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
| 99921-58-10-7 | Divine Comedy | Dante Alighieri | 9.95 |
|
||||
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | 139.25 |
|
||||
+---------------+----------------------+-----------------+--------+
|
||||
|
||||
TABLE;
|
||||
|
||||
$this->assertEquals($expected, $this->getOutputContent($output));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Output should be an instance of "Symfony\Component\Console\Output\ConsoleSectionOutput" when calling "Symfony\Component\Console\Helper\Table::appendRow".
|
||||
*/
|
||||
public function testAppendRowWithoutSectionOutput()
|
||||
{
|
||||
$table = new Table($this->getOutputStream());
|
||||
|
||||
$table->appendRow(array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Style "absent" is not defined.
|
||||
|
Reference in New Issue
Block a user