File tree 2 files changed +20
-7
lines changed
src/Symfony/Component/Console
2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -151,13 +151,7 @@ public function setColumnStyle($columnIndex, $name)
151
151
{
152
152
$ columnIndex = intval ($ columnIndex );
153
153
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 );
161
155
162
156
return $ this ;
163
157
}
Original file line number Diff line number Diff line change @@ -650,6 +650,25 @@ public function testGetStyleDefinition()
650
650
Table::getStyleDefinition ('absent ' );
651
651
}
652
652
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
+
653
672
protected function getOutputStream ()
654
673
{
655
674
return new StreamOutput ($ this ->stream , StreamOutput::VERBOSITY_NORMAL , false );
You can’t perform that action at this time.
0 commit comments