Exemple #1
0
 /**
  * Assert that the indention only indents when there was actual output on the
  * previous indention level
  *
  * @return void
  */
 public function testIndention()
 {
     $n = PHP_EOL;
     $expected = 'Cosmological Constant' . $n . '  Einstein, the frizzy-haired,' . $n . '  said E equals MC squared.' . $n . '  Thus all mass decreases' . $n . '  as activity ceases?' . $n . '    Not my mass, my ass declared!' . $n . '- Michael R. Burch' . $n;
     ob_start();
     $stream = fopen('php://output', 'rw');
     $output = new Output($stream);
     $output->indent();
     $output->writeln('Cosmological Constant');
     $output->indent();
     $output->writeln('Einstein, the frizzy-haired,');
     $output->writeln('said E equals MC squared.');
     $output->indent();
     $output->outdent();
     $output->writeln('Thus all mass decreases');
     $output->writeln('as activity ceases?');
     $output->indent();
     $output->indent();
     $output->writeln('Not my mass, my ass declared!');
     $output->outdent();
     $output->outdent();
     $output->outdent();
     $output->outdent();
     $output->writeln('- Michael R. Burch');
     $this->assertEquals($expected, ob_get_clean());
 }
Exemple #2
0
 /**
  * Increase indention for all following lines
  *
  * @param int $tabs The tabs
  *
  * @return void
  */
 public function indent($tabs = 1)
 {
     if ($this->output) {
         $this->output->indent($tabs);
     }
     if ($this->debugOutput) {
         $this->debugOutput->indent($tabs);
     }
 }