当前位置: 首页>>代码示例>>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;未经允许,请勿转载。