function testSetColumnOrder() { $table = Table::create()->addRowNames(['row0', 'row1', 'row2'])->addColNames(['col0', 'col1', 'col2'])->td('row0', 'col0', 'Diag 0')->td('row1', 'col1', 'Diag 1')->td('row2', 'col2', 'Diag 2'); // Table before the reordering. $expected = <<<EOT <table> <tbody> <tr><td>Diag 0</td><td></td><td></td></tr> <tr><td></td><td>Diag 1</td><td></td></tr> <tr><td></td><td></td><td>Diag 2</td></tr> </tbody> </table> EOT; $this->assertEquals($expected, $table->render()); $table->setColOrder(['col1', 'col2', 'col0']); // Table after the column reordering. $expected = <<<EOT <table> <tbody> <tr><td></td><td></td><td>Diag 0</td></tr> <tr><td>Diag 1</td><td></td><td></td></tr> <tr><td></td><td>Diag 2</td><td></td></tr> </tbody> </table> EOT; $this->assertEquals($expected, $table->render()); }
/** * @param string|null $sectionName * * @return SectionColHandle */ function tbody($sectionName = null) { return new SectionColHandle($this->table->tbody($sectionName), $this->colName); }