[Console] fixed style creation when providing an unknown tag option
This commit is contained in:
parent
72b70636ba
commit
88149209ae
@ -215,7 +215,11 @@ class OutputFormatter implements OutputFormatterInterface
|
|||||||
} elseif ('bg' == $match[0]) {
|
} elseif ('bg' == $match[0]) {
|
||||||
$style->setBackground($match[1]);
|
$style->setBackground($match[1]);
|
||||||
} else {
|
} else {
|
||||||
$style->setOption($match[1]);
|
try {
|
||||||
|
$style->setOption($match[1]);
|
||||||
|
} catch (\InvalidArgumentException $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ class OutputFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$formatter = new OutputFormatter(true);
|
$formatter = new OutputFormatter(true);
|
||||||
|
|
||||||
$this->assertEquals("\033[32msome \033[0m\033[32m<tag>\033[0m\033[32m styled \033[0m\033[32m<p>\033[0m\033[32msingle-char tag\033[0m\033[32m</p>\033[0m", $formatter->format('<info>some <tag> styled <p>single-char tag</p></info>'));
|
$this->assertEquals("\033[32msome \033[0m\033[32m<tag>\033[0m\033[32m \033[0m\033[32m<setting=value>\033[0m\033[32m styled \033[0m\033[32m<p>\033[0m\033[32msingle-char tag\033[0m\033[32m</p>\033[0m", $formatter->format('<info>some <tag> <setting=value> styled <p>single-char tag</p></info>'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormatLongString()
|
public function testFormatLongString()
|
||||||
|
Reference in New Issue
Block a user