コード例 #1
0
 /**
  * @test
  */
 public function outputOutputsOutput()
 {
     $output = 'Hello world!';
     ob_start();
     $this->fixture->output($output);
     $this->assertSame($output, ob_get_contents());
     ob_end_clean();
 }
コード例 #2
0
 /**
  * @test
  */
 public function outputOutputsOutput()
 {
     $output = 'Hello world!';
     ob_start();
     $this->subject->output($output);
     self::assertSame($output, ob_get_contents());
     ob_end_clean();
 }
コード例 #3
0
ファイル: TestListener.php プロジェクト: TrueType/phpunit
 /**
  * A test has ended.
  *
  * @param PHPUnit_Framework_Test $test the test that has ended
  * @param float $time ?
  *
  * @return void
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     $this->memoryUsageEndOfTest = memory_get_usage();
     if ($test instanceof PHPUnit_Framework_TestCase) {
         /** @var  PHPUnit_Framework_TestCase $test */
         // Tests with the same name are a sign of data provider usage.
         $testNameParts = explode(' ', $test->getName());
         $testName = get_class($test) . ':' . $testNameParts[0];
         if ($testName !== $this->previousTestName) {
             $this->currentDataProviderNumber = 0;
             $this->currentTestNumber++;
             $this->previousTestName = $testName;
         } else {
             $this->currentDataProviderNumber++;
             $this->totalNumberOfDetectedDataProviderTests++;
         }
     }
     if ($this->totalNumberOfTests - $this->totalNumberOfDetectedDataProviderTests > 0) {
         $percentDone = 100.0 * $this->currentTestNumber / ($this->totalNumberOfTests - $this->totalNumberOfDetectedDataProviderTests);
     } else {
         $percentDone = 0.0;
     }
     if ($test instanceof PHPUnit_Framework_TestCase) {
         $this->testAssertions += $test->getNumAssertions();
     }
     $output = '</div>';
     if ($this->showTime) {
         $output .= '<span class="time-usages small-font"><strong>Time:</strong> ' . sprintf('%.4f', $time) . ' sec.</span><br />';
     }
     $output .= '</div>' . '<script type="text/javascript">/*<![CDATA[*/document.getElementById("progress-bar").style.width = "' . $percentDone . '%";/*]]>*/</script>';
     $this->outputService->output($output);
     $this->outputService->flushOutputBuffer();
 }
コード例 #4
0
ファイル: Module.php プロジェクト: chrmue01/typo3-starter-kit
 /**
  * Renders and outputs the code coverage report.
  *
  * @return void
  */
 protected function renderCodeCoverage()
 {
     $this->coverage->stop();
     $codeCoverageDirectory = PATH_site . 'typo3temp/codecoverage/';
     if (!is_readable($codeCoverageDirectory) && !is_dir($codeCoverageDirectory)) {
         t3lib_div::mkdir($codeCoverageDirectory);
     }
     $coverageReport = new PHP_CodeCoverage_Report_HTML();
     $coverageReport->process($this->coverage, $codeCoverageDirectory);
     $this->outputService->output('<p><a target="_blank" href="../typo3temp/codecoverage/index.html">' . 'Click here to access the Code Coverage report</a></p>' . '<p>Memory peak usage: ' . t3lib_div::formatSize(memory_get_peak_usage()) . 'B<p/>');
 }