Skip to content

Commit 858c7b5

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Console] Fix horizontal table top border is incorrectly rendered [Tests] Streamline [Uid] Fix UuidV7 collisions within the same ms [Validator] updated Romanian translation
2 parents d9c21b1 + 0d14a9f commit 858c7b5

File tree

3 files changed

+67
-7
lines changed

3 files changed

+67
-7
lines changed

Helper/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public function render()
423423

424424
if ($isHeader && !$isHeaderSeparatorRendered) {
425425
$this->renderRowSeparator(
426-
$isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
426+
self::SEPARATOR_TOP,
427427
$hasTitle ? $this->headerTitle : null,
428428
$hasTitle ? $this->style->getHeaderTitleFormat() : null
429429
);
@@ -433,7 +433,7 @@ public function render()
433433

434434
if ($isFirstRow) {
435435
$this->renderRowSeparator(
436-
$isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
436+
$horizontal ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
437437
$hasTitle ? $this->headerTitle : null,
438438
$hasTitle ? $this->style->getHeaderTitleFormat() : null
439439
);

Tests/ApplicationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ public function testRunWithErrorAndDispatcher()
16051605

16061606
$tester = new ApplicationTester($application);
16071607
$tester->run(['command' => 'dym']);
1608-
$this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events');
1608+
$this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP error did not dispatch events');
16091609
}
16101610

16111611
public function testRunDispatchesAllEventsWithError()
@@ -1622,7 +1622,7 @@ public function testRunDispatchesAllEventsWithError()
16221622

16231623
$tester = new ApplicationTester($application);
16241624
$tester->run(['command' => 'dym']);
1625-
$this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP Error did not dispached events');
1625+
$this->assertStringContainsString('before.dym.error.after.', $tester->getDisplay(), 'The PHP error did not dispatch events');
16261626
}
16271627

16281628
public function testRunWithErrorFailingStatusCode()

Tests/Helper/TableTest.php

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,15 +1017,16 @@ public function testColumnStyle()
10171017

10181018
public function testThrowsWhenTheCellInAnArray()
10191019
{
1020-
$this->expectException(InvalidArgumentException::class);
1021-
$this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.');
1022-
$table = new Table($output = $this->getOutputStream());
1020+
$table = new Table($this->getOutputStream());
10231021
$table
10241022
->setHeaders(['ISBN', 'Title', 'Author', 'Price'])
10251023
->setRows([
10261024
['99921-58-10-7', [], 'Dante Alighieri', '9.95'],
10271025
]);
10281026

1027+
$this->expectException(InvalidArgumentException::class);
1028+
$this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.');
1029+
10291030
$table->render();
10301031
}
10311032

@@ -1997,4 +1998,63 @@ public function testWithHyperlinkAndMaxWidth()
19971998

19981999
$this->assertSame($expected, $this->getOutputContent($output));
19992000
}
2001+
2002+
public function testGithubIssue52101HorizontalTrue()
2003+
{
2004+
$tableStyle = (new TableStyle())
2005+
->setHorizontalBorderChars('')
2006+
->setVerticalBorderChars('')
2007+
->setCrossingChars('', '', '', '', '', '', '', '', '')
2008+
;
2009+
2010+
$table = (new Table($output = $this->getOutputStream()))
2011+
->setStyle($tableStyle)
2012+
->setHeaderTitle('Title')
2013+
->setHeaders(['Hello', 'World'])
2014+
->setRows([[1, 2], [3, 4]])
2015+
->setHorizontal(true)
2016+
;
2017+
$table->render();
2018+
2019+
$this->assertSame(<<<TABLE
2020+
┌──── Title ┬───┐
2021+
│ Hello │ 1 │ 3 │
2022+
│ World │ 2 │ 4 │
2023+
└───────┴───┴───┘
2024+
2025+
TABLE
2026+
,
2027+
$this->getOutputContent($output)
2028+
);
2029+
}
2030+
2031+
public function testGithubIssue52101HorizontalFalse()
2032+
{
2033+
$tableStyle = (new TableStyle())
2034+
->setHorizontalBorderChars('')
2035+
->setVerticalBorderChars('')
2036+
->setCrossingChars('', '', '', '', '', '', '', '', '')
2037+
;
2038+
2039+
$table = (new Table($output = $this->getOutputStream()))
2040+
->setStyle($tableStyle)
2041+
->setHeaderTitle('Title')
2042+
->setHeaders(['Hello', 'World'])
2043+
->setRows([[1, 2], [3, 4]])
2044+
->setHorizontal(false)
2045+
;
2046+
$table->render();
2047+
2048+
$this->assertSame(<<<TABLE
2049+
┌──── Title ────┐
2050+
│ Hello │ World │
2051+
├───────┼───────┤
2052+
│ 1 │ 2 │
2053+
│ 3 │ 4 │
2054+
└───────┴───────┘
2055+
2056+
TABLE,
2057+
$this->getOutputContent($output)
2058+
);
2059+
}
20002060
}

0 commit comments

Comments
 (0)