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


PHP Event\ExampleEvent类代码示例

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


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

示例1: RuntimeException

 function it_does_not_prompt_when_wrong_exception_is_thrown(IO $io, ExampleEvent $event, SuiteEvent $suiteEvent)
 {
     $event->getException()->willReturn(new RuntimeException());
     $this->afterExample($event);
     $this->afterSuite($suiteEvent);
     $io->askConfirmation(Argument::any())->shouldNotHaveBeenCalled();
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:7,代码来源:CollaboratorMethodNotFoundListenerSpec.php

示例2:

 function it_does_not_prompt_to_generate_when_there_was_an_exception_of_the_wrong_type(IO $io, ExampleEvent $exampleEvent, SuiteEvent $suiteEvent, \InvalidArgumentException $otherException)
 {
     $exampleEvent->getException()->willReturn($otherException);
     $this->afterExample($exampleEvent);
     $this->afterSuite($suiteEvent);
     $io->askConfirmation(Argument::any())->shouldNotHaveBeenCalled();
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:7,代码来源:CollaboratorNotFoundListenerSpec.php

示例3:

 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('🙉', 'UTF-8', 'HTML-ENTITIES'))->shouldHaveBeenCalled();
     $io->write(' ')->shouldHaveBeenCalled();
 }
开发者ID:ciaranmcnulty,项目名称:phpspec-emoji-formatter,代码行数:7,代码来源:EmojiFormatterSpec.php

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

示例5: afterExample

 public function afterExample(ExampleEvent $exampleEvent)
 {
     $exception = $exampleEvent->getException();
     if (!$exception instanceof NotEqualException) {
         return;
     }
     if ($exception->getActual() !== null) {
         return;
     }
     if (is_object($exception->getExpected()) || is_array($exception->getExpected()) || is_resource($exception->getExpected())) {
         return;
     }
     if (!$this->lastMethodCallEvent) {
         return;
     }
     $class = get_class($this->lastMethodCallEvent->getSubject());
     $method = $this->lastMethodCallEvent->getMethod();
     if (!$this->methodAnalyser->methodIsEmpty($class, $method)) {
         return;
     }
     $key = $class . '::' . $method;
     if (!array_key_exists($key, $this->nullMethods)) {
         $this->nullMethods[$key] = array('class' => $this->methodAnalyser->getMethodOwnerName($class, $method), 'method' => $method, 'expected' => array());
     }
     $this->nullMethods[$key]['expected'][] = $exception->getExpected();
 }
开发者ID:ProgrammingPeter,项目名称:nba-schedule-api,代码行数:26,代码来源:MethodReturnedNullListener.php

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

示例7:

 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

示例8:

 function it_identifies_a_resource_model_type(ExampleEvent $exampleEvent, ClassNotFoundException $exception, SuiteEvent $suiteEvent, $configGenerator)
 {
     $exampleEvent->getException()->willReturn($exception);
     $exception->getClassname()->willReturn('Vendor_Module_Model_Resource_Foo');
     $this->getClassNameAfterExample($exampleEvent);
     $this->createXmlAfterSuite($suiteEvent);
     $configGenerator->generateElement('resource_model', 'Vendor_Module')->shouldHavebeenCalled();
 }
开发者ID:kbulloch,项目名称:MageSpec_vm,代码行数:8,代码来源:ModuleUpdateListenerSpec.php

示例9: CurrentExampleTracker

 function it_should_call_afterCurrentExample(ExampleEvent $example)
 {
     $currentExample = new CurrentExampleTracker();
     $currentExample->setCurrentExample(null);
     $example->getTitle()->willReturn(null);
     $this->afterCurrentExample($example);
     $example->getTitle()->shouldNotHaveBeenCalled();
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:8,代码来源:CurrentExampleListenerSpec.php

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

示例11: beforeExample

 public function beforeExample(ExampleEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     $example = $event->getExample();
     $name = strtr('%spec%::%example%', array('%spec%' => $example->getSpecification()->getClassReflection()->getName(), '%example%' => $example->getFunctionReflection()->getName()));
     $this->coverage->start($name);
 }
开发者ID:samsonasik,项目名称:PhpSpecCodeCoverageExtension,代码行数:9,代码来源:CodeCoverageListener.php

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

示例13: array

 function it_writes_a_fail_message_for_a_failing_example(Template $template, ExampleEvent $event, Presenter $presenter)
 {
     $event->getTitle()->willReturn(self::EVENT_TITLE);
     $event->getMessage()->willReturn(self::EVENT_MESSAGE);
     $event->getBacktrace()->willReturn(self::$BACKTRACE);
     $event->getException()->willReturn(new \Exception());
     $template->render(Template::DIR . '/Template/ReportFailed.html', array('title' => self::EVENT_TITLE, 'message' => self::EVENT_MESSAGE, 'backtrace' => self::BACKTRACE, 'code' => self::CODE, 'index' => 1, 'specification' => 1))->shouldBeCalled();
     $presenter->presentException(Argument::cetera())->willReturn(self::CODE);
     $this->write(1);
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:10,代码来源:ReportFailedItemSpec.php

示例14: afterExample

 public function afterExample(ExampleEvent $event)
 {
     if (null === ($exception = $event->getException())) {
         return;
     }
     if (!$exception instanceof MethodNotFoundException) {
         return;
     }
     $this->methods[get_class($exception->getSubject()) . '::' . $exception->getMethodName()] = $exception->getArguments();
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:10,代码来源:MethodNotFoundListener.php

示例15: afterExample

 /**
  * @param ExampleEvent $event
  */
 public function afterExample(ExampleEvent $event)
 {
     if (null === ($exception = $event->getException())) {
         return;
     }
     if (!$exception instanceof PhpSpecClassException && !$exception instanceof ProphecyClassException) {
         return;
     }
     $this->classes[$exception->getClassname()] = true;
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:13,代码来源:ClassNotFoundListener.php


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