/** * Renders table to output. * * Example: * +---------------+-----------------------+------------------+ * | ISBN | Title | Author | * +---------------+-----------------------+------------------+ * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | * +---------------+-----------------------+------------------+ * * @param OutputInterface $output */ public function render(OutputInterface $output) { $p = new \ReflectionProperty($this->table, 'output'); $p->setAccessible(true); $p->setValue($this->table, $output); $this->table->render(); }
public function testRowSeparator() { $table = new Table($output = $this->getOutputStream()); $table->setHeaders(array('Foo'))->setRows(array(array('Bar1'), new TableSeparator(), array('Bar2'), new TableSeparator(), array('Bar3'))); $table->render(); $expected = <<<TABLE +------+ | Foo | +------+ | Bar1 | +------+ | Bar2 | +------+ | Bar3 | +------+ TABLE; $this->assertEquals($expected, $this->getOutputContent($output)); }