getTime() public méthode

public getTime ( ) : float
Résultat float
 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)));
 }
 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();
 }
 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)));
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 public function afterSuite(SuiteEvent $event)
 {
     $stats = $this->getStatisticsCollector();
     $this->getIo()->write(sprintf('<?xml version="1.0" encoding="UTF-8" ?>' . "\n" . '<testsuites time="%s" tests="%s" failures="%s" errors="%s">' . "\n" . '%s' . "\n" . '</testsuites>', $event->getTime(), $stats->getEventsCount(), count($stats->getFailedEvents()), count($stats->getBrokenEvents()), implode("\n", $this->testSuiteNodes)));
 }
Exemple #5
0
 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();
 }
 private function outputSuiteSummary(SuiteEvent $event)
 {
     $this->outputTotalSpecCount();
     $this->outputTotalExamplesCount();
     $this->outputSpecificExamplesCount();
     $this->getIO()->writeln(sprintf("\n%sms", round($event->getTime() * 1000)));
 }
Exemple #7
0
 /**
  * @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)));
 }