当前位置: 首页>>代码示例>>PHP>>正文


PHP ExampleEvent::getResult方法代码示例

本文整理汇总了PHP中PhpSpec\Event\ExampleEvent::getResult方法的典型用法代码示例。如果您正苦于以下问题:PHP ExampleEvent::getResult方法的具体用法?PHP ExampleEvent::getResult怎么用?PHP ExampleEvent::getResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhpSpec\Event\ExampleEvent的用法示例。


在下文中一共展示了ExampleEvent::getResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: afterExample

 /**
  *
  * @param ExampleEvent $event        	
  *
  * @throws \PhpSpec\Exception\Example\StopOnFailureException
  */
 public function afterExample(ExampleEvent $event)
 {
     if (!$this->io->isStopOnFailureEnabled()) {
         return;
     }
     if ($event->getResult() === ExampleEvent::FAILED || $event->getResult() === ExampleEvent::BROKEN) {
         throw new StopOnFailureException('Example failed', 0, null, $event->getResult());
     }
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:15,代码来源:StopOnFailureListener.php

示例2: afterExample

 /**
  * @param ExampleEvent $event
  *
  * @throws \PhpSpec\Exception\Example\StopOnFailureException
  */
 public function afterExample(ExampleEvent $event)
 {
     if (!$this->input->hasOption('stop-on-failure') || !$this->input->getOption('stop-on-failure')) {
         return;
     }
     if ($event->getResult() === ExampleEvent::FAILED || $event->getResult() === ExampleEvent::BROKEN) {
         throw new StopOnFailureException('Example failed');
     }
 }
开发者ID:mawaha,项目名称:tracker,代码行数:14,代码来源:StopOnFailureListener.php

示例3: create

 /**
  * @param ExampleEvent       $event
  * @param PresenterInterface $presenter
  *
  * @return ReportFailedItem|ReportPassedItem|ReportPendingItem
  */
 public function create(ExampleEvent $event, PresenterInterface $presenter = null)
 {
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             return new ReportPassedItem($this->template, $event);
         case ExampleEvent::PENDING:
             return new ReportPendingItem($this->template, $event);
         case ExampleEvent::FAILED:
         case ExampleEvent::BROKEN:
             return new ReportFailedItem($this->template, $event, $presenter);
         default:
             $this->invalidResultException($event->getResult());
     }
 }
开发者ID:mawaha,项目名称:tracker,代码行数:20,代码来源:ReportItemFactory.php

