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


PHP PHPUnit_Util_Test::describe方法代碼示例

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


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

示例1: accept

 /**
  * @return boolean
  */
 public function accept()
 {
     $test = $this->getInnerIterator()->current();
     if ($test instanceof PHPUnit_Framework_TestSuite) {
         return TRUE;
     }
     $tmp = PHPUnit_Util_Test::describe($test, FALSE);
     if ($tmp[0] != '') {
         $name = join('::', $tmp);
     } else {
         $name = $tmp[1];
     }
     return preg_match($this->filter, $name);
 }
開發者ID:ramonornela,項目名稱:phpunit,代碼行數:17,代碼來源:Test.php

示例2: endTest

 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     parent::endTest($test, $time);
     if ($this->debug) {
         foreach ($this->timeColors as $threshold => $color) {
             if ($time >= $threshold) {
                 $timeColor = $color;
                 break;
             }
         }
         $this->write(' ');
         $this->writeWithColor($timeColor, '[' . number_format($time, 3) . 's]', false);
         $this->write(' ');
         $this->writeWithColor('fg-cyan', \PHPUnit_Util_Test::describe($test), true);
     }
 }
開發者ID:diablomedia,項目名稱:phpunit-pretty-printer,代碼行數:16,代碼來源:PrettyPrinter.php

示例3: accept

 /**
  * @return bool
  */
 public function accept()
 {
     $test = $this->getInnerIterator()->current();
     if ($test instanceof PHPUnit_Framework_TestSuite) {
         return TRUE;
     }
     $tmp = PHPUnit_Util_Test::describe($test, FALSE);
     if ($tmp[0] != '') {
         $name = implode('::', $tmp);
     } else {
         $name = $tmp[1];
     }
     $accepted = preg_match($this->filter, $name, $matches);
     if ($accepted && isset($this->filterMax)) {
         $set = end($matches);
         $accepted = $set >= $this->filterMin && $set <= $this->filterMax;
     }
     return $accepted;
 }
開發者ID:mrbadao,項目名稱:api-official,代碼行數:22,代碼來源:Test.php

示例4: endTest

 /**
  * {@inheritdoc}
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     $test_name = \PHPUnit_Util_Test::describe($test);
     if (!empty($test_name)) {
         $this->test_name_status = sprintf("%s (%s)\n", $test_name, sprintf("%s ms", round($time * 1000)));
     }
     if (!$this->lastTestFailed) {
         $this->writeProgress('.');
     }
     if ($test instanceof \PHPUnit_Framework_TestCase) {
         $this->numAssertions += $test->getNumAssertions();
     } elseif ($test instanceof \PHPUnit_Extensions_PhptTestCase) {
         $this->numAssertions++;
     }
     $this->lastTestFailed = false;
     if ($test instanceof \PHPUnit_Framework_TestCase) {
         if (method_exists($this, 'hasExpectationOnOutput') && !$test->hasExpectationOnOutput()) {
             $this->write($test->getActualOutput());
         }
     }
 }
開發者ID:skyzyx,項目名稱:phpunit-result-printer,代碼行數:24,代碼來源:ResultPrinter.php

示例5: run

 /**
  * Runs the tests and collects their result in a TestResult.
  *
  * @param  PHPUnit_Framework_TestResult $result
  * @param  mixed                        $filter
  * @param  array                        $groups
  * @param  array                        $excludeGroups
  * @return PHPUnit_Framework_TestResult
  * @throws InvalidArgumentException
  */
 public function run(PHPUnit_Framework_TestResult $result = NULL, $filter = FALSE, array $groups = array(), array $excludeGroups = array())
 {
     if ($result === NULL) {
         $result = $this->createResult();
     }
     try {
         $this->setUp();
     } catch (PHPUnit_Framework_SkippedTestSuiteError $e) {
         $numTests = count($this);
         for ($i = 0; $i < $numTests; $i++) {
             $result->addFailure($this, $e, 0);
         }
         return $result;
     }
     $result->startTestSuite($this);
     if (empty($groups)) {
         $tests = $this->tests;
     } else {
         $tests = array();
         foreach ($groups as $group) {
             if (isset($this->groups[$group])) {
                 $tests = array_merge($tests, $this->groups[$group]);
             }
         }
     }
     foreach ($tests as $test) {
         if ($result->shouldStop()) {
             break;
         }
         if ($test instanceof PHPUnit_Framework_TestSuite) {
             $test->setBackupGlobals($this->backupGlobals);
             $test->setSharedFixture($this->sharedFixture);
             $test->run($result, $filter, $groups, $excludeGroups);
         } else {
             $runTest = TRUE;
             if ($filter !== FALSE) {
                 $tmp = PHPUnit_Util_Test::describe($test, FALSE);
                 if ($tmp[0] != '') {
                     $name = join('::', $tmp);
                 } else {
                     $name = $tmp[1];
                 }
                 if (preg_match($filter, $name) == 0) {
                     $runTest = FALSE;
                 }
             }
             if ($runTest && !empty($excludeGroups)) {
                 foreach ($this->groups as $_group => $_tests) {
                     if (@in_array($_group, $excludeGroups)) {
                         foreach ($_tests as $_test) {
                             if ($test === $_test) {
                                 $runTest = FALSE;
                                 break 2;
                             }
                         }
                     }
                 }
             }
             if ($runTest) {
                 if ($test instanceof PHPUnit_Framework_TestCase) {
                     $test->setBackupGlobals($this->backupGlobals);
                     $test->setSharedFixture($this->sharedFixture);
                 }
                 $this->runTest($test, $result);
             }
         }
     }
     $result->endTestSuite($this);
     $this->tearDown();
     return $result;
 }
