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


PHP Event\SuiteEvent类代码示例

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


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

示例1: afterSuite

 public function afterSuite(SuiteEvent $event)
 {
     if (!$this->io->isCodeGenerationEnabled()) {
         return;
     }
     foreach ($this->methods as $call => $arguments) {
         list($classname, $method) = explode('::', $call);
         if (in_array($method, $this->wrongMethodNames)) {
             continue;
         }
         $message = sprintf('Do you want me to create `%s()` for you?', $call);
         try {
             $resource = $this->resources->createResource($classname);
         } catch (\RuntimeException $e) {
             continue;
         }
         if ($this->io->askConfirmation($message)) {
             $this->generator->generate($resource, 'method', array('name' => $method, 'arguments' => $arguments));
             $event->markAsWorthRerunning();
         }
     }
     if ($this->wrongMethodNames) {
         $this->writeWrongMethodNameMessage();
         $event->markAsNotWorthRerunning();
     }
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:26,代码来源:MethodNotFoundListener.php

示例2: afterSuite

 public function afterSuite(SuiteEvent $event)
 {
     if (!$this->io->isCodeGenerationEnabled()) {
         return;
     }
     foreach ($this->methods as $call => $arguments) {
         list($classname, $method) = explode('::', $call);
         $message = sprintf('Do you want me to create `%s()` for you?', $call);
         try {
             $resource = $this->resources->createResource($classname);
         } catch (\RuntimeException $e) {
             continue;
         }
         if ($this->io->askConfirmation($message)) {
             $this->generator->generate($resource, 'named_constructor', array('name' => $method, 'arguments' => $arguments));
             $event->markAsWorthRerunning();
             if (!method_exists($classname, '__construct')) {
                 $message = sprintf('Do you want me to make the constructor of %s private for you?', $classname);
                 if ($this->io->askConfirmation($message)) {
                     $this->generator->generate($resource, 'private-constructor', array('name' => $method, 'arguments' => $arguments));
                 }
             }
         }
     }
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:25,代码来源:NamedConstructorNotFoundListener.php

示例3: afterSuite

 public function afterSuite(SuiteEvent $event)
 {
     $io = $this->getIO();
     $io->writeln();
     foreach (array('failed' => $this->getStatisticsCollector()->getFailedEvents(), 'broken' => $this->getStatisticsCollector()->getBrokenEvents(), 'skipped' => $this->getStatisticsCollector()->getSkippedEvents()) as $status => $events) {
         if (!count($events)) {
             continue;
         }
         $io->writeln(sprintf("<%s>----  %s examples</%s>\n", $status, $status, $status));
         foreach ($events as $failEvent) {
             $io->writeln(sprintf('%s', str_replace('\\', DIRECTORY_SEPARATOR, $failEvent->getSpecification()->getTitle())), 8);
             $this->afterExample($failEvent);
             $io->writeln();
         }
     }
     $io->writeln(sprintf("\n%d specs", $this->getStatisticsCollector()->getTotalSpecs()));
     $counts = array();
     foreach ($this->getStatisticsCollector()->getCountsHash() as $type => $count) {
         if ($count) {
             $counts[] = sprintf('<%s>%d %s</%s>', $type, $count, $type, $type);
         }
     }
     $io->write(sprintf("%d examples ", $this->getStatisticsCollector()->getEventsCount()));
     if (count($counts)) {
         $io->write(sprintf("(%s)", implode(', ', $counts)));
     }
     $io->writeln(sprintf("\n%sms", round($event->getTime() * 1000)));
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:28,代码来源:PrettyFormatter.php

示例4:

 function it_records_how_many_specs_are_in_the_suite(SuiteEvent $suiteEvent, Suite $suite, SpecificationNode $spec)
 {
     $suiteEvent->getSuite()->willReturn($suite);
     $suite->getSpecifications()->willReturn(array($spec));
     $this->beforeSuite($suiteEvent);
     $this->getTotalSpecsCount()->shouldReturn(1);
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:7,代码来源:StatisticsCollectorSpec.php

示例5:

 function it_prompts_and_warns_when_one_method_name_is_correct_but_other_reserved($exampleEvent, SuiteEvent $suiteEvent, IO $io, NameCheckerInterface $nameChecker)
 {
     $this->callAfterExample($exampleEvent, $nameChecker, 'throw', false);
     $this->callAfterExample($exampleEvent, $nameChecker, 'foo');
     $io->writeBrokenCodeBlock("I cannot generate the method 'throw' for you because it is a reserved keyword", 2)->shouldBeCalled();
     $io->askConfirmation('Do you want me to create `stdClass::foo()` for you?')->shouldBeCalled();
     $suiteEvent->markAsNotWorthRerunning()->shouldBeCalled();
     $this->afterSuite($suiteEvent);
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:9,代码来源:MethodNotFoundListenerSpec.php

示例6: CurrentExampleTracker

 function it_should_call_afterSuiteEvent(SuiteEvent $example)
 {
     $fatalError = '3';
     $currentExample = new CurrentExampleTracker();
     $currentExample->setCurrentExample("Exited with code: " . $fatalError);
     $example->getResult()->willReturn($fatalError);
     $this->afterSuiteEvent($example);
     $example->getResult()->shouldHaveBeenCalled();
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:9,代码来源:CurrentExampleListenerSpec.php

示例7: afterSuite

 public function afterSuite(SuiteEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     if (0 !== $event->getResult()) {
         return;
     }
     $this->output[] = $this->reporter->getOutput($this->coverage);
 }
开发者ID:addvilz,项目名称:phpspec-cover,代码行数:10,代码来源:Listener.php

示例8:

 function it_aggregates_testsuite_nodes_and_display_them_after_suite_run(SuiteEvent $event, $io, $stats)
 {
     $event->getTime()->willReturn(48151.62342);
     $stats->getFailedEvents()->willReturn(range(1, 12));
     $stats->getBrokenEvents()->willReturn(range(1, 3));
     $stats->getEventsCount()->willReturn(100);
     $this->setTestSuiteNodes(array('<testsuite name="specification1" tests="3">' . "\n" . '<testcase name="example1" />' . "\n" . '<testcase name="example2" />' . "\n" . '<testcase name="example3" />' . "\n" . '</testsuite>', '<testsuite name="specification2" tests="2">' . "\n" . '<testcase name="example1" />' . "\n" . '<testcase name="example2" />' . "\n" . '</testsuite>'));
     $this->afterSuite($event);
     $io->write('<?xml version="1.0" encoding="UTF-8" ?>' . "\n" . '<testsuites time="48151.623420" tests="100" failures="12" errors="3">' . "\n" . '<testsuite name="specification1" tests="3">' . "\n" . '<testcase name="example1" />' . "\n" . '<testcase name="example2" />' . "\n" . '<testcase name="example3" />' . "\n" . '</testsuite>' . "\n" . '<testsuite name="specification2" tests="2">' . "\n" . '<testcase name="example1" />' . "\n" . '<testcase name="example2" />' . "\n" . '</testsuite>' . "\n" . '</testsuites>')->shouldBeCalled();
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:10,代码来源:JUnitFormatterSpec.php

示例9: outputSuiteSummary

 private function outputSuiteSummary(SuiteEvent $event)
 {
     $this->outputTotalSpecCount();
     $this->outputTotalExamplesCount();
     $this->outputSpecificExamplesCount();
     $this->getIO()->writeln(sprintf("\n%sms", round($event->getTime() * 1000)));
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:7,代码来源:DotFormatter.php

示例10: afterSuite

 /**
  * @param SuiteEvent $event
  */
 public function afterSuite(SuiteEvent $event)
 {
     if (!$this->io->isCodeGenerationEnabled()) {
         return;
     }
     foreach ($this->exceptions as $exception) {
         $resource = $this->resources->createResource($exception->getCollaboratorName());
         if ($this->resourceIsInSpecNamespace($exception, $resource)) {
             continue;
         }
         if ($this->io->askConfirmation(sprintf('Would you like me to generate an interface `%s` for you?', $exception->getCollaboratorName()))) {
             $this->generator->generate($resource, 'interface');
             $event->markAsWorthRerunning();
         }
     }
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:19,代码来源:CollaboratorNotFoundListener.php

示例11: afterSuite

 /**
  * @param SuiteEvent $event
  */
 public function afterSuite(SuiteEvent $event)
 {
     $io = $this->getIO();
     $stats = $this->getStatisticsCollector();
     $io->writeln("\n");
     foreach (array('failed' => $stats->getFailedEvents(), 'broken' => $stats->getBrokenEvents(), 'pending' => $stats->getPendingEvents(), 'skipped' => $stats->getSkippedEvents()) as $status => $events) {
         if (!count($events)) {
             continue;
         }
         foreach ($events as $failEvent) {
             $this->printException($failEvent);
         }
     }
     $plural = $stats->getTotalSpecs() !== 1 ? 's' : '';
     $io->writeln(sprintf("%d spec%s", $stats->getTotalSpecs(), $plural));
     $counts = array();
     foreach ($stats->getCountsHash() as $type => $count) {
         if ($count) {
             $counts[] = sprintf('<%s>%d %s</%s>', $type, $count, $type, $type);
         }
     }
     $count = $stats->getEventsCount();
     $plural = $count !== 1 ? 's' : '';
     $io->write(sprintf("%d example%s ", $count, $plural));
     if (count($counts)) {
         $io->write(sprintf("(%s)", implode(', ', $counts)));
     }
     $io->writeln(sprintf("\n%sms", round($event->getTime() * 1000)));
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:32,代码来源:DotFormatter.php

示例12: afterSuite

 /**
  * @param SuiteEvent $event
  */
 public function afterSuite(SuiteEvent $event)
 {
     if (!$this->io->isCodeGenerationEnabled()) {
         return;
     }
     foreach ($this->classes as $classname => $_) {
         $message = sprintf('Do you want me to create `%s` for you?', $classname);
         try {
             $resource = $this->resources->createResource($classname);
         } catch (\RuntimeException $e) {
             continue;
         }
         if ($this->io->askConfirmation($message)) {
             $this->generator->generate($resource, 'class');
             $event->markAsWorthRerunning();
         }
     }
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:21,代码来源:ClassNotFoundListener.php

示例13: afterSuite

 public function afterSuite(SuiteEvent $event)
 {
     $io = $this->getIO();
     $stats = $this->getStatisticsCollector();
     $io->freezeTemp();
     $io->writeln();
     $io->writeln(sprintf("%d specs", $stats->getTotalSpecs()));
     $counts = array();
     foreach ($stats->getCountsHash() as $type => $count) {
         if ($count) {
             $counts[] = sprintf('<%s>%d %s</%s>', $type, $count, $type, $type);
         }
     }
     $count = $stats->getEventsCount();
     $plural = $count !== 1 ? 's' : '';
     $io->write(sprintf("%d example%s ", $count, $plural));
     if (count($counts)) {
         $io->write(sprintf("(%s)", implode(', ', $counts)));
     }
     $io->writeln(sprintf("\n%sms", round($event->getTime() * 1000)));
 }
开发者ID:cordoval,项目名称:phpspec,代码行数:21,代码来源:ProgressFormatter.php

示例14:

 function it_outputs_a_suite_summary(SuiteEvent $event, ConsoleIO $io, StatisticsCollector $stats)
 {
     $stats->getEventsCount()->willReturn(1);
     $stats->getFailedEvents()->willReturn(array());
     $stats->getBrokenEvents()->willReturn(array());
     $stats->getPendingEvents()->willReturn(array());
     $stats->getSkippedEvents()->willReturn(array());
     $stats->getTotalSpecs()->willReturn(15);
     $event->getTime()->willReturn(12.345);
     $stats->getCountsHash()->willReturn(array('passed' => 1, 'pending' => 0, 'skipped' => 0, 'failed' => 2, 'broken' => 0));
     $this->afterSuite($event);
     $io->writeln('15 specs')->shouldHaveBeenCalled();
     $io->writeln("\n12345ms")->shouldHaveBeenCalled();
     $io->write('1 example ')->shouldHaveBeenCalled();
     $expected = '(<passed>1 passed</passed>, <failed>2 failed</failed>)';
     $io->write($expected)->shouldHaveBeenCalled();
 }
开发者ID:phpspec,项目名称:phpspec,代码行数:17,代码来源:DotFormatterSpec.php

示例15: afterSuite

 /**
  * @param SuiteEvent $suiteEvent
  */
 public function afterSuite(SuiteEvent $suiteEvent)
 {
     if ($suiteEvent->isWorthRerunning()) {
         $this->reRunner->reRunSuite();
     }
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:9,代码来源:RerunListener.php


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