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 998fbd0

Browse filesBrowse files
committed
minor #19406 Console table cleanup (ReenExe)
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #19406). Discussion ---------- Console table cleanup | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes `notice` | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 217274b Console table cleanup
2 parents 77b5fc4 + 217274b commit 998fbd0
Copy full SHA for 998fbd0

File tree

Expand file treeCollapse file tree

2 files changed

+20
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-7
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/Table.php
+1-7Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ public function setColumnStyle($columnIndex, $name)
151151
{
152152
$columnIndex = intval($columnIndex);
153153

154-
if ($name instanceof TableStyle) {
155-
$this->columnStyles[$columnIndex] = $name;
156-
} elseif (isset(self::$styles[$name])) {
157-
$this->columnStyles[$columnIndex] = self::$styles[$name];
158-
} else {
159-
throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
160-
}
154+
$this->columnStyles[$columnIndex] = $this->resolveStyle($name);
161155

162156
return $this;
163157
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/TableTest.php
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,25 @@ public function testGetStyleDefinition()
650650
Table::getStyleDefinition('absent');
651651
}
652652

653+
/**
654+
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
655+
* @expectedExceptionMessage Style "absent" is not defined.
656+
*/
657+
public function testIsNotDefinedStyleException()
658+
{
659+
$table = new Table($this->getOutputStream());
660+
$table->setStyle('absent');
661+
}
662+
663+
/**
664+
* @expectedException \Symfony\Component\Console\Exception\InvalidArgumentException
665+
* @expectedExceptionMessage Style "absent" is not defined.
666+
*/
667+
public function testGetStyleDefinition()
668+
{
669+
Table::getStyleDefinition('absent');
670+
}
671+
653672
protected function getOutputStream()
654673
{
655674
return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, false);

0 commit comments

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