示例4: printException

 /**
  * @param ExampleEvent $event
  */
 protected function printException(ExampleEvent $event)
 {
     if (null === ($exception = $event->getException())) {
         return;
     }
     $title = str_replace('\\', DIRECTORY_SEPARATOR, $event->getSpecification()->getTitle());
     $title = str_pad($title, 50, ' ', STR_PAD_RIGHT);
     $message = $this->getPresenter()->presentException($exception, $this->io->isVerbose());
     if ($exception instanceof PendingException) {
         $this->io->writeln(sprintf('<pending-bg>%s</pending-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <pending>- %s</pending>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<pending>%s</pending>', lcfirst($message)), 6);
         $this->io->writeln();
     } elseif ($exception instanceof SkippingException) {
         if ($this->io->isVerbose()) {
             $this->io->writeln(sprintf('<skipped-bg>%s</skipped-bg>', $title));
             $this->io->writeln(sprintf('<lineno>%4d</lineno>  <skipped>? %s</skipped>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
             $this->io->writeln(sprintf('<skipped>%s</skipped>', lcfirst($message)), 6);
             $this->io->writeln();
         }
     } elseif (ExampleEvent::FAILED === $event->getResult()) {
         $this->io->writeln(sprintf('<failed-bg>%s</failed-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <failed>✘ %s</failed>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<failed>%s</failed>', lcfirst($message)), 6);
         $this->io->writeln();
     } else {
         $this->io->writeln(sprintf('<broken-bg>%s</broken-bg>', $title));
         $this->io->writeln(sprintf('<lineno>%4d</lineno>  <broken>! %s</broken>', $event->getExample()->getFunctionReflection()->getStartLine(), $event->getExample()->getTitle()));
         $this->io->writeln(sprintf('<broken>%s</broken>', lcfirst($message)), 6);
         $this->io->writeln();
     }
 }
开发者ID:franzliedke,项目名称:phpspec,代码行数:35,代码来源:ConsoleFormatter.php

示例5: afterExample

 /**
  * @param ExampleEvent $event
  */
 public function afterExample(ExampleEvent $event)
 {
     $this->examplesCount++;
     $desc = sprintf(self::DESC, $this->currentSpecificationTitle, preg_replace('/^its? /', '', $event->getExample()->getTitle()));
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             $result = sprintf(self::OK, $this->examplesCount) . $desc;
             break;
         case ExampleEvent::PENDING:
             $message = $this->getResultData($event, $event->getResult());
             $result = sprintf(self::NOT_OK, $this->examplesCount) . $desc . $message;
             break;
         case ExampleEvent::SKIPPED:
             $message = sprintf(self::SKIP, $this->getResultData($event));
             $result = sprintf(self::OK, $this->examplesCount) . $desc . $message;
             break;
         case ExampleEvent::BROKEN:
         case ExampleEvent::FAILED:
             $message = $this->getResultData($event, $event->getResult());
             $result = sprintf(self::NOT_OK, $this->examplesCount) . $desc . "\n" . $message;
             break;
         default:
             $message = $this->getResultData($event, self::UNDEFINED_RESULT);
             $result = sprintf(self::NOT_OK, $this->examplesCount) . $desc . "\n" . $message;
     }
     $this->getIO()->writeln($result);
 }
开发者ID:Zarbisi,项目名称:todo,代码行数:30,代码来源:TapFormatter.php

示例6: afterExample

 /**
  *
  * @param ExampleEvent $event        	
  */
 public function afterExample(ExampleEvent $event)
 {
     $io = $this->getIO();
     $eventsCount = $this->getStatisticsCollector()->getEventsCount();
     if ($eventsCount === 1) {
         $io->writeln();
     }
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             $io->write('<passed>.</passed>');
             break;
         case ExampleEvent::PENDING:
             $io->write('<pending>P</pending>');
             break;
         case ExampleEvent::SKIPPED:
             $io->write('<skipped>S</skipped>');
             break;
         case ExampleEvent::FAILED:
             $io->write('<failed>F</failed>');
             break;
         case ExampleEvent::BROKEN:
             $io->write('<broken>B</broken>');
             break;
     }
     if ($eventsCount % 50 === 0) {
         $length = strlen((string) $this->examplesCount);
         $format = sprintf(' %%%dd / %%%dd', $length, $length);
         $io->write(sprintf($format, $eventsCount, $this->examplesCount));
         if ($eventsCount !== $this->examplesCount) {
             $io->writeLn();
         }
     }
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:37,代码来源:DotFormatter.php

示例7:

 function it_outputs_monkey_when_example_is_pending(IO $io, ExampleEvent $event)
 {
     $event->getResult()->willReturn(ExampleEvent::PENDING);
     $this->outputEmoji($event);
     $io->write(mb_convert_encoding('&#x1F649;', 'UTF-8', 'HTML-ENTITIES'))->shouldHaveBeenCalled();
     $io->write(' ')->shouldHaveBeenCalled();
 }
开发者ID:ciaranmcnulty,项目名称:phpspec-emoji-formatter,代码行数:7,代码来源:EmojiFormatterSpec.php

示例8: afterExample

 public function afterExample(ExampleEvent $event)
 {
     $type = $this->map[$event->getResult()];
     $this->addResult($type, $event->getSpecification(), $event->getTitle());
     if ($this->coverage) {
         $this->coverage->stop();
     }
 }
开发者ID:phpguard,项目名称:plugin-phpspec,代码行数:8,代码来源:PhpGuardExtension.php

示例9:

 function it_should_creates_result_event(ExampleEvent $exampleEvent, SpecificationNode $specificationNode, CodeCoverageSession $coverageSession)
 {
     $exampleEvent->getResult()->shouldBeCalled()->willReturn(ExampleEvent::PASSED);
     $specificationNode->getTitle()->shouldBeCalled()->willReturn('SomeSpesification');
     $coverageSession->stop()->shouldBeCalled();
     $this->afterExample($exampleEvent);
     $this->getResults()->shouldHaveCount(1);
 }
开发者ID:phpguard,项目名称:plugin-phpspec,代码行数:8,代码来源:PhpGuardExtensionSpec.php

示例10: afterExample

 public function afterExample(ExampleEvent $event)
 {
     $this->globalResult = max($this->globalResult, $event->getResult());
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             $this->passedEvents[] = $event;
             break;
         case ExampleEvent::PENDING:
             $this->pendingEvents[] = $event;
             break;
         case ExampleEvent::FAILED:
             $this->failedEvents[] = $event;
             break;
         case ExampleEvent::BROKEN:
             $this->brokenEvents[] = $event;
             break;
     }
 }
