當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。