Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -11,13 +11,14 @@
namespace Symfony\Component\Console\Tests\Helper;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableStyle;
use Symfony\Component\Console\Helper\TableSeparator;
use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Helper\TableSeparator;
use Symfony\Component\Console\Helper\TableStyle;
use Symfony\Component\Console\Output\StreamOutput;
class TableTest extends \PHPUnit_Framework_TestCase
class TableTest extends TestCase
{
protected $stream;
@@ -33,11 +34,11 @@ class TableTest extends \PHPUnit_Framework_TestCase
}
/**
* @dataProvider testRenderProvider
* @dataProvider renderProvider
*/
public function testRender($headers, $rows, $style, $expected)
public function testRender($headers, $rows, $style, $expected, $decorated = false)
{
$table = new Table($output = $this->getOutputStream());
$table = new Table($output = $this->getOutputStream($decorated));
$table
->setHeaders($headers)
->setRows($rows)
@@ -49,11 +50,11 @@ class TableTest extends \PHPUnit_Framework_TestCase
}
/**
* @dataProvider testRenderProvider
* @dataProvider renderProvider
*/
public function testRenderAddRows($headers, $rows, $style, $expected)
public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false)
{
$table = new Table($output = $this->getOutputStream());
$table = new Table($output = $this->getOutputStream($decorated));
$table
->setHeaders($headers)
->addRows($rows)
@@ -65,11 +66,11 @@ class TableTest extends \PHPUnit_Framework_TestCase
}
/**
* @dataProvider testRenderProvider
* @dataProvider renderProvider
*/
public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected)
public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false)
{
$table = new Table($output = $this->getOutputStream());
$table = new Table($output = $this->getOutputStream($decorated));
$table
->setHeaders($headers)
->setStyle($style)
@@ -82,7 +83,7 @@ class TableTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expected, $this->getOutputContent($output));
}
public function testRenderProvider()
public function renderProvider()
{
$books = array(
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
@@ -96,7 +97,7 @@ class TableTest extends \PHPUnit_Framework_TestCase
array('ISBN', 'Title', 'Author'),
$books,
'default',
<<<TABLE
<<<'TABLE'
+---------------+--------------------------+------------------+
| ISBN | Title | Author |
+---------------+--------------------------+------------------+
@@ -112,7 +113,7 @@ TABLE
array('ISBN', 'Title', 'Author'),
$books,
'compact',
<<<TABLE
<<<'TABLE'
ISBN Title Author
99921-58-10-7 Divine Comedy Dante Alighieri
9971-5-0210-0 A Tale of Two Cities Charles Dickens
@@ -125,7 +126,7 @@ TABLE
array('ISBN', 'Title', 'Author'),
$books,
'borderless',
<<<TABLE
<<<'TABLE'
=============== ========================== ==================
ISBN Title Author
=============== ========================== ==================
@@ -146,7 +147,7 @@ TABLE
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
),
'default',
<<<TABLE
<<<'TABLE'
+---------------+--------------------------+------------------+
| ISBN | Title | |
+---------------+--------------------------+------------------+
@@ -167,7 +168,7 @@ TABLE
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
),
'default',
<<<TABLE
<<<'TABLE'
+---------------+--------------------------+------------------+
| 99921-58-10-7 | Divine Comedy | Dante Alighieri |
| 9971-5-0210-0 | | |
@@ -186,7 +187,7 @@ TABLE
array('960-425-059-0', 'The Lord of the Rings', "J. R. R.\nTolkien"),
),
'default',
<<<TABLE
<<<'TABLE'
+---------------+----------------------------+-----------------+
| ISBN | Title | Author |
+---------------+----------------------------+-----------------+
@@ -206,7 +207,7 @@ TABLE
array('ISBN', 'Title'),
array(),
'default',
<<<TABLE
<<<'TABLE'
+------+-------+
| ISBN | Title |
+------+-------+
@@ -226,7 +227,7 @@ TABLE
array('9971-5-0210-0', 'A Tale of Two Cities', '<info>Charles Dickens</>'),
),
'default',
<<<TABLE
<<<'TABLE'
+---------------+----------------------+-----------------+
| ISBN | Title | Author |
+---------------+----------------------+-----------------+
@@ -243,7 +244,7 @@ TABLE
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
),
'default',
<<<TABLE
<<<'TABLE'
+----------------------------------+----------------------+-----------------+
| ISBN | Title | Author |
+----------------------------------+----------------------+-----------------+
@@ -275,7 +276,7 @@ TABLE
),
),
'default',
<<<TABLE
<<<'TABLE'
+-------------------------------+-------------------------------+-----------------------------+
| ISBN | Title | Author |
+-------------------------------+-------------------------------+-----------------------------+
@@ -298,29 +299,29 @@ TABLE
array(
array(
new TableCell('9971-5-0210-0', array('rowspan' => 3)),
'Divine Comedy',
new TableCell('Divine Comedy', array('rowspan' => 2)),
'Dante Alighieri',
),
array('A Tale of Two Cities', 'Charles Dickens'),
array(),
array("The Lord of \nthe Rings", "J. R. \nR. Tolkien"),
new TableSeparator(),
array('80-902734-1-6', new TableCell("And Then \nThere \nWere None", array('rowspan' => 3)), 'Agatha Christie'),
array('80-902734-1-7', 'Test'),
),
'default',
<<<TABLE
+---------------+----------------------+-----------------+
| ISBN | Title | Author |
+---------------+----------------------+-----------------+
| 9971-5-0210-0 | Divine Comedy | Dante Alighieri |
| | A Tale of Two Cities | Charles Dickens |
| | The Lord of | J. R. |
| | the Rings | R. Tolkien |
+---------------+----------------------+-----------------+
| 80-902734-1-6 | And Then | Agatha Christie |
| 80-902734-1-7 | There | Test |
| | Were None | |
+---------------+----------------------+-----------------+
<<<'TABLE'
+---------------+---------------+-----------------+
| ISBN | Title | Author |
+---------------+---------------+-----------------+
| 9971-5-0210-0 | Divine Comedy | Dante Alighieri |
| | | |
| | The Lord of | J. R. |
| | the Rings | R. Tolkien |
+---------------+---------------+-----------------+
| 80-902734-1-6 | And Then | Agatha Christie |
| 80-902734-1-7 | There | Test |
| | Were None | |
+---------------+---------------+-----------------+
TABLE
),
@@ -341,7 +342,7 @@ TABLE
array('J. R. R'),
),
'default',
<<<TABLE
<<<'TABLE'
+------------------+---------+-----------------+
| ISBN | Title | Author |
+------------------+---------+-----------------+
@@ -376,7 +377,7 @@ TABLE
),
),
'default',
<<<TABLE
<<<'TABLE'
+-----------------+-------+-----------------+
| ISBN | Title | Author |
+-----------------+-------+-----------------+
@@ -413,7 +414,7 @@ TABLE
array('Charles Dickens'),
),
'default',
<<<TABLE
<<<'TABLE'
+-----------------+-------+-----------------+
| ISBN | Title | Author |
+-----------------+-------+-----------------+
@@ -440,7 +441,7 @@ TABLE
array('Charles Dickens'),
),
'default',
<<<TABLE
<<<'TABLE'
+---------------+-----------------+
| ISBN | Author |
+---------------+-----------------+
@@ -458,7 +459,7 @@ TABLE
),
array(),
'default',
<<<TABLE
<<<'TABLE'
+------+-------+--------+
| Main title |
+------+-------+--------+
@@ -478,13 +479,71 @@ TABLE
),
),
'default',
<<<TABLE
<<<'TABLE'
+---+--+--+---+--+---+--+---+--+
| 1 | 2 | 3 | 4 |
+---+--+--+---+--+---+--+---+--+
TABLE
),
'Coslpan and table cells with comment style' => array(
array(
new TableCell('<comment>Long Title</comment>', array('colspan' => 3)),
),
array(
array(
new TableCell('9971-5-0210-0', array('colspan' => 3)),
),
new TableSeparator(),
array(
'Dante Alighieri',
'J. R. R. Tolkien',
'J. R. R',
),
),
'default',
<<<TABLE
+-----------------+------------------+---------+
|\033[32m \033[39m\033[33mLong Title\033[39m\033[32m \033[39m|
+-----------------+------------------+---------+
| 9971-5-0210-0 |
+-----------------+------------------+---------+
| Dante Alighieri | J. R. R. Tolkien | J. R. R |
+-----------------+------------------+---------+
TABLE
,
true,
),
'Row with formatted cells containing a newline' => array(
array(),
array(
array(
new TableCell('<error>Dont break'."\n".'here</error>', array('colspan' => 2)),
),
new TableSeparator(),
array(
'foo',
new TableCell('<error>Dont break'."\n".'here</error>', array('rowspan' => 2)),
),
array(
'bar',
),
),
'default',
<<<'TABLE'
+-------+------------+
| Dont break |
| here |
+-------+------------+
| foo | Dont break |
| bar | here |
+-------+------------+
TABLE
,
true,
),
);
}
@@ -499,13 +558,49 @@ TABLE
$table->render();
$expected =
<<<TABLE
<<<'TABLE'
+------+
| ■■ |
+------+
| 1234 |
+------+
TABLE;
$this->assertEquals($expected, $this->getOutputContent($output));
}
public function testTableCellWithNumericIntValue()
{
$table = new Table($output = $this->getOutputStream());
$table->setRows(array(array(new TableCell(12345))));
$table->render();
$expected =
<<<'TABLE'
+-------+
| 12345 |
+-------+
TABLE;
$this->assertEquals($expected, $this->getOutputContent($output));
}
public function testTableCellWithNumericFloatValue()
{
$table = new Table($output = $this->getOutputStream());
$table->setRows(array(array(new TableCell(12345.01))));
$table->render();
$expected =
<<<'TABLE'
+----------+
| 12345.01 |
+----------+
TABLE;
$this->assertEquals($expected, $this->getOutputContent($output));
@@ -529,7 +624,7 @@ TABLE;
$table->render();
$expected =
<<<TABLE
<<<'TABLE'
.......
. Foo .
.......
@@ -556,7 +651,7 @@ TABLE;
$table->render();
$expected =
<<<TABLE
<<<'TABLE'
+------+
| Foo |
+------+
@@ -632,7 +727,86 @@ TABLE;
}
/**
* @expectedException Symfony\Component\Console\Exception\InvalidArgumentException
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
* @expectedExceptionMessage A cell must be a TableCell, a scalar or an object implementing __toString, array given.
*/
public function testThrowsWhenTheCellInAnArray()
{
$table = new Table($output = $this->getOutputStream());
$table
->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))
->setRows(array(
array('99921-58-10-7', array(), 'Dante Alighieri', '9.95'),
));
$table->render();
}
public function testColumnWith()
{
$table = new Table($output = $this->getOutputStream());
$table
->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))
->setRows(array(
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'),
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'),
))
->setColumnWidth(0, 15)
->setColumnWidth(3, 10);
$style = new TableStyle();
$style->setPadType(STR_PAD_LEFT);
$table->setColumnStyle(3, $style);
$table->render();
$expected =
<<<TABLE
+-----------------+----------------------+-----------------+------------+
| 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));
}
public function testColumnWiths()
{
$table = new Table($output = $this->getOutputStream());
$table
->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))
->setRows(array(
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'),
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25'),
))
->setColumnWidths(array(15, 0, -1, 10));
$style = new TableStyle();
$style->setPadType(STR_PAD_LEFT);
$table->setColumnStyle(3, $style);
$table->render();
$expected =
<<<TABLE
+-----------------+----------------------+-----------------+------------+
| 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\InvalidArgumentException
* @expectedExceptionMessage Style "absent" is not defined.
*/
public function testIsNotDefinedStyleException()
@@ -650,9 +824,9 @@ TABLE;
Table::getStyleDefinition('absent');
}
protected function getOutputStream()
protected function getOutputStream($decorated = false)
{
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false);
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated);
}
protected function getOutputContent(StreamOutput $output)