Esempio n. 1
0
 /**
  * @expectedException \RuntimeException
  */
 public function testInvalidInput()
 {
     $output = m::mock('mako\\cli\\output\\Output');
     $output->shouldReceive('getFormatter')->once()->andReturn(null);
     $table = new Table($output);
     $table->render(['Col1'], [['Cell1', 'Cell2']]);
 }
Esempio n. 2
0
 /**
  * Draws information table.
  *
  * @access  protected
  * @param   string     $heading  Table heading
  * @param   array      $headers  Table headers
  * @param   array      $rows     Table rows
  */
 protected function drawTable($heading, array $headers, array $rows)
 {
     if (!empty($rows)) {
         $this->output->write(PHP_EOL);
         $this->output->writeLn('<yellow>' . $heading . '</yellow>');
         $this->output->write(PHP_EOL);
         $table = new Table($this->output);
         $headers = array_map(function ($value) {
             return '<green>' . $value . '</green>';
         }, $headers);
         $table->draw($headers, $rows);
     }
 }