@@ -951,6 +951,38 @@ public function testAppendRowWithoutSectionOutput()
951
951
$ table ->appendRow (['9971-5-0210-0 ' , 'A Tale of Two Cities ' , 'Charles Dickens ' , '139.25 ' ]);
952
952
}
953
953
954
+ public function testSectionOutputHandlesZeroRowsAfterRender ()
955
+ {
956
+ $ sections = [];
957
+ $ stream = $ this ->getOutputStream (true );
958
+ $ output = new ConsoleSectionOutput ($ stream ->getStream (), $ sections , $ stream ->getVerbosity (), $ stream ->isDecorated (), new OutputFormatter ());
959
+ $ output ->writeln ('My Table ' );
960
+ $ table = new Table ($ output );
961
+ $ table
962
+ ->setHeaders (['ISBN ' , 'Title ' , 'Author ' , 'Price ' ])
963
+ ->setRows ([]);
964
+
965
+ $ table ->render ();
966
+
967
+ $ table ->appendRow (['9971-5-0210-0 ' , 'A Tale of Two Cities ' , 'Charles Dickens ' , '139.25 ' ]);
968
+
969
+ $ expected =
970
+ <<<TABLE
971
+ My Table
972
+ +------+-------+--------+-------+
973
+ | \033[32m ISBN \033[39m| \033[32m Title \033[39m| \033[32m Author \033[39m| \033[32m Price \033[39m|
974
+ +------+-------+--------+-------+
975
+ \x1b[3A \x1b[0J+---------------+----------------------+-----------------+--------+
976
+ | \033[32m ISBN \033[39m| \033[32m Title \033[39m| \033[32m Author \033[39m| \033[32m Price \033[39m|
977
+ +---------------+----------------------+-----------------+--------+
978
+ | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | 139.25 |
979
+ +---------------+----------------------+-----------------+--------+
980
+
981
+ TABLE ;
982
+
983
+ $ this ->assertEquals ($ expected , $ this ->getOutputContent ($ output ));
984
+ }
985
+
954
986
public function testIsNotDefinedStyleException ()
955
987
{
956
988
$ this ->expectException ('Symfony\Component\Console\Exception\InvalidArgumentException ' );
0 commit comments