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


PHP ExampleEvent::getTime方法代碼示例

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


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

示例1: printSlowTime

 protected function printSlowTime(ExampleEvent $event)
 {
     $io = $this->getIO();
     $ms = $event->getTime() * 1000;
     if ($ms > 100) {
         $io->write(sprintf(' <failed>(%sms)</failed>', round($ms)));
     } elseif ($ms > 50) {
         $io->write(sprintf(' <pending>(%sms)</pending>', round($ms)));
     }
 }
開發者ID:edwardricardo,項目名稱:zenska,代碼行數:10,代碼來源:PrettyFormatter.php

示例2: ExceptionStub

 function it_stores_a_testcase_node_after_failed_example_run(ExampleEvent $event, SpecificationNode $specification, \ReflectionClass $refClass)
 {
     $event->getResult()->willReturn(ExampleEvent::FAILED);
     $event->getTitle()->willReturn('example title');
     $event->getTime()->willReturn(1337);
     $event->getException()->willReturn(new ExceptionStub('Something went wrong', 'Exception trace'));
     $event->getSpecification()->willReturn($specification);
     $specification->getClassReflection()->willReturn($refClass);
     $refClass->getName()->willReturn('Acme\\Foo\\Bar');
     $this->afterExample($event);
     $this->getTestCaseNodes()->shouldReturn(array('<testcase name="example title" time="1337" classname="Acme\\Foo\\Bar" status="failed">' . "\n" . '<failure type="spec\\PhpSpec\\Formatter\\ExceptionStub" message="Something went wrong" />' . "\n" . '<system-err>' . "\n" . '<![CDATA[' . "\n" . 'Exception trace' . "\n" . ']]>' . "\n" . '</system-err>' . "\n" . '</testcase>'));
 }
開發者ID:mawaha,項目名稱:tracker,代碼行數:12,代碼來源:JUnitFormatterSpec.php

示例3: SkippingException

 function it_stores_a_testcase_node_after_skipped_example_run(ExampleEvent $event, SpecificationNode $specification, \ReflectionClass $refClass)
 {
     $event->getResult()->willReturn(ExampleEvent::SKIPPED);
     $event->getTitle()->willReturn('example title');
     $event->getTime()->willReturn(1337);
     $event->getException()->willReturn(new SkippingException('zog zog'));
     $event->getSpecification()->willReturn($specification);
     $specification->getClassReflection()->willReturn($refClass);
     $refClass->getName()->willReturn('Acme\\Foo\\Bar');
     $this->afterExample($event);
     // skipped tag is escaped because a skipped tag is also registered in the console formatter
     $this->getTestCaseNodes()->shouldReturn(array('<testcase name="example title" time="1337.000000" classname="Acme\\Foo\\Bar" status="skipped">' . "\n" . '\\<skipped><![CDATA[ skipped: zog zog ]]>\\</skipped>' . "\n" . '</testcase>'));
 }
開發者ID:focuslife,項目名稱:v0.1,代碼行數:13,代碼來源:JUnitFormatterSpec.php

示例4: afterExample

 /**
  * {@inheritdoc}
  */
 public function afterExample(ExampleEvent $event)
 {
     $testCaseNode = sprintf('<testcase name="%s" time="%s" classname="%s" status="%s"', $event->getTitle(), $event->getTime(), $event->getSpecification()->getClassReflection()->getName(), $this->jUnitStatuses[$event->getResult()]);
     $this->exampleStatusCounts[$event->getResult()]++;
     if (in_array($event->getResult(), array(ExampleEvent::BROKEN, ExampleEvent::FAILED))) {
         $exception = $event->getException();
         $testCaseNode .= sprintf('>' . "\n" . '<%s type="%s" message="%s" />' . "\n" . '<system-err>' . "\n" . '<![CDATA[' . "\n" . '%s' . "\n" . ']]>' . "\n" . '</system-err>' . "\n" . '</testcase>', $this->resultTags[$event->getResult()], get_class($exception), htmlspecialchars($exception->getMessage()), $exception->getTraceAsString());
     } else {
         $testCaseNode .= ' />';
     }
     $this->testCaseNodes[] = $testCaseNode;
 }
開發者ID:mawaha,項目名稱:tracker,代碼行數:15,代碼來源:JUnitFormatter.php

示例5: afterPassedExample

 private function afterPassedExample(ExampleEvent $event)
 {
     $duration = $event->getTime() * 1000;
     $this->finished('', $this->title($event), " duration='{$duration}'");
 }
開發者ID:pawel-grzona,項目名稱:teamcity-phpspec-extension,代碼行數:5,代碼來源:Formatter.php

示例6: afterExample

 public function afterExample(ExampleEvent $event)
 {
     $this->logger->logExample($event->getSpecification()->getTitle(), $event->getTitle(), $event->getTime());
 }
開發者ID:padraic,項目名稱:phpspec-extensions,代碼行數:4,代碼來源:TimeCollectorListener.php


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