Best Atoum code snippet using score.addException
score.php
Source:score.php
...40 {41 $this42 ->if($score = new atoum\score())43 ->then44 ->object($score->addException($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $exception = new \exception()))->isIdenticalTo($score)45 ->array($score->getExceptions())->isEqualTo(array(46 array(47 'case' => null,48 'dataSetKey' => null,49 'dataSetProvider' => null,50 'class' => $class,51 'method' => $method,52 'file' => $file,53 'line' => $line,54 'value' => (string) $exception55 )56 )57 )58 ->integer($score->getExceptionNumber())->isEqualTo(1)59 ->object($score->addException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherException = new \exception()))->isIdenticalTo($score)60 ->array($score->getExceptions())->isEqualTo(array(61 array(62 'case' => null,63 'dataSetKey' => null,64 'dataSetProvider' => null,65 'class' => $class,66 'method' => $method,67 'file' => $file,68 'line' => $line,69 'value' => (string) $exception70 ),71 array(72 'case' => null,73 'dataSetKey' => null,74 'dataSetProvider' => null,75 'class' => $otherClass,76 'method' => $otherMethod,77 'file' => $otherFile,78 'line' => $otherLine,79 'value' => (string) $otherException80 )81 )82 )83 ;84 }85 public function testAddPass()86 {87 $this88 ->if($score = new atoum\score())89 ->then90 ->object($score->addPass())->isIdenticalTo($score)91 ->integer($score->getPassNumber())->isEqualTo(1)92 ->object($score->addPass())->isIdenticalTo($score)93 ->integer($score->getPassNumber())->isEqualTo(2)94 ;95 }96 public function testAddFail()97 {98 $this99 ->if($score = new atoum\score())100 ->then101 ->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)102 ->array($score->getFailAssertions())->isEqualTo(array(103 array(104 'case' => null,105 'dataSetKey' => null,106 'dataSetProvider' => null,107 'class' => $class,108 'method' => $method,109 'file' => $file,110 'line' => $line,111 'asserter' => $asserter,112 'fail' => $reason113 )114 )115 )116 ->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)117 ->array($score->getFailAssertions())->isEqualTo(array(118 array(119 'case' => null,120 'dataSetKey' => null,121 'dataSetProvider' => null,122 'class' => $class,123 'method' => $method,124 'file' => $file,125 'line' => $line,126 'asserter' => $asserter,127 'fail' => $reason128 ),129 array(130 'case' => null,131 'dataSetKey' => null,132 'dataSetProvider' => null,133 'class' => $otherClass,134 'method' => $otherMethod,135 'file' => $otherFile,136 'line' => $otherLine,137 'asserter' => $otherAsserter,138 'fail' => $otherReason139 )140 )141 )142 ;143 }144 public function testAddError()145 {146 $this147 ->if($score = new atoum\score())148 ->then149 ->array($score->getErrors())->isEmpty()150 ->integer($score->getErrorNumber())->isZero()151 ->object($score->addError($file = 'file1', $class = 'class1', $method = 'method1', $line = 1, $type = 5, $message = 'message1', $errorFile = 'errorFile1', $errorLine = 2))->isIdenticalTo($score)152 ->array($score->getErrors())->isEqualTo(array(153 array(154 'case' => null,155 'dataSetKey' => null,156 'dataSetProvider' => null,157 'class' => $class,158 'method' => $method,159 'file' => $file,160 'line' => $line,161 'type' => $type,162 'message' => $message,163 'errorFile' => $errorFile,164 'errorLine' => $errorLine165 )166 )167 )168 ->integer($score->getErrorNumber())->isEqualTo(1)169 ->object($score->addError($otherFile = 'file2', $otherClass = 'class2', $otherMethod = 'method2', $otherLine = 10, $otherType = 15, $otherMessage = 'message2', $otherErrorFile = 'errorFile2', $otherErrorLine = 20))->isIdenticalTo($score)170 ->array($score->getErrors())->isEqualTo(array(171 array(172 'case' => null,173 'dataSetKey' => null,174 'dataSetProvider' => null,175 'class' => $class,176 'method' => $method,177 'file' => $file,178 'line' => $line,179 'type' => $type,180 'message' => $message,181 'errorFile' => $errorFile,182 'errorLine' => $errorLine183 ),184 array(185 'case' => null,186 'dataSetKey' => null,187 'dataSetProvider' => null,188 'class' => $otherClass,189 'method' => $otherMethod,190 'file' => $otherFile,191 'line' => $otherLine,192 'type' => $otherType,193 'message' => $otherMessage,194 'errorFile' => $otherErrorFile,195 'errorLine' => $otherErrorLine196 )197 )198 )199 ->integer($score->getErrorNumber())->isEqualTo(2)200 ->object($score->addError($file, $class, $method, $line, $type, $anAnotherMessage = 'message1.1', $errorFile, $errorLine))->isIdenticalTo($score)201 ->array($score->getErrors())->isEqualTo(array(202 array(203 'case' => null,204 'dataSetKey' => null,205 'dataSetProvider' => null,206 'class' => $class,207 'method' => $method,208 'file' => $file,209 'line' => $line,210 'type' => $type,211 'message' => $message,212 'errorFile' => $errorFile,213 'errorLine' => $errorLine214 ),215 array(216 'case' => null,217 'dataSetKey' => null,218 'dataSetProvider' => null,219 'class' => $class,220 'method' => $method,221 'file' => $file,222 'line' => $line,223 'type' => $type,224 'message' => $anAnotherMessage,225 'errorFile' => $errorFile,226 'errorLine' => $errorLine227 ),228 array(229 'case' => null,230 'dataSetKey' => null,231 'dataSetProvider' => null,232 'class' => $otherClass,233 'method' => $otherMethod,234 'file' => $otherFile,235 'line' => $otherLine,236 'type' => $otherType,237 'message' => $otherMessage,238 'errorFile' => $otherErrorFile,239 'errorLine' => $otherErrorLine240 )241 )242 )243 ->integer($score->getErrorNumber())->isEqualTo(3)244 ->object($score->addError($file, $class, $method, $line + 1, $type, (" \t \t" . $messageWithWhitespace = 'message with withespace' . " \t " . PHP_EOL), $errorFile, $errorLine))->isIdenticalTo($score)245 ->array($score->getErrors())246 ->contains(array(247 'case' => null,248 'dataSetKey' => null,249 'dataSetProvider' => null,250 'class' => $class,251 'method' => $method,252 'file' => $file,253 'line' => $line,254 'type' => $type,255 'message' => $anAnotherMessage,256 'errorFile' => $errorFile,257 'errorLine' => $errorLine258 )259 )260 ->contains(array(261 'case' => null,262 'dataSetKey' => null,263 'dataSetProvider' => null,264 'class' => $class,265 'method' => $method,266 'file' => $file,267 'line' => $line,268 'type' => $type,269 'message' => $message,270 'errorFile' => $errorFile,271 'errorLine' => $errorLine272 )273 )274 ->contains(array(275 'case' => null,276 'dataSetKey' => null,277 'dataSetProvider' => null,278 'class' => $class,279 'method' => $method,280 'file' => $file,281 'line' => $line + 1,282 'type' => $type,283 'message' => trim($messageWithWhitespace),284 'errorFile' => $errorFile,285 'errorLine' => $errorLine286 )287 )288 ->contains(array(289 'case' => null,290 'dataSetKey' => null,291 'dataSetProvider' => null,292 'class' => $otherClass,293 'method' => $otherMethod,294 'file' => $otherFile,295 'line' => $otherLine,296 'type' => $otherType,297 'message' => $otherMessage,298 'errorFile' => $otherErrorFile,299 'errorLine' => $otherErrorLine300 )301 )302 ->integer($score->getErrorNumber())->isEqualTo(4)303 ;304 }305 public function testAddOutput()306 {307 $this308 ->if($score = new atoum\score())309 ->then310 ->array($score->getOutputs())->isEmpty()311 ->integer($score->getOutputNumber())->isZero()312 ->object($score->addOutput($file = uniqid(), $class = uniqid(), $method = uniqid(), $output = uniqid()))->isIdenticalTo($score)313 ->array($score->getOutputs())->isEqualTo(array(314 array(315 'class' => $class,316 'method' => $method,317 'value' => $output318 )319 )320 )321 ->integer($score->getOutputNumber())->isEqualTo(1)322 ->object($score->addOutput($file = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherOutput = uniqid()))->isIdenticalTo($score)323 ->array($score->getOutputs())->isEqualTo(array(324 array(325 'class' => $class,326 'method' => $method,327 'value' => $output328 ),329 array(330 'class' => $otherClass,331 'method' => $otherMethod,332 'value' => $otherOutput333 )334 )335 )336 ->integer($score->getOutputNumber())->isEqualTo(2)337 ->object($score->addOutput($file = uniqid(), $class, $method, $moreOutput = uniqid()))->isIdenticalTo($score)338 ->array($score->getOutputs())->isEqualTo(array(339 array(340 'class' => $class,341 'method' => $method,342 'value' => $output343 ),344 array(345 'class' => $otherClass,346 'method' => $otherMethod,347 'value' => $otherOutput348 ),349 array(350 'class' => $class,351 'method' => $method,352 'value' => $moreOutput353 )354 )355 )356 ->integer($score->getOutputNumber())->isEqualTo(3)357 ;358 }359 public function testAddDuration()360 {361 $this362 ->if($score = new atoum\score())363 ->then364 ->array($score->getDurations())->isEmpty()365 ->integer($score->getDurationNumber())->isZero()366 ->object($score->addDuration($path = uniqid(), $class = uniqid(), $method = uniqid(), $duration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)367 ->array($score->getDurations())->isEqualTo(array(368 array(369 'class' => $class,370 'method' => $method,371 'value' => $duration,372 'path' => $path373 )374 )375 )376 ->integer($score->getDurationNumber())->isEqualTo(1)377 ->object($score->addDuration($otherPath = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)378 ->array($score->getDurations())->isEqualTo(array(379 array(380 'class' => $class,381 'method' => $method,382 'value' => $duration,383 'path' => $path384 ),385 array(386 'class' => $otherClass,387 'method' => $otherMethod,388 'value' => $otherDuration,389 'path' => $otherPath390 )391 )392 )393 ->integer($score->getDurationNumber())->isEqualTo(2)394 ->object($score->addDuration(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)395 ->array($score->getDurations())->isEqualTo(array(396 array(397 'class' => $class,398 'method' => $method,399 'value' => $duration,400 'path' => $path401 ),402 array(403 'class' => $otherClass,404 'method' => $otherMethod,405 'value' => $otherDuration,406 'path' => $otherPath407 )408 )409 )410 ->integer($score->getDurationNumber())->isEqualTo(2)411 ->object($score->addDuration(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)412 ->array($score->getDurations())->isEqualTo(array(413 array(414 'class' => $class,415 'method' => $method,416 'value' => $duration,417 'path' => $path418 ),419 array(420 'class' => $otherClass,421 'method' => $otherMethod,422 'value' => $otherDuration,423 'path' => $otherPath424 )425 )426 )427 ->integer($score->getDurationNumber())->isEqualTo(2)428 ->object($score->addDuration($path, $class, $method, $moreDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)429 ->array($score->getDurations())->isEqualTo(array(430 array(431 'class' => $class,432 'method' => $method,433 'value' => $duration,434 'path' => $path435 ),436 array(437 'class' => $otherClass,438 'method' => $otherMethod,439 'value' => $otherDuration,440 'path' => $otherPath441 ),442 array(443 'class' => $class,444 'method' => $method,445 'value' => $moreDuration,446 'path' => $path447 )448 )449 )450 ->integer($score->getDurationNumber())->isEqualTo(3)451 ;452 }453 public function testAddMemoryUsage()454 {455 $this456 ->if($score = new atoum\score())457 ->then458 ->array($score->getMemoryUsages())->isEmpty()459 ->object($score->addMemoryUsage($file = uniqid(), $class = uniqid(), $method = uniqid(), $memoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)460 ->array($score->getMemoryUsages())->isEqualTo(array(461 array(462 'class' => $class,463 'method' => $method,464 'value' => $memoryUsage465 )466 )467 )468 ->object($score->addMemoryUsage($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)469 ->array($score->getMemoryUsages())->isEqualTo(array(470 array(471 'class' => $class,472 'method' => $method,473 'value' => $memoryUsage474 ),475 array(476 'class' => $otherClass,477 'method' => $otherMethod,478 'value' => $otherMemoryUsage479 )480 )481 )482 ->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)483 ->array($score->getMemoryUsages())->isEqualTo(array(484 array(485 'class' => $class,486 'method' => $method,487 'value' => $memoryUsage488 ),489 array(490 'class' => $otherClass,491 'method' => $otherMethod,492 'value' => $otherMemoryUsage493 )494 )495 )496 ->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)497 ->array($score->getMemoryUsages())->isEqualTo(array(498 array(499 'class' => $class,500 'method' => $method,501 'value' => $memoryUsage502 ),503 array(504 'class' => $otherClass,505 'method' => $otherMethod,506 'value' => $otherMemoryUsage507 )508 )509 )510 ->object($score->addMemoryUsage($file, $class, $method, $moreMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)511 ->array($score->getMemoryUsages())->isEqualTo(array(512 array(513 'class' => $class,514 'method' => $method,515 'value' => $memoryUsage516 ),517 array(518 'class' => $otherClass,519 'method' => $otherMethod,520 'value' => $otherMemoryUsage521 ),522 array(523 'class' => $class,524 'method' => $method,525 'value' => $moreMemoryUsage526 )527 )528 )529 ;530 }531 public function testAddUncompletedMethod()532 {533 $this534 ->if($score = new atoum\score())535 ->then536 ->array($score->getUncompletedMethods())->isEmpty()537 ->object($score->addUncompletedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))->isIdenticalTo($score)538 ->array($score->getUncompletedMethods())->isEqualTo(array(539 array(540 'file' => $file,541 'class' => $class,542 'method' => $method,543 'exitCode' => $exitCode,544 'output' => $output,545 )546 )547 )548 ->object($score->addUncompletedMethod($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))->isIdenticalTo($score)549 ->array($score->getUncompletedMethods())->isEqualTo(array(550 array(551 'file' => $file,552 'class' => $class,553 'method' => $method,554 'exitCode' => $exitCode,555 'output' => $output,556 ),557 array(558 'file' => $otherFile,559 'class' => $otherClass,560 'method' => $otherMethod,561 'exitCode' => $otherExitCode,562 'output' => $otherOutput,563 )564 )565 )566 ;567 }568 public function testAddSkippedMethod()569 {570 $this571 ->if($score = new atoum\score())572 ->then573 ->array($score->getSkippedMethods())->isEmpty()574 ->object($score->addSkippedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $message = uniqid()))->isIdenticalTo($score)575 ->array($score->getSkippedMethods())->isEqualTo(array(576 array(577 'file' => $file,578 'class' => $class,579 'method' => $method,580 'line' => $line,581 'message' => $message582 )583 )584 )585 ;586 }587 public function testAddRuntimeException()588 {589 $this590 ->if($score = new atoum\score())591 ->then592 ->array($score->getRuntimeExceptions())->isEmpty()593 ->integer($score->getRuntimeExceptionNumber())->isZero()594 ->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $exception = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)595 ->array($score->getRuntimeExceptions())->isEqualTo(array(596 $exception597 )598 )599 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(1)600 ->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $otherException = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)601 ->array($score->getRuntimeExceptions())->isEqualTo(array(602 $exception,603 $otherException604 )605 )606 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)607 ;608 }609 public function testSetCoverage()610 {611 $this612 ->if($score = new atoum\score())613 ->then614 ->object($score->setCoverage($coverage = new atoum\score\coverage()))->isIdenticalTo($score)615 ->object($score->getCoverage())->isIdenticalTo($coverage)616 ;617 }618 public function testGetExceptionNumber()619 {620 $this621 ->if($score = new atoum\score())622 ->then623 ->integer($score->getExceptionNumber())->isZero()624 ->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))625 ->then626 ->integer($score->getExceptionNumber())->isEqualTo(1)627 ->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))628 ->then629 ->integer($score->getExceptionNumber())->isEqualTo(2)630 ;631 }632 public function testGetFailNumber()633 {634 $this635 ->if($score = new atoum\score())636 ->then637 ->integer($score->getFailNumber())->isZero()638 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))639 ->then640 ->integer($score->getFailNumber())->isEqualTo(1)641 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))642 ->then643 ->integer($score->getFailNumber())->isEqualTo(2)644 ;645 }646 public function testGetFailAssertions()647 {648 $this649 ->if($score = new atoum\score())650 ->then651 ->array($score->getFailAssertions())->isEmpty()652 ->if($score->addPass())653 ->then654 ->array($score->getFailAssertions())->isEmpty()655 ->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()))656 ->then657 ->array($score->getFailAssertions())->isEqualTo(array(658 array(659 'case' => null,660 'dataSetKey' => null,661 'dataSetProvider' => null,662 'class' => $class,663 'method' => $method,664 'file' => $file,665 'line' => $line,666 'asserter' => $asserter,667 'fail' => $reason668 )669 )670 )671 ;672 }673 public function testGetLastFailAssertion()674 {675 $this676 ->if($score = new atoum\score())677 ->then678 ->variable($score->getLastFailAssertion())->isNull()679 ->if($score->addPass())680 ->then681 ->variable($score->getLastFailAssertion())->isNull()682 ->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()))683 ->then684 ->array($score->getLastFailAssertion())->isEqualTo(array(685 'case' => null,686 'dataSetKey' => null,687 'dataSetProvider' => null,688 'class' => $class,689 'method' => $method,690 'file' => $file,691 'line' => $line,692 'asserter' => $asserter,693 'fail' => $reason694 )695 )696 ;697 }698 public function testGetLastVoidMethod()699 {700 $this701 ->if($score = new atoum\score())702 ->then703 ->variable($score->getLastVoidMethod())->isNull()704 ->if($score->addPass())705 ->then706 ->variable($score->getLastVoidMethod())->isNull()707 ->if($score->addVoidMethod($file = uniqid(), $class = uniqid(), $method = uniqid()))708 ->then709 ->array($score->getLastVoidMethod())->isEqualTo(array(710 'file' => $file,711 'class' => $class,712 'method' => $method713 )714 )715 ;716 }717 public function testGetLastSkippedMethod()718 {719 $this720 ->if($score = new atoum\score())721 ->then722 ->variable($score->getLastSkippedMethod())->isNull()723 ->if($score->addPass())724 ->then725 ->variable($score->getLastSkippedMethod())->isNull()726 ->if($score->addSkippedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $message = uniqid()))727 ->then728 ->array($score->getLastSkippedMethod())->isEqualTo(array(729 'file' => $file,730 'class' => $class,731 'method' => $method,732 'line' => $line,733 'message' => $message734 )735 )736 ;737 }738 public function testGetLastErroredMethod()739 {740 $this741 ->if($score = new atoum\score())742 ->then743 ->variable($score->getLastErroredMethod())->isNull()744 ->if($score->addPass())745 ->then746 ->variable($score->getLastErroredMethod())->isNull()747 ->if($score->addError($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $type = rand(E_ERROR, E_USER_DEPRECATED), $message = uniqid()))748 ->then749 ->array($score->getLastErroredMethod())->isEqualTo(array(750 'case' => null,751 'dataSetKey' => null,752 'dataSetProvider' => null,753 'class' => $class,754 'method' => $method,755 'file' => $file,756 'line' => $line,757 'type' => $type,758 'message' => trim($message),759 'errorFile' => null,760 'errorLine' => null761 )762 )763 ->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()))764 ->then765 ->array($score->getLastErroredMethod())->isEqualTo(array(766 'case' => $case,767 'dataSetKey' => $dataSetKey,768 'dataSetProvider' => $dataSetProvider,769 'class' => $class,770 'method' => $method,771 'file' => $file,772 'line' => $line,773 'type' => $type,774 'message' => trim($message),775 'errorFile' => $errorFile,776 'errorLine' => $errorLine777 )778 )779 ;780 }781 public function testGetLastException()782 {783 $this784 ->if($score = new atoum\score())785 ->then786 ->variable($score->getLastException())->isNull()787 ->if($score->addPass())788 ->then789 ->variable($score->getLastException())->isNull()790 ->if($score->addException($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $exception = new \exception()))791 ->then792 ->array($score->getLastException())->isEqualTo(array(793 'case' => null,794 'dataSetKey' => null,795 'dataSetProvider' => null,796 'class' => $class,797 'method' => $method,798 'file' => $file,799 'line' => $line,800 'value' => (string) $exception801 )802 )803 ->if($score->addException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine = rand(1, PHP_INT_MAX), $otherException = new \exception(), $case = uniqid(), $dataSetKey = uniqid(), $dataSetProvider = uniqid()))804 ->then805 ->array($score->getLastException())->isEqualTo(array(806 'case' => $case,807 'dataSetKey' => $dataSetKey,808 'dataSetProvider' => $dataSetProvider,809 'class' => $otherClass,810 'method' => $otherMethod,811 'file' => $otherFile,812 'line' => $otherLine,813 'value' => (string) $otherException814 )815 )816 ;817 }818 public function testGetLastUncompleteMethod()819 {820 $this821 ->if($score = new atoum\score())822 ->then823 ->variable($score->getLastUncompleteMethod())->isNull()824 ->if($score->addPass())825 ->then826 ->variable($score->getLastUncompleteMethod())->isNull()827 ->if($score->addUncompletedMethod($file = uniqid(), $class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))828 ->then829 ->array($score->getLastUncompleteMethod())->isEqualTo(array(830 'file' => $file,831 'class' => $class,832 'method' => $method,833 'exitCode' => $exitCode,834 'output' => $output,835 )836 )837 ->if($score->addUncompletedMethod($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))838 ->then839 ->array($score->getLastUncompleteMethod())->isEqualTo(array(840 'file' => $otherFile,841 'class' => $otherClass,842 'method' => $otherMethod,843 'exitCode' => $otherExitCode,844 'output' => $otherOutput,845 )846 )847 ;848 }849 public function testGetLastRuntimeException()850 {851 $this852 ->if($score = new atoum\score())853 ->then854 ->variable($score->getLastRuntimeException())->isNull()855 ->if($score->addPass())856 ->then857 ->variable($score->getLastRuntimeException())->isNull()858 ->if($score->addRuntimeException($file = uniqid(), $class = uniqid(), $method = uniqid(), $exception = new exceptions\runtime()))859 ->then860 ->object($score->getLastRuntimeException())->isIdenticalTo($exception)861 ->if($score->addRuntimeException($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherException = new exceptions\runtime()))862 ->then863 ->object($score->getLastRuntimeException())->isIdenticalTo($otherException)864 ;865 }866 public function testGetPassAssertions()867 {868 $this869 ->if($score = new atoum\score())870 ->then871 ->integer($score->getPassNumber())->isZero()872 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))873 ->then874 ->integer($score->getPassNumber())->isZero()875 ->if($score->addPass())876 ->then877 ->integer($score->getPassNumber())->isEqualTo(1)878 ;879 }880 public function testGetCoverage()881 {882 $this883 ->if($score = new atoum\score())884 ->then885 ->object($coverage = $score->getCoverage())->isInstanceOf('mageekguy\atoum\score\coverage')886 ;887 }888 public function testGetMethodsWithFail()889 {890 $this891 ->if($score = new atoum\score())892 ->then893 ->array($score->getMethodsWithFail())->isEmpty()894 ->if($asserter = new atoum\asserters\integer(new atoum\asserter\generator()))895 ->and($score->addFail(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))896 ->then897 ->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod)))898 ->if($score->addFail(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))899 ->then900 ->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))901 ->if($score->addFail(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))902 ->then903 ->array($score->getMethodsWithFail())->isEqualTo(array(904 $class => array($classMethod, $classOtherMethod),905 $otherClass => array($otherClassMethod)906 )907 )908 ;909 }910 public function testGetMethodsWithError()911 {912 $this913 ->if($score = new atoum\score())914 ->then915 ->array($score->getMethodsWithError())->isEmpty()916 ->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)))917 ->then918 ->array($score->getMethodsWithError())->isEqualTo(array($class => array($classMethod)))919 ->if($score->addError(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))920 ->then921 ->array($score->getMethodsWithError())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))922 ->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)))923 ->then924 ->array($score->getMethodsWithError())->isEqualTo(array(925 $class => array($classMethod, $classOtherMethod),926 $otherClass => array($otherClassMethod)927 )928 )929 ;930 }931 public function testGetMethodsWithException()932 {933 $this934 ->if($score = new atoum\score())935 ->then936 ->array($score->getMethodsWithError())->isEmpty()937 ->if($score->addException(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))938 ->then939 ->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod)))940 ->if($score->addException(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))941 ->then942 ->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))943 ->if($score->addException(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))944 ->then945 ->array($score->getMethodsWithException())->isEqualTo(array(946 $class => array($classMethod, $classOtherMethod),947 $otherClass => array($otherClassMethod)948 )949 )950 ;951 }952 public function testReset()953 {954 $this955 ->if($score = new atoum\score())956 ->then957 ->integer($score->getPassNumber())->isZero()958 ->array($score->getFailAssertions())->isEmpty()959 ->array($score->getExceptions())->isEmpty()960 ->array($score->getRuntimeExceptions())->isEmpty()961 ->array($score->getErrors())->isEmpty()962 ->array($score->getOutputs())->isEmpty()963 ->array($score->getDurations())->isEmpty()964 ->array($score->getMemoryUsages())->isEmpty()965 ->array($score->getUncompletedMethods())->isEmpty()966 ->object($score->reset())->isIdenticalTo($score)967 ->integer($score->getPassNumber())->isZero()968 ->array($score->getFailAssertions())->isEmpty()969 ->array($score->getExceptions())->isEmpty()970 ->array($score->getRuntimeExceptions())->isEmpty()971 ->array($score->getErrors())->isEmpty()972 ->array($score->getOutputs())->isEmpty()973 ->array($score->getDurations())->isEmpty()974 ->array($score->getMemoryUsages())->isEmpty()975 ->array($score->getUncompletedMethods())->isEmpty()976 ->if($score977 ->addPass()978 ->addException(uniqid(), rand(1, PHP_INT_MAX), uniqid(), uniqid(), new \exception())979 ->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime())980 ->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX))981 ->addOutput(uniqid(), uniqid(), uniqid(), uniqid())982 ->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))983 ->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))984 ->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid())985 )986 ->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))987 ->then988 ->integer($score->getPassNumber())->isGreaterThan(0)989 ->array($score->getFailAssertions())->isNotEmpty()990 ->array($score->getExceptions())->isNotEmpty()991 ->array($score->getRuntimeExceptions())->isNotEmpty()992 ->array($score->getErrors())->isNotEmpty()993 ->array($score->getOutputs())->isNotEmpty()994 ->array($score->getDurations())->isNotEmpty()995 ->array($score->getMemoryUsages())->isNotEmpty()996 ->array($score->getUncompletedMethods())->isNotEmpty()997 ->object($score->reset())->isIdenticalTo($score)998 ->integer($score->getPassNumber())->isZero()999 ->array($score->getFailAssertions())->isEmpty()1000 ->array($score->getExceptions())->isEmpty()1001 ->array($score->getRuntimeExceptions())->isEmpty()1002 ->array($score->getErrors())->isEmpty()1003 ->array($score->getOutputs())->isEmpty()1004 ->array($score->getDurations())->isEmpty()1005 ->array($score->getMemoryUsages())->isEmpty()1006 ->array($score->getUncompletedMethods())->isEmpty()1007 ;1008 }1009 public function testMerge()1010 {1011 $this1012 ->if($score = new atoum\score())1013 ->and($otherScore = new atoum\score())1014 ->then1015 ->object($score->merge($otherScore))->isIdenticalTo($score)1016 ->integer($score->getPassNumber())->isZero()1017 ->array($score->getFailAssertions())->isEmpty()1018 ->array($score->getExceptions())->isEmpty()1019 ->array($score->getRuntimeExceptions())->isEmpty()1020 ->array($score->getErrors())->isEmpty()1021 ->array($score->getOutputs())->isEmpty()1022 ->array($score->getDurations())->isEmpty()1023 ->array($score->getMemoryUsages())->isEmpty()1024 ->array($score->getUncompletedMethods())->isEmpty()1025 ->array($score->getSkippedMethods())->isEmpty()1026 ->if($score->addPass())1027 ->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))1028 ->and($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))1029 ->and($score->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))1030 ->and($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1031 ->and($score->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))1032 ->and($score->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1033 ->and($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1034 ->and($score->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1035 ->and($score->addSkippedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1036 ->then1037 ->object($score->merge($otherScore))->isIdenticalTo($score)1038 ->integer($score->getPassNumber())->isEqualTo(1)1039 ->integer($score->getFailNumber())->isEqualTo(1)1040 ->integer($score->getExceptionNumber())->isEqualTo(1)1041 ->integer($score->getErrorNumber())->isEqualTo(1)1042 ->integer($score->getOutputNumber())->isEqualTo(1)1043 ->integer($score->getDurationNumber())->isEqualTo(1)1044 ->integer($score->getMemoryUsageNumber())->isEqualTo(1)1045 ->integer($score->getUncompletedMethodNumber())->isEqualTo(1)1046 ->integer($score->getSkippedMethodNumber())->isEqualTo(1)1047 ->if($otherScore->addPass())1048 ->and($otherScore->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))1049 ->and($otherScore->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))1050 ->and($otherScore->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))1051 ->and($otherScore->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1052 ->and($otherScore->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))1053 ->and($otherScore->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1054 ->and($otherScore->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1055 ->and($otherScore->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1056 ->and($otherScore->addSkippedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1057 ->then1058 ->object($score->merge($otherScore))->isIdenticalTo($score)1059 ->integer($score->getPassNumber())->isEqualTo(2)1060 ->integer($score->getFailNumber())->isEqualTo(2)1061 ->integer($score->getExceptionNumber())->isEqualTo(2)1062 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)1063 ->integer($score->getErrorNumber())->isEqualTo(2)...
addException
Using AI Code Generation
1$score = new Score();2$score->addException(10);3$score = new Score();4$score->addException(5);5$score = new Score();6$score->addException(3);7$score = new Score();8$score->addException(1);9$score = new Score();10$score->addException(0);11$score = new Score();12$score->addException(0);13$score = new Score();14$score->addException(0);15$score = new Score();16$score->addException(0);17$score = new Score();18$score->addException(0);19$score = new Score();20$score->addException(0);21$score = new Score();22$score->addException(0);23$score = new Score();24$score->addException(0);25$score = new Score();26$score->addException(0);27$score = new Score();28$score->addException(0);29$score = new Score();30$score->addException(0);31$score = new Score();32$score->addException(0);
addException
Using AI Code Generation
1require_once("score.php");2$score= new score();3$score->addException(1,2);4$score->addException(1,3);5$score->addException(1,4);6$score->addException(1,5);7require_once("score.php");8$score= new score();9$score->addException(2,2);10$score->addException(2,3);11$score->addException(2,4);12$score->addException(2,5);13require_once("score.php");14$score= new score();15$score->addException(3,2);16$score->addException(3,3);17$score->addException(3,4);18$score->addException(3,5);19require_once("score.php");20$score= new score();21$score->addException(4,2);22$score->addException(4,3);23$score->addException(4,4);24$score->addException(4,5);25require_once("score.php");26$score= new score();27$score->addException(5,2);28$score->addException(5,3);29$score->addException(5,4);30$score->addException(5,5);31require_once("score.php");32$score= new score();33$score->addException(6,2);34$score->addException(6,3);35$score->addException(6,4);36$score->addException(6,5);37require_once("score.php");38$score= new score();39$score->addException(7,2);40$score->addException(7,3);41$score->addException(7,4);42$score->addException(7,5);43require_once("score.php");
addException
Using AI Code Generation
1$score = new Score();2$score->addException(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);3$score = new Score();4echo $score->getScore();5$score = new Score();6echo $score->getScore();7$score = new Score();8echo $score->getScore();9$score = new Score();10echo $score->getScore();11$score = new Score();12echo $score->getScore();13$score = new Score();14echo $score->getScore();15$score = new Score();16echo $score->getScore();17$score = new Score();18echo $score->getScore();19$score = new Score();20echo $score->getScore();21$score = new Score();22echo $score->getScore();23$score = new Score();24echo $score->getScore();25$score = new Score();26echo $score->getScore();27$score = new Score();28echo $score->getScore();29$score = new Score();30echo $score->getScore();
addException
Using AI Code Generation
1require_once 'score.php';2$score = new Score();3$score->addException('1.php', 2, 4);4require_once 'score.php';5$score = new Score();6$score->getException('1.php');7require_once 'score.php';8$score = new Score();9$score->getException('2.php');10require_once 'score.php';11$score = new Score();12$score->getException('3.php');13require_once 'score.php';14$score = new Score();15$score->getException('4.php');16require_once 'score.php';17$score = new Score();18$score->getException('5.php');19require_once 'score.php';20$score = new Score();21$score->getException('6.php');22require_once 'score.php';23$score = new Score();24$score->getException('7.php');25require_once 'score.php';26$score = new Score();27$score->getException('8.php');28require_once 'score.php';29$score = new Score();30$score->getException('9.php');31require_once 'score.php';32$score = new Score();33$score->getException('10.php');34require_once 'score.php';35$score = new Score();36$score->getException('11.php');37require_once 'score.php';38$score = new Score();39$score->getException('12.php');
addException
Using AI Code Generation
1require_once 'score.php';2$score = new Score();3$score->addException('1.php', 2, 4, 'error message');4require_once 'score.php';5$score = new Score();6$exceptions = $score->getException('1.php');7print_r($exceptions);8require_once 'score.php';9$score = new Score();10$exceptions = $score->getException('1.php');11print_r($exceptions);12require_once 'score.php';13$score = new Score();14$exceptions = $score->getException('1.php');15print_r($exceptions);16require_once 'score.php';17$score = new Score();18$exceptions = $score->getException('1.php');19print_r($exceptions);20require_once 'score.php';21$score = new Score();22$exceptions = $score->getException('1.php');23print_r($exceptions);24require_once 'score.php';25$score = new Score();26$exceptions = $score->getException('1.php');27print_r($exceptions);28require_once 'score.php';29$score = new Score();30$exceptions = $score->getException('1.php');31print_r($exceptions);32require_once 'score.php';33$score = new Score();34$exceptions = $score->getException('1.php');35print_r($exceptions);36require_once 'score.php';37$score = new Score();38$exceptions = $score->getException('1.php');39print_r($exceptions);
addException
Using AI Code Generation
1include('score.php');2$score = new score();3$score->addException(1,1,1,'2015-08-30');4include('score.php');5$score = new score();6$exceptionDates = $score->getExceptionDates(1,1,1);7print_r($exceptionDates);8include('score.php');9$score = new score();10$exceptionCourses = $score->getExceptionCourses(1,1);11print_r($exceptionCourses);12include('score.php');13$score = new score();14$exceptionQuizzes = $score->getExceptionQuizzes(1,1,1);15print_r($exceptionQuizzes);16include('score.php');17$score = new score();18$exceptionUsers = $score->getExceptionUsers(1,1,1);19print_r($exceptionUsers);20include('score.php');21$score = new score();22$exceptionUser = $score->getExceptionUser(1,1,1,
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with addException on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!