Best Atoum code snippet using score.addFail
score.php
Source:score.php
...96 {97 $this98 ->if($score = new atoum\score())99 ->then100 ->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)101 ->array($score->getFailAssertions())->isEqualTo(array(102 array(103 'case' => null,104 'dataSetKey' => null,105 'dataSetProvider' => null,106 'class' => $class,107 'method' => $method,108 'file' => $file,109 'line' => $line,110 'asserter' => $asserter,111 'fail' => $reason112 )113 )114 )115 ->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)116 ->array($score->getFailAssertions())->isEqualTo(array(117 array(118 'case' => null,119 'dataSetKey' => null,120 'dataSetProvider' => null,121 'class' => $class,122 'method' => $method,123 'file' => $file,124 'line' => $line,125 'asserter' => $asserter,126 'fail' => $reason127 ),128 array(129 'case' => null,130 'dataSetKey' => null,131 'dataSetProvider' => null,132 'class' => $otherClass,133 'method' => $otherMethod,134 'file' => $otherFile,135 'line' => $otherLine,136 'asserter' => $otherAsserter,137 'fail' => $otherReason138 )139 )140 )141 ;142 }143 public function testAddError()144 {145 $this146 ->if($score = new atoum\score())147 ->then148 ->array($score->getErrors())->isEmpty()149 ->integer($score->getErrorNumber())->isZero()150 ->object($score->addError($file = uniqid(), $class = uniqid(), $method = uniqid(), $line = rand(1, PHP_INT_MAX), $type = rand(1, PHP_INT_MAX), $message = uniqid(), $errorFile = uniqid(), $errorLine = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)151 ->array($score->getErrors())->isEqualTo(array(152 array(153 'case' => null,154 'dataSetKey' => null,155 'dataSetProvider' => null,156 'class' => $class,157 'method' => $method,158 'file' => $file,159 'line' => $line,160 'type' => $type,161 'message' => $message,162 'errorFile' => $errorFile,163 'errorLine' => $errorLine164 )165 )166 )167 ->integer($score->getErrorNumber())->isEqualTo(1)168 ->object($score->addError($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherLine= rand(1, PHP_INT_MAX), $otherType = rand(1, PHP_INT_MAX), $otherMessage = uniqid(), $otherErrorFile = uniqid(), $otherErrorLine = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)169 ->array($score->getErrors())->isEqualTo(array(170 array(171 'case' => null,172 'dataSetKey' => null,173 'dataSetProvider' => null,174 'class' => $class,175 'method' => $method,176 'file' => $file,177 'line' => $line,178 'type' => $type,179 'message' => $message,180 'errorFile' => $errorFile,181 'errorLine' => $errorLine182 ),183 array(184 'case' => null,185 'dataSetKey' => null,186 'dataSetProvider' => null,187 'class' => $otherClass,188 'method' => $otherMethod,189 'file' => $otherFile,190 'line' => $otherLine,191 'type' => $otherType,192 'message' => $otherMessage,193 'errorFile' => $otherErrorFile,194 'errorLine' => $otherErrorLine195 )196 )197 )198 ->integer($score->getErrorNumber())->isEqualTo(2)199 ->object($score->addError($file, $class, $method, $line, $type, $anAnotherMessage = uniqid(), $errorFile, $errorLine))->isIdenticalTo($score)200 ->array($score->getErrors())->isEqualTo(array(201 array(202 'case' => null,203 'dataSetKey' => null,204 'dataSetProvider' => null,205 'class' => $class,206 'method' => $method,207 'file' => $file,208 'line' => $line,209 'type' => $type,210 'message' => $message,211 'errorFile' => $errorFile,212 'errorLine' => $errorLine213 ),214 array(215 'case' => null,216 'dataSetKey' => null,217 'dataSetProvider' => null,218 'class' => $class,219 'method' => $method,220 'file' => $file,221 'line' => $line,222 'type' => $type,223 'message' => $anAnotherMessage,224 'errorFile' => $errorFile,225 'errorLine' => $errorLine226 ),227 array(228 'case' => null,229 'dataSetKey' => null,230 'dataSetProvider' => null,231 'class' => $otherClass,232 'method' => $otherMethod,233 'file' => $otherFile,234 'line' => $otherLine,235 'type' => $otherType,236 'message' => $otherMessage,237 'errorFile' => $otherErrorFile,238 'errorLine' => $otherErrorLine239 )240 )241 )242 ->integer($score->getErrorNumber())->isEqualTo(3)243 ;244 }245 public function testAddOutput()246 {247 $this248 ->if($score = new atoum\score())249 ->then250 ->array($score->getOutputs())->isEmpty()251 ->integer($score->getOutputNumber())->isZero()252 ->object($score->addOutput($file = uniqid(), $class = uniqid(), $method = uniqid(), $output = uniqid()))->isIdenticalTo($score)253 ->array($score->getOutputs())->isEqualTo(array(254 array(255 'class' => $class,256 'method' => $method,257 'value' => $output258 )259 )260 )261 ->integer($score->getOutputNumber())->isEqualTo(1)262 ->object($score->addOutput($file = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherOutput = uniqid()))->isIdenticalTo($score)263 ->array($score->getOutputs())->isEqualTo(array(264 array(265 'class' => $class,266 'method' => $method,267 'value' => $output268 ),269 array(270 'class' => $otherClass,271 'method' => $otherMethod,272 'value' => $otherOutput273 )274 )275 )276 ->integer($score->getOutputNumber())->isEqualTo(2)277 ->object($score->addOutput($file = uniqid(), $class, $method, $moreOutput = uniqid()))->isIdenticalTo($score)278 ->array($score->getOutputs())->isEqualTo(array(279 array(280 'class' => $class,281 'method' => $method,282 'value' => $output283 ),284 array(285 'class' => $otherClass,286 'method' => $otherMethod,287 'value' => $otherOutput288 ),289 array(290 'class' => $class,291 'method' => $method,292 'value' => $moreOutput293 )294 )295 )296 ->integer($score->getOutputNumber())->isEqualTo(3)297 ;298 }299 public function testAddDuration()300 {301 $this302 ->if($score = new atoum\score())303 ->then304 ->array($score->getDurations())->isEmpty()305 ->integer($score->getDurationNumber())->isZero()306 ->object($score->addDuration($path = uniqid(), $class = uniqid(), $method = uniqid(), $duration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)307 ->array($score->getDurations())->isEqualTo(array(308 array(309 'class' => $class,310 'method' => $method,311 'value' => $duration,312 'path' => $path313 )314 )315 )316 ->integer($score->getDurationNumber())->isEqualTo(1)317 ->object($score->addDuration($otherPath = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)318 ->array($score->getDurations())->isEqualTo(array(319 array(320 'class' => $class,321 'method' => $method,322 'value' => $duration,323 'path' => $path324 ),325 array(326 'class' => $otherClass,327 'method' => $otherMethod,328 'value' => $otherDuration,329 'path' => $otherPath330 )331 )332 )333 ->integer($score->getDurationNumber())->isEqualTo(2)334 ->object($score->addDuration(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)335 ->array($score->getDurations())->isEqualTo(array(336 array(337 'class' => $class,338 'method' => $method,339 'value' => $duration,340 'path' => $path341 ),342 array(343 'class' => $otherClass,344 'method' => $otherMethod,345 'value' => $otherDuration,346 'path' => $otherPath347 )348 )349 )350 ->integer($score->getDurationNumber())->isEqualTo(2)351 ->object($score->addDuration(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)352 ->array($score->getDurations())->isEqualTo(array(353 array(354 'class' => $class,355 'method' => $method,356 'value' => $duration,357 'path' => $path358 ),359 array(360 'class' => $otherClass,361 'method' => $otherMethod,362 'value' => $otherDuration,363 'path' => $otherPath364 )365 )366 )367 ->integer($score->getDurationNumber())->isEqualTo(2)368 ->object($score->addDuration($path, $class, $method, $moreDuration = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)369 ->array($score->getDurations())->isEqualTo(array(370 array(371 'class' => $class,372 'method' => $method,373 'value' => $duration,374 'path' => $path375 ),376 array(377 'class' => $otherClass,378 'method' => $otherMethod,379 'value' => $otherDuration,380 'path' => $otherPath381 ),382 array(383 'class' => $class,384 'method' => $method,385 'value' => $moreDuration,386 'path' => $path387 )388 )389 )390 ->integer($score->getDurationNumber())->isEqualTo(3)391 ;392 }393 public function testAddMemoryUsage()394 {395 $this396 ->if($score = new atoum\score())397 ->then398 ->array($score->getMemoryUsages())->isEmpty()399 ->object($score->addMemoryUsage($file = uniqid(), $class = uniqid(), $method = uniqid(), $memoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)400 ->array($score->getMemoryUsages())->isEqualTo(array(401 array(402 'class' => $class,403 'method' => $method,404 'value' => $memoryUsage405 )406 )407 )408 ->object($score->addMemoryUsage($otherFile = uniqid(), $otherClass = uniqid(), $otherMethod = uniqid(), $otherMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)409 ->array($score->getMemoryUsages())->isEqualTo(array(410 array(411 'class' => $class,412 'method' => $method,413 'value' => $memoryUsage414 ),415 array(416 'class' => $otherClass,417 'method' => $otherMethod,418 'value' => $otherMemoryUsage419 )420 )421 )422 ->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), 0))->isIdenticalTo($score)423 ->array($score->getMemoryUsages())->isEqualTo(array(424 array(425 'class' => $class,426 'method' => $method,427 'value' => $memoryUsage428 ),429 array(430 'class' => $otherClass,431 'method' => $otherMethod,432 'value' => $otherMemoryUsage433 )434 )435 )436 ->object($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), - rand(1, PHP_INT_MAX)))->isIdenticalTo($score)437 ->array($score->getMemoryUsages())->isEqualTo(array(438 array(439 'class' => $class,440 'method' => $method,441 'value' => $memoryUsage442 ),443 array(444 'class' => $otherClass,445 'method' => $otherMethod,446 'value' => $otherMemoryUsage447 )448 )449 )450 ->object($score->addMemoryUsage($file, $class, $method, $moreMemoryUsage = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)451 ->array($score->getMemoryUsages())->isEqualTo(array(452 array(453 'class' => $class,454 'method' => $method,455 'value' => $memoryUsage456 ),457 array(458 'class' => $otherClass,459 'method' => $otherMethod,460 'value' => $otherMemoryUsage461 ),462 array(463 'class' => $class,464 'method' => $method,465 'value' => $moreMemoryUsage466 )467 )468 )469 ;470 }471 public function testAddUncompletedMethod()472 {473 $this474 ->if($score = new atoum\score())475 ->then476 ->array($score->getUncompletedMethods())->isEmpty()477 ->object($score->addUncompletedMethod($class = uniqid(), $method = uniqid(), $exitCode = rand(1, PHP_INT_MAX), $output = uniqid()))->isIdenticalTo($score)478 ->array($score->getUncompletedMethods())->isEqualTo(array(479 array(480 'class' => $class,481 'method' => $method,482 'exitCode' => $exitCode,483 'output' => $output,484 )485 )486 )487 ->object($score->addUncompletedMethod($otherClass = uniqid(), $otherMethod = uniqid(), $otherExitCode = rand(1, PHP_INT_MAX), $otherOutput = uniqid()))->isIdenticalTo($score)488 ->array($score->getUncompletedMethods())->isEqualTo(array(489 array(490 'class' => $class,491 'method' => $method,492 'exitCode' => $exitCode,493 'output' => $output,494 ),495 array(496 'class' => $otherClass,497 'method' => $otherMethod,498 'exitCode' => $otherExitCode,499 'output' => $otherOutput,500 )501 )502 )503 ;504 }505 public function testAddSkippedMethod()506 {507 $this508 ->if($score = new atoum\score())509 ->then510 ->array($score->getSkippedMethods())->isEmpty()511 ->object($score->addSkippedMethod($class = uniqid(), $method = uniqid(), $message = uniqid()))->isIdenticalTo($score)512 ->array($score->getSkippedMethods())->isEqualTo(array(513 array(514 'class' => $class,515 'method' => $method,516 'message' => $message517 )518 )519 )520 ;521 }522 public function testAddRuntimeException()523 {524 $this525 ->if($score = new atoum\score())526 ->then527 ->array($score->getRuntimeExceptions())->isEmpty()528 ->integer($score->getRuntimeExceptionNumber())->isZero()529 ->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $exception = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)530 ->array($score->getRuntimeExceptions())->isEqualTo(array(531 $exception532 )533 )534 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(1)535 ->object($score->addRuntimeException(uniqid(), uniqid(), uniqid(), $otherException = new atoum\test\exceptions\runtime()))->isIdenticalTo($score)536 ->array($score->getRuntimeExceptions())->isEqualTo(array(537 $exception,538 $otherException539 )540 )541 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)542 ;543 }544 public function testSetCoverage()545 {546 $this547 ->if($score = new atoum\score())548 ->then549 ->object($score->setCoverage($coverage = new atoum\score\coverage()))->isIdenticalTo($score)550 ->object($score->getCoverage())->isIdenticalTo($coverage)551 ;552 }553 public function testGetExceptionNumber()554 {555 $this556 ->if($score = new atoum\score())557 ->then558 ->integer($score->getExceptionNumber())->isZero()559 ->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))560 ->then561 ->integer($score->getExceptionNumber())->isEqualTo(1)562 ->if($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))563 ->then564 ->integer($score->getExceptionNumber())->isEqualTo(2)565 ;566 }567 public function testGetFailNumber()568 {569 $this570 ->if($score = new atoum\score())571 ->then572 ->integer($score->getFailNumber())->isZero()573 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))574 ->then575 ->integer($score->getFailNumber())->isEqualTo(1)576 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))577 ->then578 ->integer($score->getFailNumber())->isEqualTo(2)579 ;580 }581 public function testGetFailAssertions()582 {583 $this584 ->if($score = new atoum\score())585 ->then586 ->array($score->getFailAssertions())->isEmpty()587 ->if($score->addPass())588 ->then589 ->array($score->getFailAssertions())->isEmpty()590 ->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()))591 ->then592 ->array($score->getFailAssertions())->isEqualTo(array(593 array(594 'case' => null,595 'dataSetKey' => null,596 'dataSetProvider' => null,597 'class' => $class,598 'method' => $method,599 'file' => $file,600 'line' => $line,601 'asserter' => $asserter,602 'fail' => $reason603 )604 )605 )606 ;607 }608 public function testGetPassAssertions()609 {610 $this611 ->if($score = new atoum\score())612 ->then613 ->integer($score->getPassNumber())->isZero()614 ->if($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))615 ->then616 ->integer($score->getPassNumber())->isZero()617 ->if($score->addPass())618 ->then619 ->integer($score->getPassNumber())->isEqualTo(1)620 ;621 }622 public function testGetCoverage()623 {624 $this625 ->if($score = new atoum\score())626 ->then627 ->object($coverage = $score->getCoverage())->isInstanceOf('mageekguy\atoum\score\coverage')628 ;629 }630 public function testGetMethodsWithFail()631 {632 $this633 ->if($score = new atoum\score())634 ->then635 ->array($score->getMethodsWithFail())->isEmpty()636 ->if($asserter = new atoum\asserters\integer(new atoum\asserter\generator()))637 ->and($score->addFail(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))638 ->then639 ->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod)))640 ->if($score->addFail(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))641 ->then642 ->array($score->getMethodsWithFail())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))643 ->if($score->addFail(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), $asserter, uniqid()))644 ->then645 ->array($score->getMethodsWithFail())->isEqualTo(array(646 $class => array($classMethod, $classOtherMethod),647 $otherClass => array($otherClassMethod)648 )649 )650 ;651 }652 public function testGetMethodsWithError()653 {654 $this655 ->if($score = new atoum\score())656 ->then657 ->array($score->getMethodsWithError())->isEmpty()658 ->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)))659 ->then660 ->array($score->getMethodsWithError())->isEqualTo(array($class => array($classMethod)))661 ->if($score->addError(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), rand(1, PHP_INT_MAX), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))662 ->then663 ->array($score->getMethodsWithError())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))664 ->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)))665 ->then666 ->array($score->getMethodsWithError())->isEqualTo(array(667 $class => array($classMethod, $classOtherMethod),668 $otherClass => array($otherClassMethod)669 )670 )671 ;672 }673 public function testGetMethodsWithException()674 {675 $this676 ->if($score = new atoum\score())677 ->then678 ->array($score->getMethodsWithError())->isEmpty()679 ->if($score->addException(uniqid(), $class = uniqid(), $classMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))680 ->then681 ->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod)))682 ->if($score->addException(uniqid(), $class, $classOtherMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))683 ->then684 ->array($score->getMethodsWithException())->isEqualTo(array($class => array($classMethod, $classOtherMethod)))685 ->if($score->addException(uniqid(), $otherClass = uniqid(), $otherClassMethod = uniqid(), rand(1, PHP_INT_MAX), new \exception()))686 ->then687 ->array($score->getMethodsWithException())->isEqualTo(array(688 $class => array($classMethod, $classOtherMethod),689 $otherClass => array($otherClassMethod)690 )691 )692 ;693 }694 public function testReset()695 {696 $this697 ->if($score = new atoum\score())698 ->then699 ->integer($score->getPassNumber())->isZero()700 ->array($score->getFailAssertions())->isEmpty()701 ->array($score->getExceptions())->isEmpty()702 ->array($score->getRuntimeExceptions())->isEmpty()703 ->array($score->getErrors())->isEmpty()704 ->array($score->getOutputs())->isEmpty()705 ->array($score->getDurations())->isEmpty()706 ->array($score->getMemoryUsages())->isEmpty()707 ->array($score->getUncompletedMethods())->isEmpty()708 ->object($score->reset())->isIdenticalTo($score)709 ->integer($score->getPassNumber())->isZero()710 ->array($score->getFailAssertions())->isEmpty()711 ->array($score->getExceptions())->isEmpty()712 ->array($score->getRuntimeExceptions())->isEmpty()713 ->array($score->getErrors())->isEmpty()714 ->array($score->getOutputs())->isEmpty()715 ->array($score->getDurations())->isEmpty()716 ->array($score->getMemoryUsages())->isEmpty()717 ->array($score->getUncompletedMethods())->isEmpty()718 ->if($score719 ->addPass()720 ->addException(uniqid(), rand(1, PHP_INT_MAX), uniqid(), uniqid(), new \exception())721 ->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime())722 ->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX))723 ->addOutput(uniqid(), uniqid(), uniqid(), uniqid())724 ->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))725 ->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX))726 ->addUncompletedMethod(uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid())727 )728 ->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))729 ->then730 ->integer($score->getPassNumber())->isGreaterThan(0)731 ->array($score->getFailAssertions())->isNotEmpty()732 ->array($score->getExceptions())->isNotEmpty()733 ->array($score->getRuntimeExceptions())->isNotEmpty()734 ->array($score->getErrors())->isNotEmpty()735 ->array($score->getOutputs())->isNotEmpty()736 ->array($score->getDurations())->isNotEmpty()737 ->array($score->getMemoryUsages())->isNotEmpty()738 ->array($score->getUncompletedMethods())->isNotEmpty()739 ->object($score->reset())->isIdenticalTo($score)740 ->integer($score->getPassNumber())->isZero()741 ->array($score->getFailAssertions())->isEmpty()742 ->array($score->getExceptions())->isEmpty()743 ->array($score->getRuntimeExceptions())->isEmpty()744 ->array($score->getErrors())->isEmpty()745 ->array($score->getOutputs())->isEmpty()746 ->array($score->getDurations())->isEmpty()747 ->array($score->getMemoryUsages())->isEmpty()748 ->array($score->getUncompletedMethods())->isEmpty()749 ;750 }751 public function testMerge()752 {753 $this754 ->if($score = new atoum\score())755 ->and($otherScore = new atoum\score())756 ->then757 ->object($score->merge($otherScore))->isIdenticalTo($score)758 ->integer($score->getPassNumber())->isZero()759 ->array($score->getFailAssertions())->isEmpty()760 ->array($score->getExceptions())->isEmpty()761 ->array($score->getRuntimeExceptions())->isEmpty()762 ->array($score->getErrors())->isEmpty()763 ->array($score->getOutputs())->isEmpty()764 ->array($score->getDurations())->isEmpty()765 ->array($score->getMemoryUsages())->isEmpty()766 ->array($score->getUncompletedMethods())->isEmpty()767 ->array($score->getSkippedMethods())->isEmpty()768 ->if($score->addPass())769 ->and($score->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))770 ->and($score->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))771 ->and($score->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))772 ->and($score->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))773 ->and($score->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))774 ->and($score->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))775 ->and($score->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))776 ->and($score->addUncompletedMethod(uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))777 ->and($score->addSkippedMethod(uniqid(), uniqid(), uniqid()))778 ->then779 ->object($score->merge($otherScore))->isIdenticalTo($score)780 ->integer($score->getPassNumber())->isEqualTo(1)781 ->integer($score->getFailNumber())->isEqualTo(1)782 ->integer($score->getExceptionNumber())->isEqualTo(1)783 ->integer($score->getErrorNumber())->isEqualTo(1)784 ->integer($score->getOutputNumber())->isEqualTo(1)785 ->integer($score->getDurationNumber())->isEqualTo(1)786 ->integer($score->getMemoryUsageNumber())->isEqualTo(1)787 ->integer($score->getUncompletedMethodNumber())->isEqualTo(1)788 ->integer($score->getSkippedMethodNumber())->isEqualTo(1)789 ->if($otherScore->addPass())790 ->and($otherScore->addFail(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new atoum\asserters\integer(new atoum\asserter\generator()), uniqid()))791 ->and($otherScore->addException(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), new \exception()))792 ->and($otherScore->addRuntimeException(uniqid(), uniqid(), uniqid(), new atoum\exceptions\runtime()))793 ->and($otherScore->addError(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX), E_ERROR, uniqid(), uniqid(), rand(1, PHP_INT_MAX)))794 ->and($otherScore->addOutput(uniqid(), uniqid(), uniqid(), uniqid()))795 ->and($otherScore->addDuration(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))796 ->and($otherScore->addMemoryUsage(uniqid(), uniqid(), uniqid(), rand(1, PHP_INT_MAX)))797 ->and($otherScore->addUncompletedMethod(uniqid(), uniqid(), rand(1, PHP_INT_MAX), uniqid()))798 ->and($otherScore->addSkippedMethod(uniqid(), uniqid(), uniqid()))799 ->then800 ->object($score->merge($otherScore))->isIdenticalTo($score)801 ->integer($score->getPassNumber())->isEqualTo(2)802 ->integer($score->getFailNumber())->isEqualTo(2)803 ->integer($score->getExceptionNumber())->isEqualTo(2)804 ->integer($score->getRuntimeExceptionNumber())->isEqualTo(2)...
IndexController.php
Source:IndexController.php
...503 $cre_time = db('task_receive')->where(['id' => $rid])->value('receive_time');504 $data['time_diff'] = time() - $cre_time;505 $res = db('task_receive')->where(['id' => $rid])->update($data);506 } catch (\Exception $e) {507 $addFail['taskId'] = $tid;508 $addFail['fail'] = $e->getMessage();509 $addFail['type'] = 3;510 $addFail['time'] = time();511 Db::name('fail_log')->insert($addFail);512 $this->error('æ交失败');513 }514 $this->success('æ交æå', ['user_task' => 2, 'tid' => $tid]);515 } else {516 $err = ['code' => -1, 'msg' => 'tokenæ æ!'];517 $this->error($err);518 }519 }520 }521 //ç¨æ·ä¸è½½æ¥å¿522 public function download_log()523 {524 if ($this->request->isPost()) {525 $request = $this->request->param();526 $id = $request['id'];527 $token = $request['token'];528 $user_id = db('user_token')->where(['token' => $token])->field('user_id')->find();529 $uid = $user_id['user_id'];530 if ($uid > 0) {531 $add['user_id'] = $uid;532 $add['task_id'] = $id;533 $add['link'] = db('task')->where(['id' => $id])->value('task_link');534 $add['create_time'] = time();535 $res = Db::name('loading_log')->insert($add);536 $rec = Db::name('task')->where(['id' => $id])->setInc('download_num');537 if ($res && $rec) {538 $this->success('æå');539 } else {540 $addFail['taskId'] = $id;541 $addFail['fail'] = 'ä¸è½½ä»»å¡å¤±è´¥ï¼ç¨æ·idï¼' . $uid . 'ä»»å¡idï¼' . $id;542 $addFail['type'] = 2;543 $addFail['time'] = time();544 Db::name('fail_log')->insert($addFail);545 $this->error('失败');546 }547 } else {548 $err = ['code' => -1, 'msg' => 'tokenæ æ!'];549 $this->error($err);550 }551 }552 }553 function base64_image_content($base64_image_content, $num)554 {555 //å¹é
åºå¾ççæ ¼å¼556 if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_image_content, $result)) {557 $path = $_SERVER['DOCUMENT_ROOT'] . '/upload/admin';558 $type = $result[2];559 $new_file = $path . "/" . date('Ymd', time()) . "/";560 if (!file_exists($new_file)) {561 //æ£æ¥æ¯å¦æ该æ件夹ï¼å¦æ没æå°±å建ï¼å¹¶ç»äºæé«æé562 mkdir($new_file, 0700);563 }564 $new_file = $new_file . time() . $num . ".{$type}";565 if (file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64_image_content)))) {566 return "admin/" . date('Ymd', time()) . "/" . time() . $num . ".{$type}";567 } else {568 return false;569 }570 } else {571 return false;572 }573 }574 //ç¨æ·ä»»å¡æ¶æ¯æé575 public function remind()576 {577 }578 //æ¹éæ·»å ä»»å¡579 public function timing_task()580 {581 //æ¡ä»¶ ï¼ ä»»å¡ç±»å æ¯å¦å é¤ æ¯å¦ä¸æ¶582 $task = db('task')->where(['recharge' => 0, 'isdelete' => 0, 'invalid' => 0])->field('id,recharge,game_id')->select()->toArray();583 $list1 = [];584 $list2 = [];585 $list3 = [];586 foreach ($task as $k => $v) {587 if ($v['recharge'] == 0) {588 $list1[$v['game_id']] = $v['id'];589 } elseif ($v['recharge'] == 1) {590 $list2[$v['game_id']] = $v['id'];591 } elseif ($v['recharge'] == 2) {592 $list3[$v['game_id']] = $v['id'];593 }594 }595 $list = array_merge($list1, $list2, $list3);596 //å®ä¹ç©ºçåéï¼ç¨æ¥åæ¾å¤±è´¥çä»»å¡id597 $fail_task = '';598 foreach ($list as $k => $v) {599 $main_task = db('task')->where(['id' => $v])->find();600 //æ·è´ä¸»çº¿ä»»å¡ï¼å¹¶è¿è¡æ°æ®å¤ç601 $main_task['create_time'] = time();602 $main_task['begin_time'] = date('Y-m-d H:i:s', strtotime($main_task['begin_time'] . "+1 day"));603 $main_task['end_time'] = date('Y-m-d H:i:s', strtotime($main_task['end_time'] . "+1 day"));604 $main_task['com_num'] = 0;605 //æåå½å主任å¡id606 $task_id = $main_task['id'];607 unset($main_task['id']);608 //æ¥è¯¢å½åä»»å¡æå±æ¸¸æä»å¤©æ¯å¦å·²ç»æ·»å è¿609 $f_task = db('task')->where(['game_id' => $main_task['game_id']])->whereTime('create_time', 'today')->find();610 //å¦æå½å游æä»å¤©æ²¡ææ·»å è¿ä»»å¡ï¼åæ§è¡æ·»å æä½611 if (empty($f_task)) {612 //æ·»å å¤çè¿åçæ°æ®613 $res = Db::name('task')->insertGetId($main_task);614 if ($res) {615 //æ·è´åæä»»å¡ï¼å¹¶è¿è¡æ°æ®å¤ç616 $bran_task = db('task_branch')->where(['tid' => $v])->select()->toArray();617 foreach ($bran_task as $k1 => $v1) {618 $bran_task[$k1]['tid'] = $res;619 $bran_task[$k1]['b_create_time'] = time();620 $bran_task[$k1]['b_begin_time'] = date('Y-m-d H:i:s', strtotime($v1['b_begin_time'] . "+1 day"));621 $bran_task[$k1]['b_end_time'] = date('Y-m-d H:i:s', strtotime($v1['b_end_time'] . "+1 day"));622 $bran_task[$k1]['b_invalid'] = 0;623 unset($bran_task[$k1]['id']);624 }625 //æ·»å å¤çè¿åçæ°æ®626 Db::name('task_branch')->insertAll($bran_task);627 } else {628 //å°æ§è¡æ·»å 失败ç主任å¡IDè®°å½629 $fail_task .= $task_id . ',';630 //å°é误信æ¯æ·»å è¿é误记å½631 $addFail['taskId'] = $fail_task;632 $addFail['fail'] = 'èªå¨æ·»å ä»»å¡æ§è¡å¤±è´¥';633 $addFail['time'] = time();634 $addFail['type'] = 1;635 Db::name('fail_log')->insert($addFail);636 }637 }638 }639 }640 /**641 * è·åæç°å表642 * @param ä¼ å
¥åæ°1643 * @param ä¼ å
¥åæ°2644 * @return è¿åæ ¼å¼json645 */646 public function cashlist()647 {648 $list = Db::name('cash')->alias('c')649 ->join('user u', 'c.uid = u.id', 'left')...
addFail
Using AI Code Generation
1$score->addFail();2$score->addPass();3$score->getPass();4$score->getFail();5$score->addFail();6$score->addPass();7$score->getPass();8$score->getFail();9$score->addFail();10$score->addPass();11$score->getPass();12$score->getFail();13$score->addFail();14$score->addPass();15$score->getPass();16$score->getFail();17$score->addFail();18$score->addPass();19$score->getPass();20$score->getFail();21$score->addFail();22$score->addPass();23$score->getPass();24$score->getFail();25$score->addFail();26$score->addPass();27$score->getPass();
addFail
Using AI Code Generation
1include 'score.php';2$score = new Score();3$score->addFail();4include 'score.php';5$score = new Score();6$score->addPass();
addFail
Using AI Code Generation
1$score = new score();2$score->addFail();3$score = new score();4$score->addPass();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->addPass();13$score = new score();14$score->addFail();15$score = new score();16$score->addPass();17$score = new score();18$score->addFail();19$score = new score();20$score->addPass();21$score = new score();22$score->addFail();23$score = new score();24$score->addPass();25$score = new score();26$score->addFail();27$score = new score();28$score->addPass();29$score = new score();30$score->addFail();31$score = new score();32$score->addPass();33$score = new score();34$score->addFail();35$score = new score();36$score->addPass();37$score = new score();38$score->addFail();39$score = new score();40$score->addPass();41$score = new score();42$score->addFail();43$score = new score();44$score->addPass();
addFail
Using AI Code Generation
1include_once('score.php');2$score = new Score();3$score->addFail();4include_once('score.php');5$score = new Score();6$score->addPass();7include_once('score.php');8$score = new Score();9$score->addPass();10include_once('score.php');11$score = new Score();12$score->addPass();13include_once('score.php');14$score = new Score();15$score->addFail();16include_once('score.php');17$score = new Score();18$score->addPass();19include_once('score.php');20$score = new Score();21$score->addPass();22include_once('score.php');23$score = new Score();24$score->addPass();25include_once('score.php');26$score = new Score();27$score->addPass();28include_once('score.php');29$score = new Score();30$score->addFail();31include_once('score.php');32$score = new Score();33$score->addPass();34include_once('score.php');35$score = new Score();36$score->addPass();37include_once('score.php');38$score = new Score();39$score->addPass();
addFail
Using AI Code Generation
1require_once('score.php');2$score = new Score();3$score->addFail();4I am trying to create a calculator that takes in 2 numbers and an operator and then returns the answer. Here's what I have so far: [CODE]import java.util.Scanner; …5 {6 Runtime run = Runtime.getRuntime();
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 addFail 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!!