開發者ID:cjmi,項目名稱:miniblog,代碼行數:81,代碼來源:TestSuite.php

示例6: startTest

 /**
  * A test started.
  *
  * @param  PHPUnit_Framework_Test $test
  */
 public function startTest(PHPUnit_Framework_Test $test)
 {
     $this->currentTestName = PHPUnit_Util_Test::describe($test);
     $this->currentTestPass = TRUE;
 }
開發者ID:febryantosulistyo,項目名稱:ClassicSocial,代碼行數:10,代碼來源:JSON.php

示例7: addTestNode

 /**
  * @param  PHPUnit_Framework_Test $test
  * @param  string                  $color
  * @access private
  */
 private function addTestNode(PHPUnit_Framework_Test $test, $color)
 {
     $name = PHPUnit_Util_Test::describe($test, FALSE);
     $this->graphs[$this->testSuiteLevel]->addNode($name[1], array('color' => $color, 'URL' => sprintf('%s-test.html#%s', PHPUnit_Util_Filesystem::getSafeFilename($name[0]), $name[1])), $this->testSuites[$this->testSuiteLevel]);
     $this->graphs[$this->testSuiteLevel]->addEdge(array($this->testSuites[$this->testSuiteLevel] => $name[1]));
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:11,代碼來源:GraphViz.php

示例8: startTestSuite

 public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
 {
     $this->level++;
     $name = PHPUnit_Util_Test::describe($suite);
     if (empty($name)) {
         //$name = get_class($suite);
         $name = '-';
     }
     $this->suiteStack[] = $name;
 }
開發者ID:aoemedia,項目名稱:menta,代碼行數:10,代碼來源:HtmlResultPrinter.php

示例9: startTest

 /**
  * A test started.
  *
  * @param  PHPUnit_Framework_Test $test
  */
 public function startTest(PHPUnit_Framework_Test $test)
 {
     $this->currentTestName = PHPUnit_Util_Test::describe($test);
     $this->currentTestPass = TRUE;
     $this->write("\n");
     $this->write(sprintf('test started: %s', $this->currentTestName));
 }
開發者ID:k-kalashnikov,項目名稱:geekcon.local,代碼行數:12,代碼來源:phpunit_test_listener_plain.php

示例10: _getFilteredTests

 private static function _getFilteredTests($testSuite, $filter, array $groups, array $excludeGroups)
 {
     $ret = array();
     if (empty($groups)) {
         $tests = $testSuite->tests;
     } else {
         $tests = array();
         foreach ($groups as $group) {
             if (isset($testSuite->groups[$group])) {
                 $tests = array_merge($tests, $testSuite->groups[$group]);
             }
         }
     }
     foreach ($tests as $test) {
         if ($test instanceof PHPUnit_Framework_TestSuite) {
             $ret = array_merge($ret, self::_getFilteredTests($test, $filter, $groups, $excludeGroups));
         } else {
             $runTest = TRUE;
             if ($filter !== FALSE) {
                 $tmp = PHPUnit_Util_Test::describe($test, FALSE);
                 if ($tmp[0] != '') {
                     $name = join('::', $tmp);
                 } else {
                     $name = $tmp[1];
                 }
                 if (preg_match($filter, $name) == 0) {
                     $runTest = FALSE;
                 }
             }
             if ($runTest && !empty($excludeGroups)) {
                 foreach ($testSuite->groups as $_group => $_tests) {
                     if (in_array($_group, $excludeGroups)) {
                         foreach ($_tests as $_test) {
                             if ($test === $_test) {
                                 $runTest = FALSE;
                                 break 2;
                             }
                         }
                     }
                 }
             }
             if ($runTest) {
                 $ret[] = $test;
             }
         }
     }
     return $ret;
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:48,代碼來源:TestSuite.php

示例11: addTestNode

 /**
  * @param  PHPUnit_Framework_Test $test
  * @param  string                  $color
  * @access private
  */
 private function addTestNode(PHPUnit_Framework_Test $test, $color)
 {
     $name = PHPUnit_Util_Test::describe($test, FALSE);
     $this->graph->addNode($name[1], array('color' => $color), $this->testSuites[$this->testSuiteLevel]);
     $this->graph->addEdge(array($this->testSuites[$this->testSuiteLevel] => $name[1]));
 }
開發者ID:dalinhuang,項目名稱:shopexts,代碼行數:11,代碼來源:GraphViz.php

示例12: startTest

 /**
  * A test started.
  *
  * @param  PHPUnit_Framework_Test $test
  */
 public function startTest(PHPUnit_Framework_Test $test)
 {
     $this->currentTestName = PHPUnit_Util_Test::describe($test);
     $this->currentTestPass = TRUE;
     $this->write(array('event' => 'testStart', 'suite' => $this->currentTestSuiteName, 'test' => $this->currentTestName));
 }
開發者ID:streetparade,項目名稱:phpunit,代碼行數:11,代碼來源:JSON.php

示例13: getTests

 /**
  * @param  PHPUnit_Framework_TestResult $result
  * @param  PHPUnit_Framework_TestSuite  $testSuite
  * @return array
  * @access protected
  * @since  Method available since Release 3.0.0
  */
 protected static function getTests(PHPUnit_Framework_TestResult $result, PHPUnit_Framework_TestSuite $testSuite = NULL)
 {
     if ($testSuite === NULL) {
         $testSuite = $result->topTestSuite();
     }
     $tests = array();
     foreach ($testSuite->tests() as $test) {
         if ($test instanceof PHPUnit_Framework_TestSuite) {
             $tests = array_merge($tests, self::getTests($result, $test));
         } else {
             $testName = PHPUnit_Util_Test::describe($test, FALSE);
             $tests[] = array('name' => $testName[1], 'object' => $test, 'result' => PHPUnit_Util_Test::lookupResult($test, $result));
         }
     }
     return array($testSuite->getName() => $tests);
 }
開發者ID:dalinhuang,項目名稱:shopexts,代碼行數:23,代碼來源:Factory.php

示例14: startTest

 /**
  * A test started.
  *
  * @param  PHPUnit_Framework_Test $test
  */
 public function startTest(PHPUnit_Framework_Test $test)
 {
     $this->current_suite()->tests[$test->getName()] = (object) array('description' => PHPUnit_Util_Test::describe($test), 'exceptions' => array(), 'assertions' => 0, 'success' => false);
     $this->test =& $this->current_suite()->tests[$test->getName()];
 }
開發者ID:rmccue,項目名稱:Gorilla,代碼行數:10,代碼來源:Base.php

示例15: endTest

 /**
  * A test ended.
  *
  * @param \PHPUnit_Framework_Test $test
  * @param float                   $time
  *
  * @return void
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     if ($test instanceof \PHPUnit_Framework_TestCase) {
         $assertionCount = $test->getNumAssertions();
         $this->numAssertions += $assertionCount;
         if ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
             $status = 'failures';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_ERROR) {
             $status = 'errors';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE) {
             $status = 'incompletes';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED) {
             $status = 'skips';
         } elseif ($test->getStatus() == \PHPUnit_Runner_BaseTestRunner::STATUS_RISKY) {
             $status = 'risky';
         } else {
             $status = 'tests';
         }
         if (count($this->suites) - $this->endedSuites > 1) {
             $suiteName = end($this->suites);
             $this->stats[$suiteName][$status]++;
             $this->stats[$suiteName]['assertions'] += $assertionCount;
         }
         // updates also top test suite
         $suiteName = reset($this->suites);
         $this->stats[$suiteName][$status]++;
         $this->stats[$suiteName]['assertions'] += $assertionCount;
     }
     if (method_exists($test, 'hasOutput') && $test->hasOutput()) {
         $output = $test->getActualOutput();
     } else {
         $output = '';
     }
     $testName = $test->getName();
     $context = array('testName' => $testName, 'testDescriptionArr' => \PHPUnit_Util_Test::describe($test, false), 'testDescriptionStr' => $test->toString(), 'operation' => __FUNCTION__, 'output' => $output);
     if (isset($assertionCount)) {
         $context['assertionCount'] = $assertionCount;
     }
     $this->logger->info(sprintf("Test '%s' ended.", $testName), $context);
 }
開發者ID:jclaveau,項目名稱:phpunit-LoggerTestListener,代碼行數:48,代碼來源:AbstractLoggerTestListener.php


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