Example #1
0
    public function testColumnStyle()
    {
        $table = new Table($output = $this->getOutputStream());
        $table->setHeaders(array('ISBN', 'Title', 'Author', 'Price'))->setRows(array(array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri', '9.95'), array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens', '139.25')));
        $style = new TableStyle();
        $style->setPadType(STR_PAD_LEFT);
        $table->setColumnStyle(3, $style);
        $table->render();
        $expected = <<<TABLE
+---------------+----------------------+-----------------+--------+
| ISBN          | Title                | Author          |  Price |
+---------------+----------------------+-----------------+--------+
| 99921-58-10-7 | Divine Comedy        | Dante Alighieri |   9.95 |
| 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | 139.25 |
+---------------+----------------------+-----------------+--------+

TABLE;
        $this->assertEquals($expected, $this->getOutputContent($output));
    }