How to use getDurations method of score class

Best Atoum code snippet using score.getDurations

score.php

Source:score.php Github

copy

Full Screen

...14 ->array($score->getFailAssertions())->isEmpty()15 ->array($score->getExceptions())->isEmpty()16 ->array($score->getErrors())->isEmpty()17 ->array($score->getOutputs())->isEmpty()18 ->array($score->getDurations())->isEmpty()19 ->array($score->getMemoryUsages())->isEmpty()20 ->array($score->getUncompletedMethods())->isEmpty()21 ->array($score->getSkippedMethods())->isEmpty()22 ->object($score->getCoverage())->isInstanceOf('mageekguy\atoum\score\coverage')23 ->and($score = new atoum\score($coverage = new atoum\score\coverage()))24 ->then25 ->integer($score->getPassNumber())->isZero()26 ->array($score->getFailAssertions())->isEmpty()27 ->array($score->getExceptions())->isEmpty()28 ->array($score->getErrors())->isEmpty()29 ->array($score->getOutputs())->isEmpty()30 ->array($score->getDurations())->isEmpty()31 ->array($score->getMemoryUsages())->isEmpty()32 ->array($score->getUncompletedMethods())->isEmpty()33 ->array($score->getSkippedMethods())->isEmpty()34 ->object($score->getCoverage())->isIdenticalTo($coverage)35 ;36 }37 public function testAddException()38 {39 $this40 ->if($score = new atoum\score())41 ->then42 ->object($score->addException($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $exception = new \exception()))->isIdenticalTo($score)43 ->array($score->getExceptions())->isEqualTo([44 [45 'case' => null,46 'dataSetKey' => null,47 'dataSetProvider' => null,48 'class' => $class,49 'method' => $method,50 'file' => $file,51 'line' => $line,52 'value' => (string) $exception53 ]54 ]55 )56 ->integer($score->getExceptionNumber())->isEqualTo(1)57 ->object($score->addException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherException = new \exception()))->isIdenticalTo($score)58 ->array($score->getExceptions())->isEqualTo([59 [60 'case' => null,61 'dataSetKey' => null,62 'dataSetProvider' => null,63 'class' => $class,64 'method' => $method,65 'file' => $file,66 'line' => $line,67 'value' => (string) $exception68 ],69 [70 'case' => null,71 'dataSetKey' => null,72 'dataSetProvider' => null,73 'class' => $otherClass,74 'method' => $otherMethod,75 'file' => $otherFile,76 'line' => $otherLine,77 'value' => (string) $otherException78 ]79 ]80 )81 ;82 }83 public function testAddPass()84 {85 $this86 ->if($score = new atoum\score())87 ->then88 ->object($score->addPass())->isIdenticalTo($score)89 ->integer($score->getPassNumber())->isEqualTo(1)90 ->object($score->addPass())->isIdenticalTo($score)91 ->integer($score->getPassNumber())->isEqualTo(2)92 ;93 }94 public function testAddFail()95 {96 $this97 ->if($score = new atoum\score())98 ->then99 ->integer($score->addFail($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $asserter = new atoum\asserters\integer(new atoum\asserter\generator()), $reason = uniqid()))->isGreaterThan(0)100 ->array($score->getFailAssertions())->isEqualTo([101 [102 'case' => null,103 'dataSetKey' => null,104 'dataSetProvider' => null,105 'class' => $class,106 'method' => $method,107 'file' => $file,108 'line' => $line,109 'asserter' => $asserter,110 'fail' => $reason111 ]112 ]113 )114 ->integer($score->addFail($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherAsserter = new atoum\asserters\integer(new atoum\asserter\generator()), $otherReason = uniqid()))->isGreaterThan(0)115 ->array($score->getFailAssertions())->isEqualTo([116 [117 'case' => null,118 'dataSetKey' => null,119 'dataSetProvider' => null,120 'class' => $class,121 'method' => $method,122 'file' => $file,123 'line' => $line,124 'asserter' => $asserter,125 'fail' => $reason126 ],127 [128 'case' => null,129 'dataSetKey' => null,130 'dataSetProvider' => null,131 'class' => $otherClass,132 'method' => $otherMethod,133 'file' => $otherFile,134 'line' => $otherLine,135 'asserter' => $otherAsserter,136 'fail' => $otherReason137 ]138 ]139 )140 ;141 }142 public function testAddError()143 {144 $this145 ->if($score = new atoum\score())146 ->then147 ->array($score->getErrors())->isEmpty()148 ->integer($score->getErrorNumber())->isZero()149 ->object($score->addError($file = 'file1', $class = 'class1', $method = 'method1', $line = 1, $type = 5, $message = 'message1', $errorFile = 'errorFile1', $errorLine = 2))->isIdenticalTo($score)150 ->array($score->getErrors())->isEqualTo([151 [152 'case' => null,153 'dataSetKey' => null,154 'dataSetProvider' => null,155 'class' => $class,156 'method' => $method,157 'file' => $file,158 'line' => $line,159 'type' => $type,160 'message' => $message,161 'errorFile' => $errorFile,162 'errorLine' => $errorLine163 ]164 ]165 )166 ->integer($score->getErrorNumber())->isEqualTo(1)167 ->object($score->addError($otherFile = 'file2', $otherClass = 'class2', $otherMethod = 'method2', $otherLine = 10, $otherType = 15, $otherMessage = 'message2', $otherErrorFile = 'errorFile2', $otherErrorLine = 20))->isIdenticalTo($score)168 ->array($score->getErrors())->isEqualTo([169 [170 'case' => null,171 'dataSetKey' => null,172 'dataSetProvider' => null,173 'class' => $class,174 'method' => $method,175 'file' => $file,176 'line' => $line,177 'type' => $type,178 'message' => $message,179 'errorFile' => $errorFile,180 'errorLine' => $errorLine181 ],182 [183 'case' => null,184 'dataSetKey' => null,185 'dataSetProvider' => null,186 'class' => $otherClass,187 'method' => $otherMethod,188 'file' => $otherFile,189 'line' => $otherLine,190 'type' => $otherType,191 'message' => $otherMessage,192 'errorFile' => $otherErrorFile,193 'errorLine' => $otherErrorLine194 ]195 ]196 )197 ->integer($score->getErrorNumber())->isEqualTo(2)198 ->object($score->addError($file, $class, $method, $line, $type, $anAnotherMessage = 'message1.1', $errorFile, $errorLine))->isIdenticalTo($score)199 ->array($score->getErrors())->isEqualTo([200 [201 'case' => null,202 'dataSetKey' => null,203 'dataSetProvider' => null,204 'class' => $class,205 'method' => $method,206 'file' => $file,207 'line' => $line,208 'type' => $type,209 'message' => $message,210 'errorFile' => $errorFile,211 'errorLine' => $errorLine212 ],213 [214 'case' => null,215 'dataSetKey' => null,216 'dataSetProvider' => null,217 'class' => $class,218 'method' => $method,219 'file' => $file,220 'line' => $line,221 'type' => $type,222 'message' => $anAnotherMessage,223 'errorFile' => $errorFile,224 'errorLine' => $errorLine225 ],226 [227 'case' => null,228 'dataSetKey' => null,229 'dataSetProvider' => null,230 'class' => $otherClass,231 'method' => $otherMethod,232 'file' => $otherFile,233 'line' => $otherLine,234 'type' => $otherType,235 'message' => $otherMessage,236 'errorFile' => $otherErrorFile,237 'errorLine' => $otherErrorLine238 ]239 ]240 )241 ->integer($score->getErrorNumber())->isEqualTo(3)242 ->object($score->addError($file, $class, $method, $line + 1, $type, (" \t \t" . $messageWithWhitespace = 'message with withespace' . " \t " . PHP_EOL), $errorFile, $errorLine))->isIdenticalTo($score)243 ->array($score->getErrors())244 ->contains([245 'case' => null,246 'dataSetKey' => null,247 'dataSetProvider' => null,248 'class' => $class,249 'method' => $method,250 'file' => $file,251 'line' => $line,252 'type' => $type,253 'message' => $anAnotherMessage,254 'errorFile' => $errorFile,255 'errorLine' => $errorLine256 ]257 )258 ->contains([259 'case' => null,260 'dataSetKey' => null,261 'dataSetProvider' => null,262 'class' => $class,263 'method' => $method,264 'file' => $file,265 'line' => $line,266 'type' => $type,267 'message' => $message,268 'errorFile' => $errorFile,269 'errorLine' => $errorLine270 ]271 )272 ->contains([273 'case' => null,274 'dataSetKey' => null,275 'dataSetProvider' => null,276 'class' => $class,277 'method' => $method,278 'file' => $file,279 'line' => $line + 1,280 'type' => $type,281 'message' => trim($messageWithWhitespace),282 'errorFile' => $errorFile,283 'errorLine' => $errorLine284 ]285 )286 ->contains([287 'case' => null,288 'dataSetKey' => null,289 'dataSetProvider' => null,290 'class' => $otherClass,291 'method' => $otherMethod,292 'file' => $otherFile,293 'line' => $otherLine,294 'type' => $otherType,295 'message' => $otherMessage,296 'errorFile' => $otherErrorFile,297 'errorLine' => $otherErrorLine298 ]299 )300 ->integer($score->getErrorNumber())->isEqualTo(4)301 ;302 }303 public function testAddOutput()304 {305 $this306 ->if($score = new atoum\score())307 ->then308 ->array($score->getOutputs())->isEmpty()309 ->integer($score->getOutputNumber())->isZero()310 ->object($score->addOutput($file = uniqid(), $class = uniqid(), $method = uniqid(), $output = uniqid()))->isIdenticalTo($score)311 ->array($score->getOutputs())->isEqualTo([312 [313 'class' => $class,314 'method' => $method,315 'value' => $output316 ]317 ]318 )319 ->integer($score->getOutputNumber())->isEqualTo(1)320 ->object($score->addOutput($file = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherOutput = uniqid()))->isIdenticalTo($score)321 ->array($score->getOutputs())->isEqualTo([322 [323 'class' => $class,324 'method' => $method,325 'value' => $output326 ],327 [328 'class' => $otherClass,329 'method' => $otherMethod,330 'value' => $otherOutput331 ]332 ]333 )334 ->integer($score->getOutputNumber())->isEqualTo(2)335 ->object($score->addOutput($file = uniqid(), $class, $method, $moreOutput = uniqid()))->isIdenticalTo($score)336 ->array($score->getOutputs())->isEqualTo([337 [338 'class' => $class,339 'method' => $method,340 'value' => $output341 ],342 [343 'class' => $otherClass,344 'method' => $otherMethod,345 'value' => $otherOutput346 ],347 [348 'class' => $class,349 'method' => $method,350 'value' => $moreOutput351 ]352 ]353 )354 ->integer($score->getOutputNumber())->isEqualTo(3)355 ;356 }357 public function testAddDuration()358 {359 $this360 ->if($score = new atoum\score())361 ->then362 ->array($score->getDurations())->isEmpty()363 ->integer($score->getDurationNumber())->isZero()364 ->object($score->addDuration($path = uniqid(), $class = uniqid(), $method = uniqid(), $duration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)365 ->array($score->getDurations())->isEqualTo([366 [367 'class' => $class,368 'method' => $method,369 'value' => $duration,370 'path' => $path371 ]372 ]373 )374 ->integer($score->getDurationNumber())->isEqualTo(1)375 ->object($score->addDuration($otherPath = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)376 ->array($score->getDurations())->isEqualTo([377 [378 'class' => $class,379 'method' => $method,380 'value' => $duration,381 'path' => $path382 ],383 [384 'class' => $otherClass,385 'method' => $otherMethod,386 'value' => $otherDuration,387 'path' => $otherPath388 ]389 ]390 )391 ->integer($score->getDurationNumber())->isEqualTo(2)392 ->object($score->addDuration(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)393 ->array($score->getDurations())->isEqualTo([394 [395 'class' => $class,396 'method' => $method,397 'value' => $duration,398 'path' => $path399 ],400 [401 'class' => $otherClass,402 'method' => $otherMethod,403 'value' => $otherDuration,404 'path' => $otherPath405 ]406 ]407 )408 ->integer($score->getDurationNumber())->isEqualTo(2)409 ->object($score->addDuration(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)410 ->array($score->getDurations())->isEqualTo([411 [412 'class' => $class,413 'method' => $method,414 'value' => $duration,415 'path' => $path416 ],417 [418 'class' => $otherClass,419 'method' => $otherMethod,420 'value' => $otherDuration,421 'path' => $otherPath422 ]423 ]424 )425 ->integer($score->getDurationNumber())->isEqualTo(2)426 ->object($score->addDuration($path, $class, $method, $moreDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)427 ->array($score->getDurations())->isEqualTo([428 [429 'class' => $class,430 'method' => $method,431 'value' => $duration,432 'path' => $path433 ],434 [435 'class' => $otherClass,436 'method' => $otherMethod,437 'value' => $otherDuration,438 'path' => $otherPath439 ],440 [441 'class' => $class,442 'method' => $method,443 'value' => $moreDuration,444 'path' => $path445 ]446 ]447 )448 ->integer($score->getDurationNumber())->isEqualTo(3)449 ;450 }451 public function testAddMemoryUsage()452 {453 $this454 ->if($score = new atoum\score())455 ->then456 ->array($score->getMemoryUsages())->isEmpty()457 ->object($score->addMemoryUsage($file = uniqid(), $class = uniqid(), $method = uniqid(), $memoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)458 ->array($score->getMemoryUsages())->isEqualTo([459 [460 'class' => $class,461 'method' => $method,462 'value' => $memoryUsage463 ]464 ]465 )466 ->object($score->addMemoryUsage($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)467 ->array($score->getMemoryUsages())->isEqualTo([468 [469 'class' => $class,470 'method' => $method,471 'value' => $memoryUsage472 ],473 [474 'class' => $otherClass,475 'method' => $otherMethod,476 'value' => $otherMemoryUsage477 ]478 ]479 )480 ->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)481 ->array($score->getMemoryUsages())->isEqualTo([482 [483 'class' => $class,484 'method' => $method,485 'value' => $memoryUsage486 ],487 [488 'class' => $otherClass,489 'method' => $otherMethod,490 'value' => $otherMemoryUsage491 ]492 ]493 )494 ->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)495 ->array($score->getMemoryUsages())->isEqualTo([496 [497 'class' => $class,498 'method' => $method,499 'value' => $memoryUsage500 ],501 [502 'class' => $otherClass,503 'method' => $otherMethod,504 'value' => $otherMemoryUsage505 ]506 ]507 )508 ->object($score->addMemoryUsage($file, $class, $method, $moreMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)509 ->array($score->getMemoryUsages())->isEqualTo([510 [511 'class' => $class,512 'method' => $method,513 'value' => $memoryUsage514 ],515 [516 'class' => $otherClass,517 'method' => $otherMethod,518 'value' => $otherMemoryUsage519 ],520 [521 'class' => $class,522 'method' => $method,523 'value' => $moreMemoryUsage524 ]525 ]526 )527 ;528 }529 public function testAddUncompletedMethod()530 {531 $this532 ->if($score = new atoum\score())533 ->then534 ->array($score->getUncompletedMethods())->isEmpty()535 ->object($score->addUncompletedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))->isIdenticalTo($score)536 ->array($score->getUncompletedMethods())->isEqualTo([537 [538 'file' => $file,539 'class' => $class,540 'method' => $method,541 'exitCode' => $exitCode,542 'output' => $output,543 ]544 ]545 )546 ->object($score->addUncompletedMethod($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))->isIdenticalTo($score)547 ->array($score->getUncompletedMethods())->isEqualTo([548 [549 'file' => $file,550 'class' => $class,551 'method' => $method,552 'exitCode' => $exitCode,553 'output' => $output,554 ],555 [556 'file' => $otherFile,557 'class' => $otherClass,558 'method' => $otherMethod,559 'exitCode' => $otherExitCode,560 'output' => $otherOutput,561 ]562 ]563 )564 ;565 }566 public function testAddSkippedMethod()567 {568 $this569 ->if($score = new atoum\score())570 ->then571 ->array($score->getSkippedMethods())->isEmpty()572 ->object($score->addSkippedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $message = uniqid()))->isIdenticalTo($score)573 ->array($score->getSkippedMethods())->isEqualTo([574 [575 'file' => $file,576 'class' => $class,577 'method' => $method,578 'line' => $line,579 'message' => $message580 ]581 ]582 )583 ;584 }585 public function testAddRuntimeException()586 {587 $this588 ->if($score = new atoum\score())589 ->then590 ->array($score->getRuntimeExceptions())->isEmpty()591 ->integer($score->getRuntimeExceptionNumber())->isZero()592 ->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $exception = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)593 ->array($score->getRuntimeExceptions())->isEqualTo([594 $exception595 ]596 )597 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(1)598 ->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $otherException = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)599 ->array($score->getRuntimeExceptions())->isEqualTo([600 $exception,601 $otherException602 ]603 )604 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)605 ;606 }607 public function testSetCoverage()608 {609 $this610 ->if($score = new atoum\score())611 ->then612 ->object($score->setCoverage($coverage = new atoum\score\coverage()))->isIdenticalTo($score)613 ->object($score->getCoverage())->isIdenticalTo($coverage)614 ;615 }616 public function testGetExceptionNumber()617 {618 $this619 ->if($score = new atoum\score())620 ->then621 ->integer($score->getExceptionNumber())->isZero()622 ->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))623 ->then624 ->integer($score->getExceptionNumber())->isEqualTo(1)625 ->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))626 ->then627 ->integer($score->getExceptionNumber())->isEqualTo(2)628 ;629 }630 public function testGetFailNumber()631 {632 $this633 ->if($score = new atoum\score())634 ->then635 ->integer($score->getFailNumber())->isZero()636 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))637 ->then638 ->integer($score->getFailNumber())->isEqualTo(1)639 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))640 ->then641 ->integer($score->getFailNumber())->isEqualTo(2)642 ;643 }644 public function testGetFailAssertions()645 {646 $this647 ->if($score = new atoum\score())648 ->then649 ->array($score->getFailAssertions())->isEmpty()650 ->if($score->addPass())651 ->then652 ->array($score->getFailAssertions())->isEmpty()653 ->if($score->addFail($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $asserter = new atoum\asserters\integer(new atoum\asserter\generator()), $reason = uniqid()))654 ->then655 ->array($score->getFailAssertions())->isEqualTo([656 [657 'case' => null,658 'dataSetKey' => null,659 'dataSetProvider' => null,660 'class' => $class,661 'method' => $method,662 'file' => $file,663 'line' => $line,664 'asserter' => $asserter,665 'fail' => $reason666 ]667 ]668 )669 ;670 }671 public function testGetLastFailAssertion()672 {673 $this674 ->if($score = new atoum\score())675 ->then676 ->variable($score->getLastFailAssertion())->isNull()677 ->if($score->addPass())678 ->then679 ->variable($score->getLastFailAssertion())->isNull()680 ->if($score->addFail($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $asserter = new atoum\asserters\integer(new atoum\asserter\generator()), $reason = uniqid()))681 ->then682 ->array($score->getLastFailAssertion())->isEqualTo([683 'case' => null,684 'dataSetKey' => null,685 'dataSetProvider' => null,686 'class' => $class,687 'method' => $method,688 'file' => $file,689 'line' => $line,690 'asserter' => $asserter,691 'fail' => $reason692 ]693 )694 ;695 }696 public function testGetLastVoidMethod()697 {698 $this699 ->if($score = new atoum\score())700 ->then701 ->variable($score->getLastVoidMethod())->isNull()702 ->if($score->addPass())703 ->then704 ->variable($score->getLastVoidMethod())->isNull()705 ->if($score->addVoidMethod($file = uniqid(), $class = uniqid(), $method = uniqid()))706 ->then707 ->array($score->getLastVoidMethod())->isEqualTo([708 'file' => $file,709 'class' => $class,710 'method' => $method711 ]712 )713 ;714 }715 public function testGetLastSkippedMethod()716 {717 $this718 ->if($score = new atoum\score())719 ->then720 ->variable($score->getLastSkippedMethod())->isNull()721 ->if($score->addPass())722 ->then723 ->variable($score->getLastSkippedMethod())->isNull()724 ->if($score->addSkippedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $message = uniqid()))725 ->then726 ->array($score->getLastSkippedMethod())->isEqualTo([727 'file' => $file,728 'class' => $class,729 'method' => $method,730 'line' => $line,731 'message' => $message732 ]733 )734 ;735 }736 public function testGetLastErroredMethod()737 {738 $this739 ->if($score = new atoum\score())740 ->then741 ->variable($score->getLastErroredMethod())->isNull()742 ->if($score->addPass())743 ->then744 ->variable($score->getLastErroredMethod())->isNull()745 ->if($score->addError($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $type = rand(E_ERROR, E_USER_DEPRECATED), $message = uniqid()))746 ->then747 ->array($score->getLastErroredMethod())->isEqualTo([748 'case' => null,749 'dataSetKey' => null,750 'dataSetProvider' => null,751 'class' => $class,752 'method' => $method,753 'file' => $file,754 'line' => $line,755 'type' => $type,756 'message' => trim($message),757 'errorFile' => null,758 'errorLine' => null759 ]760 )761 ->if($score->addError($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $type = rand(E_ERROR, E_USER_DEPRECATED), $message = uniqid(), $errorFile = uniqid(), $errorLine = rand(1, PHP_INT_MAX), $case = uniqid(), $dataSetKey = uniqid(), $dataSetProvider = uniqid()))762 ->then763 ->array($score->getLastErroredMethod())->isEqualTo([764 'case' => $case,765 'dataSetKey' => $dataSetKey,766 'dataSetProvider' => $dataSetProvider,767 'class' => $class,768 'method' => $method,769 'file' => $file,770 'line' => $line,771 'type' => $type,772 'message' => trim($message),773 'errorFile' => $errorFile,774 'errorLine' => $errorLine775 ]776 )777 ;778 }779 public function testGetLastException()780 {781 $this782 ->if($score = new atoum\score())783 ->then784 ->variable($score->getLastException())->isNull()785 ->if($score->addPass())786 ->then787 ->variable($score->getLastException())->isNull()788 ->if($score->addException($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $exception = new \exception()))789 ->then790 ->array($score->getLastException())->isEqualTo([791 'case' => null,792 'dataSetKey' => null,793 'dataSetProvider' => null,794 'class' => $class,795 'method' => $method,796 'file' => $file,797 'line' => $line,798 'value' => (string) $exception799 ]800 )801 ->if($score->addException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherException = new \exception(), $case = uniqid(), $dataSetKey = uniqid(), $dataSetProvider = uniqid()))802 ->then803 ->array($score->getLastException())->isEqualTo([804 'case' => $case,805 'dataSetKey' => $dataSetKey,806 'dataSetProvider' => $dataSetProvider,807 'class' => $otherClass,808 'method' => $otherMethod,809 'file' => $otherFile,810 'line' => $otherLine,811 'value' => (string) $otherException812 ]813 )814 ;815 }816 public function testGetLastUncompleteMethod()817 {818 $this819 ->if($score = new atoum\score())820 ->then821 ->variable($score->getLastUncompleteMethod())->isNull()822 ->if($score->addPass())823 ->then824 ->variable($score->getLastUncompleteMethod())->isNull()825 ->if($score->addUncompletedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))826 ->then827 ->array($score->getLastUncompleteMethod())->isEqualTo([828 'file' => $file,829 'class' => $class,830 'method' => $method,831 'exitCode' => $exitCode,832 'output' => $output,833 ]834 )835 ->if($score->addUncompletedMethod($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))836 ->then837 ->array($score->getLastUncompleteMethod())->isEqualTo([838 'file' => $otherFile,839 'class' => $otherClass,840 'method' => $otherMethod,841 'exitCode' => $otherExitCode,842 'output' => $otherOutput,843 ]844 )845 ;846 }847 public function testGetLastRuntimeException()848 {849 $this850 ->if($score = new atoum\score())851 ->then852 ->variable($score->getLastRuntimeException())->isNull()853 ->if($score->addPass())854 ->then855 ->variable($score->getLastRuntimeException())->isNull()856 ->if($score->addRuntimeException($file = uniqid(), $class = uniqid(), $method = uniqid(), $exception = new exceptions\runtime()))857 ->then858 ->object($score->getLastRuntimeException())->isIdenticalTo($exception)859 ->if($score->addRuntimeException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherException = new exceptions\runtime()))860 ->then861 ->object($score->getLastRuntimeException())->isIdenticalTo($otherException)862 ;863 }864 public function testGetPassAssertions()865 {866 $this867 ->if($score = new atoum\score())868 ->then869 ->integer($score->getPassNumber())->isZero()870 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))871 ->then872 ->integer($score->getPassNumber())->isZero()873 ->if($score->addPass())874 ->then875 ->integer($score->getPassNumber())->isEqualTo(1)876 ;877 }878 public function testGetCoverage()879 {880 $this881 ->if($score = new atoum\score())882 ->then883 ->object($coverage = $score->getCoverage())->isInstanceOf('mageekguy\atoum\score\coverage')884 ;885 }886 public function testGetMethodsWithFail()887 {888 $this889 ->if($score = new atoum\score())890 ->then891 ->array($score->getMethodsWithFail())->isEmpty()892 ->if($asserter = new atoum\asserters\integer(new atoum\asserter\generator()))893 ->and($score->addFail(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))894 ->then895 ->array($score->getMethodsWithFail())->isEqualTo([$class => [$classMethod]])896 ->if($score->addFail(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))897 ->then898 ->array($score->getMethodsWithFail())->isEqualTo([$class => [$classMethod, $classOtherMethod]])899 ->if($score->addFail(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))900 ->then901 ->array($score->getMethodsWithFail())->isEqualTo([902 $class => [$classMethod, $classOtherMethod],903 $otherClass => [$otherClassMethod]904 ]905 )906 ;907 }908 public function testGetMethodsWithError()909 {910 $this911 ->if($score = new atoum\score())912 ->then913 ->array($score->getMethodsWithError())->isEmpty()914 ->if($score->addError(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))915 ->then916 ->array($score->getMethodsWithError())->isEqualTo([$class => [$classMethod]])917 ->if($score->addError(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))918 ->then919 ->array($score->getMethodsWithError())->isEqualTo([$class => [$classMethod, $classOtherMethod]])920 ->if($score->addError(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))921 ->then922 ->array($score->getMethodsWithError())->isEqualTo([923 $class => [$classMethod, $classOtherMethod],924 $otherClass => [$otherClassMethod]925 ]926 )927 ;928 }929 public function testGetMethodsWithException()930 {931 $this932 ->if($score = new atoum\score())933 ->then934 ->array($score->getMethodsWithError())->isEmpty()935 ->if($score->addException(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))936 ->then937 ->array($score->getMethodsWithException())->isEqualTo([$class => [$classMethod]])938 ->if($score->addException(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))939 ->then940 ->array($score->getMethodsWithException())->isEqualTo([$class => [$classMethod, $classOtherMethod]])941 ->if($score->addException(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))942 ->then943 ->array($score->getMethodsWithException())->isEqualTo([944 $class => [$classMethod, $classOtherMethod],945 $otherClass => [$otherClassMethod]946 ]947 )948 ;949 }950 public function testReset()951 {952 $this953 ->if($score = new atoum\score())954 ->then955 ->integer($score->getPassNumber())->isZero()956 ->array($score->getFailAssertions())->isEmpty()957 ->array($score->getExceptions())->isEmpty()958 ->array($score->getRuntimeExceptions())->isEmpty()959 ->array($score->getErrors())->isEmpty()960 ->array($score->getOutputs())->isEmpty()961 ->array($score->getDurations())->isEmpty()962 ->array($score->getMemoryUsages())->isEmpty()963 ->array($score->getUncompletedMethods())->isEmpty()964 ->object($score->reset())->isIdenticalTo($score)965 ->integer($score->getPassNumber())->isZero()966 ->array($score->getFailAssertions())->isEmpty()967 ->array($score->getExceptions())->isEmpty()968 ->array($score->getRuntimeExceptions())->isEmpty()969 ->array($score->getErrors())->isEmpty()970 ->array($score->getOutputs())->isEmpty()971 ->array($score->getDurations())->isEmpty()972 ->array($score->getMemoryUsages())->isEmpty()973 ->array($score->getUncompletedMethods())->isEmpty()974 ->if($score975 ->addPass()976 ->addException(uniqid(), rand(1, PHP_INT_MAX), uniqid(), uniqid(), new \exception())977 ->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime())978 ->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX))979 ->addOutput(uniqid(), uniqid(), uniqid(), uniqid())980 ->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))981 ->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))982 ->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid())983 )984 ->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))985 ->then986 ->integer($score->getPassNumber())->isGreaterThan(0)987 ->array($score->getFailAssertions())->isNotEmpty()988 ->array($score->getExceptions())->isNotEmpty()989 ->array($score->getRuntimeExceptions())->isNotEmpty()990 ->array($score->getErrors())->isNotEmpty()991 ->array($score->getOutputs())->isNotEmpty()992 ->array($score->getDurations())->isNotEmpty()993 ->array($score->getMemoryUsages())->isNotEmpty()994 ->array($score->getUncompletedMethods())->isNotEmpty()995 ->object($score->reset())->isIdenticalTo($score)996 ->integer($score->getPassNumber())->isZero()997 ->array($score->getFailAssertions())->isEmpty()998 ->array($score->getExceptions())->isEmpty()999 ->array($score->getRuntimeExceptions())->isEmpty()1000 ->array($score->getErrors())->isEmpty()1001 ->array($score->getOutputs())->isEmpty()1002 ->array($score->getDurations())->isEmpty()1003 ->array($score->getMemoryUsages())->isEmpty()1004 ->array($score->getUncompletedMethods())->isEmpty()1005 ;1006 }1007 public function testMerge()1008 {1009 $this1010 ->if($score = new atoum\score())1011 ->and($otherScore = new atoum\score())1012 ->then1013 ->object($score->merge($otherScore))->isIdenticalTo($score)1014 ->integer($score->getPassNumber())->isZero()1015 ->array($score->getFailAssertions())->isEmpty()1016 ->array($score->getExceptions())->isEmpty()1017 ->array($score->getRuntimeExceptions())->isEmpty()1018 ->array($score->getErrors())->isEmpty()1019 ->array($score->getOutputs())->isEmpty()1020 ->array($score->getDurations())->isEmpty()1021 ->array($score->getMemoryUsages())->isEmpty()1022 ->array($score->getUncompletedMethods())->isEmpty()1023 ->array($score->getSkippedMethods())->isEmpty()1024 ->if($score->addPass())1025 ->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))1026 ->and($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))1027 ->and($score->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))1028 ->and($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1029 ->and($score->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))1030 ->and($score->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1031 ->and($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1032 ->and($score->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1033 ->and($score->addSkippedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1034 ->then...

Full Screen

Full Screen

getDurations

Using AI Code Generation

copy

Full Screen

1require_once 'score.php';2$score = new score();3$score->getDurations();4require_once 'score.php';5$score = new score();6$score->getDurations();7require_once 'score.php';8$score = new score();9$score->getDurations();10require_once 'score.php';11$score = new score();12$score->getDurations();13require_once 'score.php';14$score = new score();15$score->getDurations();16require_once 'score.php';17$score = new score();18$score->getDurations();19require_once 'score.php';20$score = new score();21$score->getDurations();22require_once 'score.php';23$score = new score();24$score->getDurations();25require_once 'score.php';26$score = new score();27$score->getDurations();28require_once 'score.php';29$score = new score();30$score->getDurations();31require_once 'score.php';32$score = new score();33$score->getDurations();34require_once 'score.php';35$score = new score();36$score->getDurations();37require_once 'score.php';38$score = new score();39$score->getDurations();

Full Screen

Full Screen

getDurations

Using AI Code Generation

copy

Full Screen

1require_once "score.php";2$score = new Score();3$score->getDurations();4require_once "score.php";5$score = new Score();6$score->getDurations();7require_once "score.php";8$score = new Score();9$score->getDurations();10require_once "score.php";11$score = new Score();12$score->getDurations();13require_once "score.php";14$score = new Score();15$score->getDurations();16require_once "score.php";17$score = new Score();18$score->getDurations();19require_once "score.php";20$score = new Score();21$score->getDurations();22require_once "score.php";23$score = new Score();24$score->getDurations();25require_once "score.php";26$score = new Score();27$score->getDurations();28require_once "score.php";29$score = new Score();30$score->getDurations();31require_once "score.php";32$score = new Score();33$score->getDurations();34require_once "score.php";35$score = new Score();36$score->getDurations();37require_once "score.php";38$score = new Score();39$score->getDurations();

Full Screen

Full Screen

getDurations

Using AI Code Generation

copy

Full Screen

1require_once("score.php");2$score = new score();3$score->getDurations();4require_once("score.php");5$score = new score();6$score->getDurations();7require_once("score.php");8$score = new score();9$score->getDurations();10require_once("score.php");11$score = new score();12$score->getDurations();13require_once("score.php");14$score = new score();15$score->getDurations();16require_once("score.php");17$score = new score();18$score->getDurations();19require_once("score.php");20$score = new score();21$score->getDurations();22require_once("score.php");23$score = new score();24$score->getDurations();25require_once("score.php");26$score = new score();27$score->getDurations();28require_once("score.php");29$score = new score();30$score->getDurations();31require_once("score.php");32$score = new score();33$score->getDurations();34require_once("score.php");35$score = new score();36$score->getDurations();37require_once("score.php");38$score = new score();39$score->getDurations();40require_once("score

Full Screen

Full Screen

getDurations

Using AI Code Generation

copy

Full Screen

1require_once('score.php');2$score = new score();3$score->getDurations();4class score{5 function getDurations(){6 $duration = 5;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in score

Trigger getDurations code on LambdaTest Cloud Grid

Execute automation tests with getDurations on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful