當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StreamOutput::getStream方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Output\StreamOutput::getStream方法的典型用法代碼示例。如果您正苦於以下問題:PHP StreamOutput::getStream方法的具體用法?PHP StreamOutput::getStream怎麽用?PHP StreamOutput::getStream使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Output\StreamOutput的用法示例。


在下文中一共展示了StreamOutput::getStream方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testFormattedEscapedOutput

 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("[32m<error>some error</error>[39m" . PHP_EOL, stream_get_contents($output->getStream()));
 }
開發者ID:tronsha,項目名稱:cerberus,代碼行數:7,代碼來源:ConsoleTest.php

示例2: testDoWrite

 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');
 }
開發者ID:Ener-Getick,項目名稱:symfony,代碼行數:7,代碼來源:StreamOutputTest.php

示例3: getDisplay

 /**
  * @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;
 }
開發者ID:burimshala,項目名稱:numbertowords,代碼行數:14,代碼來源:ApplicationTester.php

示例4: getRawCommandOutput

 /**
  * @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());
 }
開發者ID:lafourchette,項目名稱:FriendlyContexts,代碼行數:13,代碼來源:CommandContext.php

示例5: readOutput

 /**
  * 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;
 }
開發者ID:bangpound,項目名稱:console,代碼行數:17,代碼來源:CommandTestCase.php

示例6: getOutputBuffer

 /**
  * 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;
 }
開發者ID:netz98,項目名稱:n98-magerun,代碼行數:17,代碼來源:TestCase.php

示例7: readOutput

 /**
  * 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;
 }
開發者ID:box-project,項目名稱:box3,代碼行數:18,代碼來源:AbstractCommandTestCase.php

示例8: __construct

 /**
  * Constructor.
  *
  * @param StreamOutput $output
  */
 public function __construct(StreamOutput $output)
 {
     parent::__construct($output->getStream());
 }
開發者ID:jordeytje,項目名稱:vlamteddybeer,代碼行數:9,代碼來源:PassthruPager.php

示例9: __construct

 /**
  * 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;
 }
開發者ID:sapwoo,項目名稱:portfolio,代碼行數:12,代碼來源:ProcOutputPager.php

示例10: getDisplay

 /**
  * Gets the display from the stream output.
  *
  * @return string
  */
 protected function getDisplay(StreamOutput $output)
 {
     rewind($output->getStream());
     return stream_get_contents($output->getStream());
 }
開發者ID:maartenstaa,項目名稱:phpta,代碼行數:10,代碼來源:ProjectTest.php

示例11: assertOutputContains

 private function assertOutputContains($expected, StreamOutput $output)
 {
     rewind($output->getStream());
     $stream = stream_get_contents($output->getStream());
     $this->assertContains($expected, $stream);
 }
開發者ID:ayoah,項目名稱:symfony,代碼行數:6,代碼來源:SymfonyQuestionHelperTest.php

示例12: isTtyTerminal

 /**
  * 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;
 }
開發者ID:peridot-php,項目名稱:peridot-reporters,代碼行數:13,代碼來源:AbstractBaseReporter.php

示例13: getOutputStreamContent

 public function getOutputStreamContent(StreamOutput $streamOutput)
 {
     $stream = $streamOutput->getStream();
     rewind($stream);
     return stream_get_contents($stream);
 }
開發者ID:pavsuri,項目名稱:PARMT,代碼行數:6,代碼來源:MigrationTestCase.php

示例14: functionalAsserts

 /**
  * @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);
 }
開發者ID:kangkot,項目名稱:bldr,代碼行數:22,代碼來源:ApplicationTest.php

示例15: getOutputContent

 protected function getOutputContent(StreamOutput $output)
 {
     rewind($output->getStream());
     return str_replace(PHP_EOL, "\n", stream_get_contents($output->getStream()));
 }
開發者ID:sintoris,項目名稱:Known,代碼行數:5,代碼來源:TableTest.php


注:本文中的Symfony\Component\Console\Output\StreamOutput::getStream方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。