开发者ID:mawaha,项目名称:tracker,代码行数:18,代码来源:StatisticsCollector.php

示例11:

 function it_outputs_the_progress_every_50_examples(ExampleEvent $exampleEvent, SuiteEvent $suiteEvent, ConsoleIO $io, StatisticsCollector $stats)
 {
     $exampleEvent->getResult()->willReturn(ExampleEvent::PASSED);
     $suiteEvent->getSuite()->willReturn(range(1, 100));
     $stats->getEventsCount()->willReturn(50);
     $this->beforeSuite($suiteEvent);
     $this->afterExample($exampleEvent);
     $io->write('  50 / 100')->shouldHaveBeenCalled();
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:9,代码来源:DotFormatterSpec.php

示例12: 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

示例13: 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

示例14: outputEmoji

 public function outputEmoji(ExampleEvent $event)
 {
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             $this->io->write($this->encodeChar('&#x1f604;'));
             break;
         case ExampleEvent::FAILED:
             $this->io->write($this->encodeChar('&#x1f4a9;'));
             break;
         case ExampleEvent::BROKEN:
             $this->io->write($this->encodeChar('&#x1F525;'));
             break;
         case ExampleEvent::SKIPPED:
             $this->io->write($this->encodeChar('&#x1F648;'));
             break;
         case ExampleEvent::PENDING:
             $this->io->write($this->encodeChar('&#x1F649;'));
             break;
     }
     $this->io->write(' ');
 }
开发者ID:ciaranmcnulty,项目名称:phpspec-emoji-formatter,代码行数:21,代码来源:EmojiFormatter.php

示例15: afterExample

 /**
  * @param ExampleEvent $event
  */
 public function afterExample(ExampleEvent $event)
 {
     $io = $this->getIO();
     $output = ob_get_clean();
     if ($output) {
         $io->writeln($this->teamCityMessage("testStdOut", array("name" => $event->getTitle(), "out" => "Test Output\n>>>>>>>>>>>\n{$output}\n<<<<<<<<<<<\n")));
     }
     switch ($event->getResult()) {
         case ExampleEvent::PASSED:
             break;
         case ExampleEvent::PENDING:
             $io->writeln($this->teamCityMessage('testIgnored', array('name' => $event->getTitle(), 'details' => $event->getMessage())));
             break;
         case ExampleEvent::FAILED:
             $io->writeln($this->teamCityMessage('testFailed', array('name' => $event->getTitle(), 'message' => "Failed Test\n\n" . $event->getMessage(), 'details' => $event->getException()->getTraceAsString())));
             break;
         case ExampleEvent::BROKEN:
             $io->writeln($this->teamCityMessage('testFailed', array('name' => $event->getTitle(), 'message' => "Broken Test\n\n" . $event->getMessage(), 'details' => $event->getException()->getTraceAsString())));
             break;
     }
     $io->writeln($this->teamCityMessage('testFinished', array('name' => $event->getTitle())));
 }
开发者ID:ascii-soup,项目名称:phpspec-teamcity-formatter,代码行数:25,代码来源:TeamCityFormatter.php


注:本文中的PhpSpec\Event\ExampleEvent::getResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。