Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eabf778

Browse filesBrowse files
committed
fix test
1 parent 87b8809 commit eabf778
Copy full SHA for eabf778

File tree

2 files changed

+9
-35
lines changed
Filter options

2 files changed

+9
-35
lines changed

‎src/Symfony/Component/Console/Helper/Table.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/Table.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public function render()
374374

375375
$isHeader = !$this->horizontal;
376376
$isFirstRow = $this->horizontal;
377-
$needsTitle = (bool) $this->headerTitle;
377+
$hasTitle = (bool) $this->headerTitle;
378378
foreach ($rows as $row) {
379379
if ($divider === $row) {
380380
$isHeader = false;
@@ -394,11 +394,11 @@ public function render()
394394
if ($isHeader || $isFirstRow) {
395395
$this->renderRowSeparator(
396396
$isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
397-
$needsTitle ? $this->headerTitle : null,
398-
$needsTitle ? $this->style->getHeaderTitleFormat() : null
397+
$hasTitle ? $this->headerTitle : null,
398+
$hasTitle ? $this->style->getHeaderTitleFormat() : null
399399
);
400400
$isFirstRow = false;
401-
$needsTitle = false;
401+
$hasTitle = false;
402402
}
403403
if ($this->horizontal) {
404404
$this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());

‎src/Symfony/Component/Console/Tests/Helper/TableTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/TableTest.php
+5-31Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,51 +1115,25 @@ public function renderSetTitle()
11151115
];
11161116
}
11171117

1118-
/**
1119-
* @dataProvider renderSetTitle2
1120-
*/
1121-
public function testSetTitle2(string $headerTitle, array $headers, string $expected)
1118+
public function testSetTitleWithoutHeaders()
11221119
{
11231120
(new Table($output = $this->getOutputStream()))
1124-
->setHeaderTitle($headerTitle)
1125-
->setHeaders($headers)
1121+
->setHeaderTitle('Reproducer')
11261122
->setRows([
11271123
['Value', '123-456'],
11281124
['Some other value', '789-0'],
11291125
])
11301126
->render();
11311127

1132-
$this->assertEquals($expected, $this->getOutputContent($output));
1133-
}
1134-
1135-
public function renderSetTitle2(): array
1136-
{
1137-
return [
1138-
[
1139-
'Reproducer',
1140-
[],
1141-
<<<'TABLE1'
1128+
$expected = <<<'TABLE'
11421129
+-------- Reproducer --------+
11431130
| Value | 123-456 |
11441131
| Some other value | 789-0 |
11451132
+------------------+---------+
11461133

1147-
TABLE1
1148-
],
1149-
[
1150-
'Reproducer',
1151-
['Key', 'Value'],
1152-
<<<'TABLE2'
1153-
+-------- Reproducer --------+
1154-
| Key | Value |
1155-
+------------------+---------+
1156-
| Value | 123-456 |
1157-
| Some other value | 789-0 |
1158-
+------------------+---------+
1134+
TABLE;
11591135

1160-
TABLE2
1161-
],
1162-
];
1136+
$this->assertSame($expected, $this->getOutputContent($output));
11631137
}
11641138

11651139
public function testColumnMaxWidths()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.