Best Atoum code snippet using score.addPass
score.php
Source:score.php
...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())->isEqualTo(array(246 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 array(260 'case' => null,261 'dataSetKey' => null,262 'dataSetProvider' => null,263 'class' => $class,264 'method' => $method,265 'file' => $file,266 'line' => $line,267 'type' => $type,268 'message' => $message,269 'errorFile' => $errorFile,270 'errorLine' => $errorLine271 ),272 array(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 array(286 'case' => null,287 'dataSetKey' => null,288 'dataSetProvider' => null,289 'class' => $otherClass,290 'method' => $otherMethod,291 'file' => $otherFile,292 'line' => $otherLine,293 'type' => $otherType,294 'message' => $otherMessage,295 'errorFile' => $otherErrorFile,296 'errorLine' => $otherErrorLine297 ),298 )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(array(312 array(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(array(322 array(323 'class' => $class,324 'method' => $method,325 'value' => $output326 ),327 array(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(array(337 array(338 'class' => $class,339 'method' => $method,340 'value' => $output341 ),342 array(343 'class' => $otherClass,344 'method' => $otherMethod,345 'value' => $otherOutput346 ),347 array(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(array(366 array(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(array(377 array(378 'class' => $class,379 'method' => $method,380 'value' => $duration,381 'path' => $path382 ),383 array(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(array(394 array(395 'class' => $class,396 'method' => $method,397 'value' => $duration,398 'path' => $path399 ),400 array(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(array(411 array(412 'class' => $class,413 'method' => $method,414 'value' => $duration,415 'path' => $path416 ),417 array(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(array(428 array(429 'class' => $class,430 'method' => $method,431 'value' => $duration,432 'path' => $path433 ),434 array(435 'class' => $otherClass,436 'method' => $otherMethod,437 'value' => $otherDuration,438 'path' => $otherPath439 ),440 array(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(array(459 array(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(array(468 array(469 'class' => $class,470 'method' => $method,471 'value' => $memoryUsage472 ),473 array(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(array(482 array(483 'class' => $class,484 'method' => $method,485 'value' => $memoryUsage486 ),487 array(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(array(496 array(497 'class' => $class,498 'method' => $method,499 'value' => $memoryUsage500 ),501 array(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(array(510 array(511 'class' => $class,512 'method' => $method,513 'value' => $memoryUsage514 ),515 array(516 'class' => $otherClass,517 'method' => $otherMethod,518 'value' => $otherMemoryUsage519 ),520 array(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(array(537 array(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(array(548 array(549 'file' => $file,550 'class' => $class,551 'method' => $method,552 'exitCode' => $exitCode,553 'output' => $output,554 ),555 array(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(array(574 array(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(array(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(array(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(array(656 array(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(array(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(array(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(array(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(array(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(array(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(array(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(array(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(array(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(array(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(array($class => array($classMethod)))896 ->if($score->addFail(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))897 ->then898 ->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))899 ->if($score->addFail(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))900 ->then901 ->array($score->getMethodsWithFail())->isEqualTo(array(902 $class => array($classMethod, $classOtherMethod),903 $otherClass => array($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(array($class => array($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(array($class => array($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(array(923 $class => array($classMethod, $classOtherMethod),924 $otherClass => array($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(array($class => array($classMethod)))938 ->if($score->addException(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))939 ->then940 ->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))941 ->if($score->addException(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))942 ->then943 ->array($score->getMethodsWithException())->isEqualTo(array(944 $class => array($classMethod, $classOtherMethod),945 $otherClass => array($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 ->then1035 ->object($score->merge($otherScore))->isIdenticalTo($score)1036 ->integer($score->getPassNumber())->isEqualTo(1)1037 ->integer($score->getFailNumber())->isEqualTo(1)1038 ->integer($score->getExceptionNumber())->isEqualTo(1)1039 ->integer($score->getErrorNumber())->isEqualTo(1)1040 ->integer($score->getOutputNumber())->isEqualTo(1)1041 ->integer($score->getDurationNumber())->isEqualTo(1)1042 ->integer($score->getMemoryUsageNumber())->isEqualTo(1)1043 ->integer($score->getUncompletedMethodNumber())->isEqualTo(1)1044 ->integer($score->getSkippedMethodNumber())->isEqualTo(1)1045 ->if($otherScore->addPass())1046 ->and($otherScore->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))1047 ->and($otherScore->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))1048 ->and($otherScore->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))1049 ->and($otherScore->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1050 ->and($otherScore->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))1051 ->and($otherScore->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1052 ->and($otherScore->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))1053 ->and($otherScore->addUncompletedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1054 ->and($otherScore->addSkippedMethod(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))1055 ->then1056 ->object($score->merge($otherScore))->isIdenticalTo($score)1057 ->integer($score->getPassNumber())->isEqualTo(2)1058 ->integer($score->getFailNumber())->isEqualTo(2)1059 ->integer($score->getExceptionNumber())->isEqualTo(2)...
xunit.php
Source:xunit.php
...66 ->and($score = new runner\score())67 ->and($report = new reports\xunit($adapter))68 ->and($runner->setScore($score))69 ->and($testScore = new atoum\test\score())70 ->and($testScore->addPass())71 ->and($test = new \mock\mageekguy\atoum\test())72 ->and($test->getMockController()->getCurrentMethod[1] = $method = 'method')73 ->and($test->getMockController()->getCurrentMethod[2] = $otherMethod = 'otherMethod')74 ->and($test->getMockController()->getCurrentMethod[3] = $thirdMethod = 'thirdMethod')75 ->and($test->setScore($testScore))76 ->and($path = join(77 DIRECTORY_SEPARATOR,78 array(79 __DIR__,80 'xunit',81 'resources'82 )83 ))84 ->and($testScore->addDuration(uniqid(), $class, $method, $duration = 1))85 ->and($testScore->addUncompletedMethod(uniqid(), $class, $otherMethod, $exitCode = 1, $output = 'output'))86 ->and($testScore->addSkippedMethod(uniqid(), $class, $thirdMethod, $line = rand(1, PHP_INT_MAX), $message = 'message'))87 ->and($report->handleEvent(atoum\test::afterTestMethod, $test))88 ->and($testScore->addPass())89 ->and($testScore->addPass())90 ->and($report->handleEvent(atoum\test::afterTestMethod, $test))91 ->and($report->handleEvent(atoum\test::afterTestMethod, $test))92 ->and($score->merge($testScore))93 ->and($report->handleEvent(atoum\runner::runStop, $runner))94 ->then95 ->castToString($report)->isEqualToContentsOfFile(join(DIRECTORY_SEPARATOR, array($path, '1.xml')))96 ->if($adapter->get_class = $otherClass = 'otherClass')97 ->and($test->setScore($testScore = new atoum\test\score()))98 ->and($test->getMockController()->getCurrentMethod[4] = $otherMethod)99 ->and($test->getMockController()->getCurrentMethod[5] = $thirdMethod)100 ->and($testScore->addFail(uniqid(), $otherClass, $otherMethod, 1, $asserter = 'asserter', $reason = 'reason'))101 ->and($exception = new \mock\Exception())102 ->and($exception->getMockController()->__toString = $trace = 'trace')103 ->and($testScore->addException(uniqid(), $otherClass, $thirdMethod, 1, $exception))...
addPass
Using AI Code Generation
1$score = new Score();2$score->addPass();3$score = new Score();4$score->addFail();5$score = new Score();6$score->addPass();7$score = new Score();8$score->addFail();9$score = new Score();10$score->addPass();11$score = new Score();12$score->addFail();13$score = new Score();14$score->addPass();15$score = new Score();16$score->addFail();17$score = new Score();18$score->addPass();19$score = new Score();20$score->addFail();21$score = new Score();22$score->addPass();23$score = new Score();24$score->addFail();25$score = new Score();26$score->addPass();27$score = new Score();28$score->addFail();29$score = new Score();30$score->addPass();31$score = new Score();32$score->addFail();33$score = new Score();34$score->addPass();
addPass
Using AI Code Generation
1$score = new score;2$score->addPass();3$score = new score;4$score->addFail();5$score = new score;6$score->addPass();7$score = new score;8$score->addFail();9$score = new score;10$score->addPass();11$score = new score;12$score->addFail();13$score = new score;14$score->addPass();15$score = new score;16$score->addFail();17$score = new score;18$score->addPass();19$score = new score;20$score->addFail();21$score = new score;22$score->addPass();23$score = new score;24$score->addFail();25$score = new score;26$score->addPass();27$score = new score;28$score->addFail();29$score = new score;30$score->addPass();
addPass
Using AI Code Generation
1include "score.php";2$score = new score();3$score->addPass(1);4include "score.php";5$score = new score();6$score->addPass(2);7include "score.php";8$score = new score();9$score->addPass(3);10include "score.php";11$score = new score();12$score->addPass(4);13include "score.php";14$score = new score();15$score->addPass(5);16include "score.php";17$score = new score();18$score->addPass(6);19include "score.php";20$score = new score();21$score->addPass(7);22include "score.php";23$score = new score();24$score->addPass(8);25include "score.php";26$score = new score();27$score->addPass(9);28include "score.php";29$score = new score();30$score->addPass(10);31include "score.php";32$score = new score();33$score->addPass(11);34include "score.php";35$score = new score();36$score->addPass(12);
addPass
Using AI Code Generation
1 $score = new Score();2 $score->addPass(5);3 $score->addPass(3);4 $score->addPass(7);5 $score->addPass(2);6 $score->addPass(1);7 $score->addPass(9);8 $score->addPass(10);9 $score->addPass(8);10 $score->addPass(4);11 $score->addPass(6);12 $score->addPass(11);13 $score->addPass(12);14 $score->addPass(13);15 $score->addPass(14);16 $score->addPass(15);17 $score->addPass(16);18 $score->addPass(17);19 $score->addPass(18);20 $score->addPass(19);21 $score->addPass(20);22 $score->addPass(21);23 $score->addPass(22);24 $score->addPass(23);25 $score->addPass(24);26 $score->addPass(25);27 $score->addPass(26);28 $score->addPass(27);29 $score->addPass(28);30 $score->addPass(29);31 $score->addPass(30);32 $score->addPass(31);33 $score->addPass(32);34 $score->addPass(33);35 $score->addPass(34);36 $score->addPass(35);37 $score->addPass(36);38 $score->addPass(37);39 $score->addPass(38);40 $score->addPass(39);41 $score->addPass(40);42 $score->addPass(41);43 $score->addPass(42);44 $score->addPass(43);45 $score->addPass(44);46 $score->addPass(45);47 $score->addPass(46);48 $score->addPass(47);49 $score->addPass(48);50 $score->addPass(49);51 $score->addPass(50);52 $score->addPass(51);53 $score->addPass(52);54 $score->addPass(53);55 $score->addPass(54);
addPass
Using AI Code Generation
1$score->addPass();2$score->addFail();3$score->getPasses();4$score->getFails();5$score->getScore();6$score->getPercent();7$score->getLetter();8$score->reset();9$score->getPasses();10$score->getFails();11$score->getScore();12$score->getPercent();13$score->getLetter();
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 addPass 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!!