/** * Generate a table with FireCake * * @param array $rows Rows to print * @param array $headers Headers for table * @param array $options Additional options and params * @return void */ function table($rows, $headers, $options = array()) { $title = $headers[0]; if (isset($options['title'])) { $title = $options['title']; } array_unshift($rows, $headers); FireCake::table($title, $rows); }
/** * Generate a table with FireCake * * @param array $rows Rows to print * @param array $headers Headers for table * @param array $options Additional options and params * @return void */ public function table($rows, $headers, $options = array()) { $title = $headers[0]; if (isset($options['title'])) { $title = $options['title']; } foreach ($rows as $i => $row) { $rows[$i] = array_values($row); } array_unshift($rows, $headers); FireCake::table($title, $rows); }
/** * test table() generation * * @return void */ public function testTable() { $table[] = array('Col 1 Heading', 'Col 2 Heading'); $table[] = array('Row 1 Col 1', 'Row 1 Col 2'); $table[] = array('Row 2 Col 1', 'Row 2 Col 2'); $table[] = array('Row 3 Col 1', 'Row 3 Col 2'); FireCake::table('myTrace', $table); $expected = '162|[{"Type":"TABLE","Label":"myTrace"},[["Col 1 Heading","Col 2 Heading"],["Row 1 Col 1","Row 1 Col 2"],["Row 2 Col 1","Row 2 Col 2"],["Row 3 Col 1","Row 3 Col 2"]]]|'; $this->assertEqual($this->firecake->sentHeaders['X-Wf-1-1-1-1'], $expected); }