Esempio n. 1
0
 public function testFormattedEscapedOutput()
 {
     $output = new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, true, null);
     $output->writeln('<info>' . OutputFormatter::escape('<error>some error</error>') . '</info>');
     rewind($output->getStream());
     $this->assertSame("<error>some error</error>" . PHP_EOL, stream_get_contents($output->getStream()));
 }
Esempio n. 2
0
 public function testDoWrite()
 {
     $output = new StreamOutput($this->stream);
     $output->writeln('foo');
     rewind($output->getStream());
     $this->assertEquals('foo' . PHP_EOL, stream_get_contents($output->getStream()), '->doWrite() writes to the stream');
 }
 /**
  * @param boolean
  *
  * @return string
  */
 public function getDisplay($normalize = false)
 {
     rewind($this->output->getStream());
     $display = stream_get_contents($this->output->getStream());
     if ($normalize) {
         $display = str_replace(PHP_EOL, "\n", $display);
     }
     return $display;
 }
 /**
  * @return string
  *
  * @throws \Exception
  */
 private function getRawCommandOutput()
 {
     if (!$this->output) {
         throw new \Exception('No command output!');
     }
     rewind($this->output->getStream());
     return stream_get_contents($this->output->getStream());
 }
Esempio n. 5
0
 /**
  * Returns the contents of the output stream.
  *
  * @param StreamOutput $output The output manager.
  *
  * @return string The contents of the stream.
  */
 public function readOutput(StreamOutput $output)
 {
     $contents = '';
     $stream = $output->getStream();
     rewind($stream);
     do {
         $contents .= fgets($stream);
     } while (!feof($stream));
     return $contents;
 }
Esempio n. 6
0
 /**
  * helper method to get output as string out of a StreamOutput
  *
  * @param $output
  *
  * @return string all output
  */
 protected function getOutputBuffer(StreamOutput $output)
 {
     $handle = $output->getStream();
     rewind($handle);
     $display = stream_get_contents($handle);
     // Symfony2's StreamOutput has a hidden dependency on PHP_EOL which needs to be removed by
     // normalizing it to the standard newline for text here.
     $display = strtr($display, array(PHP_EOL => "\n"));
     return $display;
 }
 /**
  * Reads the contents of an output stream.
  *
  * @param StreamOutput $output The stream output manager.
  *
  * @return string The contents of the stream.
  */
 protected function readOutput(StreamOutput $output)
 {
     $stream = $output->getStream();
     $contents = '';
     rewind($stream);
     do {
         $contents .= fgets($stream);
     } while (!feof($stream));
     fclose($stream);
     return $contents;
 }
Esempio n. 8
0
 /**
  * Constructor.
  *
  * @param StreamOutput $output
  */
 public function __construct(StreamOutput $output)
 {
     parent::__construct($output->getStream());
 }
Esempio n. 9
0
 /**
  * Constructor.
  *
  * @param StreamOutput $output        	
  * @param string $cmd
  *        	Pager process command (default: 'less -R -S -F -X')
  */
 public function __construct(StreamOutput $output, $cmd = 'less -R -S -F -X')
 {
     $this->stream = $output->getStream();
     $this->cmd = $cmd;
 }
Esempio n. 10
0
 /**
  * Gets the display from the stream output.
  *
  * @return string
  */
 protected function getDisplay(StreamOutput $output)
 {
     rewind($output->getStream());
     return stream_get_contents($output->getStream());
 }
Esempio n. 11
0
 private function assertOutputContains($expected, StreamOutput $output)
 {
     rewind($output->getStream());
     $stream = stream_get_contents($output->getStream());
     $this->assertContains($expected, $stream);
 }
 /**
  * See if stream output is a tty terminal.
  *
  * @return bool
  */
 private function isTtyTerminal(StreamOutput $output)
 {
     $tty = function_exists('posix_isatty') && @posix_isatty($output->getStream());
     if ($tty) {
         putenv("PERIDOT_TTY=1");
     }
     return $tty;
 }
Esempio n. 13
0
 public function getOutputStreamContent(StreamOutput $streamOutput)
 {
     $stream = $streamOutput->getStream();
     rewind($stream);
     return stream_get_contents($stream);
 }
Esempio n. 14
0
 /**
  * @param StreamOutput $output
  */
 private function functionalAsserts(StreamOutput $output)
 {
     $baseDir = realpath(__DIR__ . '/..');
     rewind($output->getStream());
     $content = stream_get_contents($output->getStream());
     $this->assertContains('Running the fsTest job > Filesystem Block Tests', $content);
     $this->assertContains('Creating tmp/', $content);
     $this->assertFileExists($baseDir . '/tmp');
     $this->assertContains('Creating tmp/test/deep', $content);
     $this->assertFileExists($baseDir . '/tmp/test');
     $this->assertFileExists($baseDir . '/tmp/test/deep');
     $this->assertContains('Touching tmp/test.tmp', $content);
     $this->assertFileExists($baseDir . '/tmp/test.tmp');
     $this->assertContains('Touching tmp/test/deep/test.tmp', $content);
     $this->assertFileExists($baseDir . '/tmp/test/deep/test.tmp');
     $this->assertContains('Running the lint job > Lints the files of the project', $content);
     $this->assertContains('Lint Task Finished', $content);
     $this->assertContains('Build Success!', $content);
 }
Esempio n. 15
0
 protected function getOutputContent(StreamOutput $output)
 {
     rewind($output->getStream());
     return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream()));
 }
Esempio n. 16
0
 private function getOutput(StreamOutput $output)
 {
     rewind($output->getStream());
     return stream_get_contents($output->getStream());
 }
 /**
  * @param StreamOutput $output
  * @return StreamOutput
  */
 private function getStreamOutput(StreamOutput $output = null)
 {
     if ($output) {
         rewind($output->getStream());
         $this->consoleOutput[] = trim(stream_get_contents($output->getStream()));
         fclose($output->getStream());
     }
     return new StreamOutput(fopen('php://memory', 'w+', false), StreamOutput::VERBOSITY_VERBOSE);
 }