Best Atoum code snippet using phpObject.toArray
calls.php
Source:calls.php
...110 ->object($calls->reset())->isIdenticalTo($calls)111 ->sizeof($calls)->isZero()112 ->if($calls[] = $call = new adapter\call(uniqid()))113 ->then114 ->array($calls[$call->getFunction()]->toArray())->isEqualTo([2 => $call])115 ;116 }117 public function testAddCall()118 {119 $this120 ->if($calls = new testedClass())121 ->then122 ->object($calls->addCall($call = new adapter\call(uniqid())))->isIdenticalTo($calls)123 ->array($calls[$call->getFunction()]->toArray())124 ->isEqualTo([1 => $call])125 ->object[1]->isIdenticalTo($call)126 ;127 }128 public function testRemoveCall()129 {130 $this131 ->if($calls = new testedClass())132 ->then133 ->object($calls->removeCall(new adapter\call(uniqid()), rand(0, PHP_INT_MAX)))->isIdenticalTo($calls)134 ->sizeof($calls)->isZero()135 ->if($calls->addCall($call = new adapter\call(uniqid())))136 ->then137 ->object($calls->removeCall(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isIdenticalTo($calls)138 ->sizeof($calls)->isEqualTo(1)139 ->object($calls->removeCall($call, rand(2, PHP_INT_MAX)))->isIdenticalTo($calls)140 ->sizeof($calls)->isEqualTo(1)141 ->object($calls->removeCall($call, 1))->isIdenticalTo($calls)142 ->sizeof($calls)->isZero()143 ;144 }145 public function testOffsetSet()146 {147 $this148 ->if($calls = new testedClass())149 ->then150 ->exception(function () use ($calls) {151 $calls[] = new adapter\call();152 })153 ->isInstanceOf(atoum\exceptions\logic\invalidArgument::class)154 ->hasMessage('Function is undefined')155 ->if($calls[] = $call1 = new adapter\call(uniqid()))156 ->then157 ->array($calls[$call1]->toArray())158 ->isEqualTo([1 => $call1])159 ->object[1]->isIdenticalTo($call1)160 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))161 ->then162 ->array($calls[$call1]->toArray())163 ->isEqualTo([1 => $call1])164 ->object[1]->isIdenticalTo($call1)165 ->array($calls[$call2]->toArray())166 ->isEqualTo([2 => $call2])167 ->object[2]->isIdenticalTo($call2)168 ->if($calls[] = $call3 = new adapter\call($call1->getFunction(), []))169 ->then170 ->array($calls[$call1]->toArray())171 ->isEqualTo([1 => $call1, 3 => $call3])172 ->object[1]->isIdenticalTo($call1)173 ->object[3]->isIdenticalTo($call3)174 ->array($calls[$call2]->toArray())175 ->isEqualTo([2 => $call2])176 ->object[2]->isIdenticalTo($call2)177 ->if($calls[] = $call4 = new adapter\call(uniqid()))178 ->then179 ->array($calls[$call1]->toArray())180 ->isEqualTo([1 => $call1, 3 => $call3])181 ->object[1]->isIdenticalTo($call1)182 ->object[3]->isIdenticalTo($call3)183 ->array($calls[$call2]->toArray())184 ->isEqualTo([2 => $call2])185 ->object[2]->isIdenticalTo($call2)186 ->array($calls[$call4->getFunction()]->toArray())187 ->isEqualTo([4 => $call4])188 ->object[4]->isIdenticalTo($call4)189 ->if($calls[$newFunction = uniqid()] = $call5 = new adapter\call(uniqid()))190 ->then191 ->array($calls[$newFunction]->toArray())->isEqualTo([5 => $call5])192 ->object[5]->isIdenticalTo($call5)193 ->string($call5->getFunction())->isEqualTo($newFunction)194 ;195 }196 public function testOffsetGet()197 {198 $this199 ->if($calls = new testedClass())200 ->then201 ->array($calls[uniqid()]->toArray())->isEmpty()202 ->if($calls[] = $call1 = new adapter\call(uniqid()))203 ->then204 ->array($calls[$call1->getFunction()]->toArray())205 ->isEqualTo([1 => $call1])206 ->object[1]->isIdenticalTo($call1)207 ->array($calls[$call1]->toArray())208 ->isEqualTo([1 => $call1])209 ->object[1]->isIdenticalTo($call1)210 ->if($calls[] = $call2 = new adapter\call($call1->getFunction(), []))211 ->then212 ->array($calls[uniqid()]->toArray())->isEmpty()213 ->array($calls[$call1->getFunction()]->toArray())214 ->isEqualTo([1 => $call1, 2 => $call2])215 ->object[1]->isIdenticalTo($call1)216 ->object[2]->isIdenticalTo($call2)217 ->array($calls[$call1]->toArray())218 ->isEqualTo([1 => $call1, 2 => $call2])219 ->object[1]->isIdenticalTo($call1)220 ->object[2]->isIdenticalTo($call2)221 ->array($calls[$call2->getFunction()]->toArray())222 ->isEqualTo([1 => $call1, 2 => $call2])223 ->object[1]->isIdenticalTo($call1)224 ->object[2]->isIdenticalTo($call2)225 ->array($calls[$call2]->toArray())226 ->isEqualTo([2 => $call2])227 ->object[2]->isIdenticalTo($call2)228 ;229 }230 public function testOffsetExists()231 {232 $this233 ->if($calls = new testedClass())234 ->then235 ->boolean(isset($calls[uniqid()]))->isFalse()236 ->if($calls[] = $call = new adapter\call(uniqid()))237 ->then238 ->boolean(isset($calls[uniqid()]))->isFalse()239 ->boolean(isset($calls[$call->getFunction()]))->isTrue()240 ->boolean(isset($calls[$call]))->isTrue()241 ;242 }243 public function testOffsetUnset()244 {245 $this246 ->if($calls = new testedClass())247 ->when(function () use ($calls) {248 unset($calls[uniqid()]);249 })250 ->then251 ->sizeof($calls)->isZero252 ->if($calls[] = $call = new adapter\call(uniqid()))253 ->when(function () use ($calls) {254 unset($calls[uniqid()]);255 })256 ->then257 ->boolean(isset($calls[$call->getFunction()]))->isTrue()258 ->sizeof($calls)->isEqualTo(1)259 ->when(function () use ($calls, $call) {260 unset($calls[$call->getFunction()]);261 })262 ->then263 ->boolean(isset($calls[$call->getFunction()]))->isFalse()264 ->sizeof($calls)->isZero265 ;266 }267 public function testGetIterator()268 {269 $this270 ->if($calls = new testedClass())271 ->then272 ->object($calls->getIterator())->isEqualTo(new \arrayIterator($calls()))273 ;274 }275 public function testToArray()276 {277 $this278 ->if($calls = new testedClass())279 ->then280 ->array($calls->toArray())->isEmpty()281 ->array($calls->toArray(new adapter\call(uniqid())))->isEmpty()282 ->if($calls->addCall($call1 = new adapter\call(uniqid())))283 ->then284 ->array($calls->toArray())->isEqualTo([1 => $call1])285 ->array($calls->toArray(new adapter\call(uniqid())))->isEmpty()286 ->array($calls->toArray($call1))->isEqualTo([1 => $call1])287 ->if($calls->addCall($call2 = clone $call1))288 ->then289 ->array($calls->toArray())->isEqualTo([1 => $call1, 2 => $call2])290 ->array($calls->toArray(new adapter\call(uniqid())))->isEmpty()291 ->array($calls->toArray($call1))->isEqualTo([1 => $call1, 2 => $call2])292 ->array($calls->toArray($call2))->isEqualTo([1 => $call1, 2 => $call2])293 ->if($calls->addCall($call3 = new adapter\call(uniqid())))294 ->then295 ->array($calls->toArray())->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3])296 ->array($calls->toArray(new adapter\call(uniqid())))->isEmpty()297 ->array($calls->toArray($call1))->isEqualTo([1 => $call1, 2 => $call2])298 ->array($calls->toArray($call2))->isEqualTo([1 => $call1, 2 => $call2])299 ->array($calls->toArray($call3))->isEqualTo([3 => $call3])300 ;301 }302 public function testGetEqualTo()303 {304 $this305 ->if($calls = new testedClass())306 ->then307 ->object($calls->getEqualTo(new adapter\call(uniqid())))308 ->isInstanceOf(atoum\test\adapter\calls::class)309 ->hasSize(0)310 ->if($calls[] = $call1 = new adapter\call(uniqid()))311 ->then312 ->object($calls->getEqualTo(new adapter\call(uniqid())))313 ->isInstanceOf(atoum\test\adapter\calls::class)314 ->hasSize(0)315 ->object($calls->getEqualTo($call1))316 ->isInstanceOf(atoum\test\adapter\calls::class)317 ->hasSize(1)318 ->array($calls->getEqualTo($call1)->toArray())319 ->isEqualTo([1 => $call1])320 ->if($calls[] = $call2 = new adapter\call($call1->getFunction(), []))321 ->then322 ->object($calls->getEqualTo(new adapter\call(uniqid())))323 ->isInstanceOf(atoum\test\adapter\calls::class)324 ->hasSize(0)325 ->object($calls->getEqualTo($call1))326 ->isInstanceOf(atoum\test\adapter\calls::class)327 ->hasSize(2)328 ->array($calls->getEqualTo($call1)->toArray())329 ->isEqualTo([1 => $call1, 2 => $call2])330 ->object($calls->getEqualTo($call2))331 ->isInstanceOf(atoum\test\adapter\calls::class)332 ->hasSize(1)333 ->array($calls->getEqualTo($call2)->toArray())334 ->isEqualTo([2 => $call2])335 ->if($calls[] = $call3 = new adapter\call($call1->getFunction(), [$object = new \mock\phpObject()]))336 ->then337 ->object($calls->getEqualTo(new adapter\call(uniqid())))338 ->isInstanceOf(atoum\test\adapter\calls::class)339 ->hasSize(0)340 ->object($calls->getEqualTo($call1))341 ->isInstanceOf(atoum\test\adapter\calls::class)342 ->hasSize(3)343 ->array($calls->getEqualTo($call1)->toArray())344 ->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3])345 ->object($calls->getEqualTo($call2))346 ->isInstanceOf(atoum\test\adapter\calls::class)347 ->hasSize(1)348 ->array($calls->getEqualTo($call2)->toArray())349 ->isEqualTo([2 => $call2])350 ->object($calls->getEqualTo($call3))351 ->isInstanceOf(atoum\test\adapter\calls::class)352 ->hasSize(1)353 ->array($calls->getEqualTo($call3)->toArray())354 ->isEqualTo([3 => $call3])355 ->if($calls[] = $call4 = new adapter\call($call1->getFunction(), [$object = new \mock\phpObject(), $arg = uniqid()]))356 ->then357 ->object($calls->getEqualTo(new adapter\call(uniqid())))358 ->isInstanceOf(atoum\test\adapter\calls::class)359 ->hasSize(0)360 ->object($calls->getEqualTo($call1))361 ->isInstanceOf(atoum\test\adapter\calls::class)362 ->hasSize(4)363 ->array($calls->getEqualTo($call1)->toArray())364 ->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3, 4 => $call4])365 ->object($calls->getEqualTo($call2))366 ->isInstanceOf(atoum\test\adapter\calls::class)367 ->hasSize(1)368 ->array($calls->getEqualTo($call2)->toArray())369 ->isEqualTo([2 => $call2])370 ->object($calls->getEqualTo($call3))371 ->isInstanceOf(atoum\test\adapter\calls::class)372 ->hasSize(2)373 ->array($calls->getEqualTo($call3)->toArray())374 ->isEqualTo([3 => $call3, 4 => $call4])375 ->object($calls->getEqualTo(new adapter\call($call1->getFunction(), [clone $object])))376 ->isInstanceOf(atoum\test\adapter\calls::class)377 ->hasSize(2)378 ->array($calls->getEqualTo($call3)->toArray())379 ->isEqualTo([3 => $call3, 4 => $call4])380 ->object($calls->getEqualTo($call4))381 ->isInstanceOf(atoum\test\adapter\calls::class)382 ->hasSize(1)383 ->array($calls->getEqualTo($call4)->toArray())384 ->isEqualTo([4 => $call4])385 ->object($calls->getEqualTo(new adapter\call($call1->getFunction(), [clone $object, $arg])))386 ->isInstanceOf(atoum\test\adapter\calls::class)387 ->hasSize(1)388 ->array($calls->getEqualTo($call4)->toArray())389 ->isEqualTo([4 => $call4])390 ->if($calls = new testedClass())391 ->and($calls[] = $call5 = new adapter\call(uniqid(), [1, 2, 3, 4, 5]))392 ->then393 ->object($calls->getEqualTo(new adapter\call($call5->getFunction())))394 ->isInstanceOf(atoum\test\adapter\calls::class)395 ->hasSize(1)396 ->array($calls->getEqualTo(new adapter\call($call5->getFunction()))->toArray())397 ->isEqualTo([5 => $call5])398 ;399 }400 public function testGetIdenticalTo()401 {402 $this403 ->if($calls = new testedClass())404 ->then405 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))406 ->isInstanceOf(atoum\test\adapter\calls::class)407 ->hasSize(0)408 ->if($calls[] = $call1 = new adapter\call(uniqid()))409 ->then410 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))411 ->isInstanceOf(atoum\test\adapter\calls::class)412 ->hasSize(0)413 ->object($calls->getIdenticalTo($call1))414 ->isInstanceOf(atoum\test\adapter\calls::class)415 ->hasSize(1)416 ->array($calls->getIdenticalTo($call1)->toArray())417 ->isEqualTo([1 => $call1])418 ->if($calls[] = $call2 = new adapter\call($call1->getFunction(), []))419 ->then420 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))421 ->isInstanceOf(atoum\test\adapter\calls::class)422 ->hasSize(0)423 ->object($calls->getIdenticalTo($call1))424 ->isInstanceOf(atoum\test\adapter\calls::class)425 ->hasSize(2)426 ->array($calls->getIdenticalTo($call1)->toArray())427 ->isEqualTo([1 => $call1, 2 => $call2])428 ->object($calls->getIdenticalTo($call2))429 ->isInstanceOf(atoum\test\adapter\calls::class)430 ->hasSize(1)431 ->array($calls->getIdenticalTo($call2)->toArray())432 ->isEqualTo([2 => $call2])433 ->if($calls[] = $call3 = new adapter\call($call1->getFunction(), [$object = new \mock\phpObject()]))434 ->then435 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))436 ->isInstanceOf(atoum\test\adapter\calls::class)437 ->hasSize(0)438 ->object($calls->getIdenticalTo($call1))439 ->isInstanceOf(atoum\test\adapter\calls::class)440 ->hasSize(3)441 ->array($calls->getIdenticalTo($call1)->toArray())442 ->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3])443 ->object($calls->getIdenticalTo($call2))444 ->isInstanceOf(atoum\test\adapter\calls::class)445 ->hasSize(1)446 ->array($calls->getIdenticalTo($call2)->toArray())447 ->isEqualTo([2 => $call2])448 ->object($calls->getIdenticalTo($call3))449 ->isInstanceOf(atoum\test\adapter\calls::class)450 ->hasSize(1)451 ->array($calls->getIdenticalTo($call3)->toArray())452 ->isEqualTo([3 => $call3])453 ->object($calls->getIdenticalTo(new adapter\call($call1->getFunction(), [clone $object])))454 ->isInstanceOf(atoum\test\adapter\calls::class)455 ->hasSize(0)456 ->if($calls[] = $call4 = new adapter\call($call1->getFunction(), [$object = new \mock\phpObject(), $arg = uniqid()]))457 ->then458 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))459 ->isInstanceOf(atoum\test\adapter\calls::class)460 ->hasSize(0)461 ->object($calls->getIdenticalTo($call1))462 ->isInstanceOf(atoum\test\adapter\calls::class)463 ->hasSize(4)464 ->array($calls->getIdenticalTo($call1)->toArray())465 ->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3, 4 => $call4])466 ->object($calls->getIdenticalTo($call2))467 ->isInstanceOf(atoum\test\adapter\calls::class)468 ->hasSize(1)469 ->array($calls->getIdenticalTo($call2)->toArray())470 ->isEqualTo([2 => $call2])471 ->object($calls->getIdenticalTo($call3))472 ->isInstanceOf(atoum\test\adapter\calls::class)473 ->hasSize(1)474 ->array($calls->getIdenticalTo($call3)->toArray())475 ->isEqualTo([3 => $call3])476 ->object($calls->getIdenticalTo(new adapter\call($call1->getFunction(), [clone $object])))477 ->isInstanceOf(atoum\test\adapter\calls::class)478 ->hasSize(0)479 ->object($calls->getIdenticalTo($call4))480 ->isInstanceOf(atoum\test\adapter\calls::class)481 ->hasSize(1)482 ->array($calls->getIdenticalTo($call4)->toArray())483 ->isEqualTo([4 => $call4])484 ->object($calls->getIdenticalTo(new adapter\call($call1->getFunction(), [clone $object, $arg])))485 ->isInstanceOf(atoum\test\adapter\calls::class)486 ->hasSize(0)487 ;488 }489 public function testGetPreviousEqualTo()490 {491 $this492 ->if($calls = new testedClass())493 ->then494 ->object($calls->getPreviousEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))495 ->isInstanceOf(atoum\test\adapter\calls::class)496 ->hasSize(0)497 ->if($calls[] = $call1 = new adapter\call(uniqid()))498 ->then499 ->object($calls->getPreviousEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))500 ->isInstanceOf(atoum\test\adapter\calls::class)501 ->hasSize(0)502 ->object($calls->getPreviousEqualTo(new adapter\call($call1), 0))503 ->isInstanceOf(atoum\test\adapter\calls::class)504 ->hasSize(0)505 ->object($calls->getPreviousEqualTo(new adapter\call($call1), 1))506 ->isInstanceOf(atoum\test\adapter\calls::class)507 ->hasSize(0)508 ->object($calls->getPreviousEqualTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))509 ->isInstanceOf(atoum\test\adapter\calls::class)510 ->hasSize(0)511 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))512 ->then513 ->object($calls->getPreviousEqualTo(new adapter\call(uniqid()), 1))514 ->isInstanceOf(atoum\test\adapter\calls::class)515 ->hasSize(0)516 ->object($calls->getPreviousEqualTo($call1, 1))517 ->isInstanceOf(atoum\test\adapter\calls::class)518 ->hasSize(0)519 ->object($previousCalls = $calls->getPreviousEqualTo($call1, 2))520 ->isInstanceOf(atoum\test\adapter\calls::class)521 ->hasSize(1)522 ->array($previousCalls->toArray())523 ->isEqualTo([1 => $call1])524 ->object($calls->getPreviousEqualTo($call2, 1))525 ->isInstanceOf(atoum\test\adapter\calls::class)526 ->hasSize(0)527 ->object($calls->getPreviousEqualTo($call2, 2))528 ->isInstanceOf(atoum\test\adapter\calls::class)529 ->hasSize(0)530 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))531 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))532 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))533 ->then534 ->object($calls->getPreviousEqualTo(new adapter\call(uniqid()), 1))535 ->isInstanceOf(atoum\test\adapter\calls::class)536 ->hasSize(0)537 ->object($calls->getPreviousEqualTo($call1, 1))538 ->isInstanceOf(atoum\test\adapter\calls::class)539 ->hasSize(0)540 ->object($previousCalls = $calls->getPreviousEqualTo($call1, 2))541 ->isInstanceOf(atoum\test\adapter\calls::class)542 ->hasSize(1)543 ->array($previousCalls->toArray())544 ->isEqualTo([1 => $call1])545 ->object($calls->getPreviousEqualTo($call2, 1))546 ->isInstanceOf(atoum\test\adapter\calls::class)547 ->hasSize(0)548 ->object($calls->getPreviousEqualTo($call2, 2))549 ->isInstanceOf(atoum\test\adapter\calls::class)550 ->hasSize(0)551 ->object($previousCalls = $calls->getPreviousEqualTo($call3, 4))552 ->isInstanceOf(atoum\test\adapter\calls::class)553 ->hasSize(1)554 ->array($previousCalls->toArray())555 ->isEqualTo([3 => $call3])556 ->object($previousCalls = $calls->getPreviousEqualTo($call4, 4))557 ->isInstanceOf(atoum\test\adapter\calls::class)558 ->hasSize(1)559 ->array($previousCalls->toArray())560 ->isEqualTo([3 => $call3])561 ->object($previousCalls = $calls->getPreviousEqualTo($call3, 5))562 ->isInstanceOf(atoum\test\adapter\calls::class)563 ->hasSize(2)564 ->array($previousCalls->toArray())565 ->isEqualTo([3 => $call3, 4 => $call4])566 ->object($previousCalls = $calls->getPreviousEqualTo($call4, 5))567 ->isInstanceOf(atoum\test\adapter\calls::class)568 ->hasSize(2)569 ->array($previousCalls->toArray())570 ->isEqualTo([3 => $call3, 4 => $call4])571 ;572 }573 public function testGetPreviousIdenticalTo()574 {575 $this576 ->if($calls = new testedClass())577 ->then578 ->object($calls->getPreviousIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))579 ->isInstanceOf(atoum\test\adapter\calls::class)580 ->hasSize(0)581 ->if($calls[] = $call1 = new adapter\call(uniqid()))582 ->then583 ->object($calls->getPreviousIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))584 ->isInstanceOf(atoum\test\adapter\calls::class)585 ->hasSize(0)586 ->object($calls->getPreviousIdenticalTo(new adapter\call($call1), 0))587 ->isInstanceOf(atoum\test\adapter\calls::class)588 ->hasSize(0)589 ->object($calls->getPreviousIdenticalTo(new adapter\call($call1), 1))590 ->isInstanceOf(atoum\test\adapter\calls::class)591 ->hasSize(0)592 ->object($calls->getPreviousIdenticalTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))593 ->isInstanceOf(atoum\test\adapter\calls::class)594 ->hasSize(0)595 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))596 ->then597 ->object($calls->getPreviousIdenticalTo(new adapter\call(uniqid()), 1))598 ->isInstanceOf(atoum\test\adapter\calls::class)599 ->hasSize(0)600 ->object($calls->getPreviousIdenticalTo($call1, 1))601 ->isInstanceOf(atoum\test\adapter\calls::class)602 ->hasSize(0)603 ->object($previousCalls = $calls->getPreviousIdenticalTo($call1, 2))604 ->isInstanceOf(atoum\test\adapter\calls::class)605 ->hasSize(1)606 ->array($previousCalls->toArray())607 ->isIdenticalTo([1 => $call1])608 ->object($calls->getPreviousIdenticalTo($call2, 1))609 ->isInstanceOf(atoum\test\adapter\calls::class)610 ->hasSize(0)611 ->object($calls->getPreviousIdenticalTo($call2, 2))612 ->isInstanceOf(atoum\test\adapter\calls::class)613 ->hasSize(0)614 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))615 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))616 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))617 ->then618 ->object($calls->getPreviousIdenticalTo(new adapter\call(uniqid()), 1))619 ->isInstanceOf(atoum\test\adapter\calls::class)620 ->hasSize(0)621 ->object($calls->getPreviousIdenticalTo($call1, 1))622 ->isInstanceOf(atoum\test\adapter\calls::class)623 ->hasSize(0)624 ->object($previousCalls = $calls->getPreviousIdenticalTo($call1, 2))625 ->isInstanceOf(atoum\test\adapter\calls::class)626 ->hasSize(1)627 ->array($previousCalls->toArray())628 ->isIdenticalTo([1 => $call1])629 ->object($calls->getPreviousIdenticalTo($call2, 1))630 ->isInstanceOf(atoum\test\adapter\calls::class)631 ->hasSize(0)632 ->object($calls->getPreviousIdenticalTo($call2, 2))633 ->isInstanceOf(atoum\test\adapter\calls::class)634 ->hasSize(0)635 ->object($previousCalls = $calls->getPreviousIdenticalTo($call3, 4))636 ->isInstanceOf(atoum\test\adapter\calls::class)637 ->hasSize(1)638 ->array($previousCalls->toArray())639 ->isIdenticalTo([3 => $call3])640 ->object($calls->getPreviousIdenticalTo($call4, 4))641 ->isInstanceOf(atoum\test\adapter\calls::class)642 ->hasSize(0)643 ->object($previousCalls = $calls->getPreviousIdenticalTo($call3, 5))644 ->isInstanceOf(atoum\test\adapter\calls::class)645 ->hasSize(1)646 ->array($previousCalls->toArray())647 ->isIdenticalTo([3 => $call3])648 ->object($previousCalls =$calls->getPreviousIdenticalTo($call4, 5))649 ->isInstanceOf(atoum\test\adapter\calls::class)650 ->hasSize(1)651 ->array($previousCalls->toArray())652 ->isIdenticalTo([4 => $call4])653 ;654 }655 public function testGetPrevious()656 {657 $this658 ->if($calls = new mockedTestedClass())659 ->then660 ->object($calls->getPrevious($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX)))661 ->isInstanceOf(atoum\test\adapter\calls::class)662 ->mock($calls)->call('getPreviousEqualTo')->withArguments($call, $position)->once()663 ->object($calls->getPrevious($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX), true))664 ->isInstanceOf(atoum\test\adapter\calls::class)665 ->mock($calls)->call('getPreviousIdenticalTo')->withArguments($call, $position)->once()666 ;667 }668 public function testHasPreviousEqualTo()669 {670 $this671 ->if($calls = new testedClass())672 ->then673 ->boolean($calls->hasPreviousEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()674 ->if($calls[] = $call1 = new adapter\call(uniqid()))675 ->then676 ->boolean($calls->hasPreviousEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()677 ->boolean($calls->hasPreviousEqualTo(new adapter\call($call1), 0))->isFalse()678 ->boolean($calls->hasPreviousEqualTo(new adapter\call($call1), 1))->isFalse()679 ->boolean($calls->hasPreviousEqualTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))->isFalse()680 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))681 ->then682 ->boolean($calls->hasPreviousEqualTo(new adapter\call(uniqid()), 1))->isFalse()683 ->boolean($calls->hasPreviousEqualTo($call1, 1))->isFalse()684 ->boolean($previousCalls = $calls->hasPreviousEqualTo($call1, 2))->isTrue()685 ->boolean($calls->hasPreviousEqualTo($call2, 1))->isFalse()686 ->boolean($calls->hasPreviousEqualTo($call2, 2))->isFalse()687 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))688 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))689 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))690 ->then691 ->boolean($calls->hasPreviousEqualTo(new adapter\call(uniqid()), 1))->isFalse()692 ->boolean($calls->hasPreviousEqualTo($call1, 1))->isFalse()693 ->boolean($previousCalls = $calls->hasPreviousEqualTo($call1, 2))->isTrue()694 ->boolean($calls->hasPreviousEqualTo($call2, 1))->isFalse()695 ->boolean($calls->hasPreviousEqualTo($call2, 2))->isFalse()696 ->boolean($previousCalls = $calls->hasPreviousEqualTo($call3, 4))->isTrue()697 ->boolean($previousCalls = $calls->hasPreviousEqualTo($call4, 4))->isTrue()698 ->boolean($previousCalls = $calls->hasPreviousEqualTo($call3, 5))->isTrue()699 ->boolean($previousCalls = $calls->hasPreviousEqualTo($call4, 5))->isTrue()700 ;701 }702 public function testHasPreviousIdenticalTo()703 {704 $this705 ->if($calls = new testedClass())706 ->then707 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()708 ->if($calls[] = $call1 = new adapter\call(uniqid()))709 ->then710 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()711 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call($call1), 0))->isFalse()712 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call($call1), 1))->isFalse()713 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))->isFalse()714 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))715 ->then716 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call(uniqid()), 1))->isFalse()717 ->boolean($calls->hasPreviousIdenticalTo($call1, 1))->isFalse()718 ->boolean($previousCalls = $calls->hasPreviousIdenticalTo($call1, 2))->isTrue()719 ->boolean($calls->hasPreviousIdenticalTo($call2, 1))->isFalse()720 ->boolean($calls->hasPreviousIdenticalTo($call2, 2))->isFalse()721 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))722 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))723 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))724 ->then725 ->boolean($calls->hasPreviousIdenticalTo(new adapter\call(uniqid()), 1))->isFalse()726 ->boolean($calls->hasPreviousIdenticalTo($call1, 1))->isFalse()727 ->boolean($previousCalls = $calls->hasPreviousIdenticalTo($call1, 2))->isTrue()728 ->boolean($calls->hasPreviousIdenticalTo($call2, 1))->isFalse()729 ->boolean($calls->hasPreviousIdenticalTo($call2, 2))->isFalse()730 ->boolean($previousCalls = $calls->hasPreviousIdenticalTo($call3, 4))->isTrue()731 ->boolean($calls->hasPreviousIdenticalTo($call4, 4))->isFalse()732 ->boolean($previousCalls = $calls->hasPreviousIdenticalTo($call3, 5))->isTrue()733 ->boolean($previousCalls =$calls->hasPreviousIdenticalTo($call4, 5))->isTrue()734 ;735 }736 public function testHasPrevious()737 {738 $this739 ->if($calls = new mockedTestedClass())740 ->then741 ->boolean($calls->hasPrevious($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX)))->isFalse()742 ->mock($calls)->call('hasPreviousEqualTo')->withArguments($call, $position)->once()743 ->boolean($calls->hasPrevious($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX), true))->isFalse()744 ->mock($calls)->call('hasPreviousIdenticalTo')->withArguments($call, $position)->once()745 ;746 }747 public function testGetAfterEqualTo()748 {749 $this750 ->if($calls = new testedClass())751 ->then752 ->object($calls->getAfterEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))753 ->isInstanceOf(atoum\test\adapter\calls::class)754 ->hasSize(0)755 ->if($calls[] = $call1 = new adapter\call(uniqid()))756 ->then757 ->object($calls->getAfterEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))758 ->isInstanceOf(atoum\test\adapter\calls::class)759 ->hasSize(0)760 ->object($calls->getAfterEqualTo(new adapter\call($call1), 0))761 ->isInstanceOf(atoum\test\adapter\calls::class)762 ->hasSize(0)763 ->object($calls->getAfterEqualTo(new adapter\call($call1), 1))764 ->isInstanceOf(atoum\test\adapter\calls::class)765 ->hasSize(0)766 ->object($calls->getAfterEqualTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))767 ->isInstanceOf(atoum\test\adapter\calls::class)768 ->hasSize(0)769 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))770 ->then771 ->object($calls->getAfterEqualTo(new adapter\call(uniqid()), 1))772 ->isInstanceOf(atoum\test\adapter\calls::class)773 ->hasSize(0)774 ->object($calls->getAfterEqualTo($call1, 1))775 ->isInstanceOf(atoum\test\adapter\calls::class)776 ->hasSize(0)777 ->object($calls->getAfterEqualTo($call1, 2))778 ->isInstanceOf(atoum\test\adapter\calls::class)779 ->hasSize(0)780 ->object($afterCalls = $calls->getAfterEqualTo($call2, 1))781 ->isInstanceOf(atoum\test\adapter\calls::class)782 ->hasSize(1)783 ->array($afterCalls->toArray())784 ->isEqualTo([2 => $call2])785 ->object($calls->getAfterEqualTo($call2, 2))786 ->isInstanceOf(atoum\test\adapter\calls::class)787 ->hasSize(0)788 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))789 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))790 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))791 ->then792 ->object($calls->getAfterEqualTo(new adapter\call(uniqid()), 1))793 ->isInstanceOf(atoum\test\adapter\calls::class)794 ->hasSize(0)795 ->object($calls->getAfterEqualTo($call1, 1))796 ->isInstanceOf(atoum\test\adapter\calls::class)797 ->hasSize(0)798 ->object($calls->getAfterEqualTo($call1, 2))799 ->isInstanceOf(atoum\test\adapter\calls::class)800 ->hasSize(0)801 ->object($afterCalls = $calls->getAfterEqualTo($call2, 1))802 ->isInstanceOf(atoum\test\adapter\calls::class)803 ->hasSize(1)804 ->array($afterCalls->toArray())805 ->isEqualTo([2 => $call2])806 ->object($calls->getAfterEqualTo($call2, 2))807 ->isInstanceOf(atoum\test\adapter\calls::class)808 ->hasSize(0)809 ->object($afterCalls = $calls->getAfterEqualTo($call3, 1))810 ->isInstanceOf(atoum\test\adapter\calls::class)811 ->hasSize(2)812 ->array($afterCalls->toArray())813 ->isEqualTo([3 => $call3, 4 => $call4])814 ->object($afterCalls = $calls->getAfterEqualTo($call3, 3))815 ->isInstanceOf(atoum\test\adapter\calls::class)816 ->hasSize(1)817 ->array($afterCalls->toArray())818 ->isEqualTo([4 => $call4])819 ->object($afterCalls = $calls->getAfterEqualTo($call4, 1))820 ->isInstanceOf(atoum\test\adapter\calls::class)821 ->hasSize(2)822 ->array($afterCalls->toArray())823 ->isEqualTo([3 => $call3, 4 => $call4])824 ;825 }826 public function testGetAfterIdenticalTo()827 {828 $this829 ->if($calls = new testedClass())830 ->then831 ->object($calls->getAfterIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))832 ->isInstanceOf(atoum\test\adapter\calls::class)833 ->hasSize(0)834 ->if($calls[] = $call1 = new adapter\call(uniqid()))835 ->then836 ->object($calls->getAfterIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))837 ->isInstanceOf(atoum\test\adapter\calls::class)838 ->hasSize(0)839 ->object($calls->getAfterIdenticalTo(new adapter\call($call1), 0))840 ->isInstanceOf(atoum\test\adapter\calls::class)841 ->hasSize(0)842 ->object($calls->getAfterIdenticalTo(new adapter\call($call1), 1))843 ->isInstanceOf(atoum\test\adapter\calls::class)844 ->hasSize(0)845 ->object($calls->getAfterIdenticalTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))846 ->isInstanceOf(atoum\test\adapter\calls::class)847 ->hasSize(0)848 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))849 ->then850 ->object($calls->getAfterIdenticalTo(new adapter\call(uniqid()), 1))851 ->isInstanceOf(atoum\test\adapter\calls::class)852 ->hasSize(0)853 ->object($calls->getAfterIdenticalTo($call1, 1))854 ->isInstanceOf(atoum\test\adapter\calls::class)855 ->hasSize(0)856 ->object($calls->getAfterIdenticalTo($call1, 2))857 ->isInstanceOf(atoum\test\adapter\calls::class)858 ->hasSize(0)859 ->object($afterCalls = $calls->getAfterIdenticalTo($call2, 1))860 ->isInstanceOf(atoum\test\adapter\calls::class)861 ->hasSize(1)862 ->array($afterCalls->toArray())863 ->isIdenticalTo([2 => $call2])864 ->object($calls->getAfterIdenticalTo($call2, 2))865 ->isInstanceOf(atoum\test\adapter\calls::class)866 ->hasSize(0)867 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))868 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))869 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))870 ->then871 ->object($calls->getAfterIdenticalTo(new adapter\call(uniqid()), 1))872 ->isInstanceOf(atoum\test\adapter\calls::class)873 ->hasSize(0)874 ->object($calls->getAfterIdenticalTo($call1, 1))875 ->isInstanceOf(atoum\test\adapter\calls::class)876 ->hasSize(0)877 ->object($calls->getAfterIdenticalTo($call1, 2))878 ->isInstanceOf(atoum\test\adapter\calls::class)879 ->hasSize(0)880 ->object($afterCalls = $calls->getAfterIdenticalTo($call2, 1))881 ->isInstanceOf(atoum\test\adapter\calls::class)882 ->hasSize(1)883 ->array($afterCalls->toArray())884 ->isIdenticalTo([2 => $call2])885 ->object($calls->getAfterIdenticalTo($call2, 2))886 ->isInstanceOf(atoum\test\adapter\calls::class)887 ->hasSize(0)888 ->object($afterCalls = $calls->getAfterIdenticalTo($call3, 1))889 ->isInstanceOf(atoum\test\adapter\calls::class)890 ->hasSize(1)891 ->array($afterCalls->toArray())892 ->isIdenticalTo([3 => $call3])893 ->object($afterCalls = $calls->getAfterIdenticalTo($call3, 3))894 ->isInstanceOf(atoum\test\adapter\calls::class)895 ->hasSize(0)896 ->object($afterCalls = $calls->getAfterIdenticalTo($call4, 1))897 ->isInstanceOf(atoum\test\adapter\calls::class)898 ->hasSize(1)899 ->array($afterCalls->toArray())900 ->isIdenticalTo([4 => $call4])901 ;902 }903 public function testGetAfter()904 {905 $this906 ->if($calls = new mockedTestedClass())907 ->then908 ->object($calls->getAfter($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX)))909 ->isInstanceOf(atoum\test\adapter\calls::class)910 ->mock($calls)->call('getAfterEqualTo')->withArguments($call, $position)->once()911 ->object($calls->getAfter($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX), true))912 ->isInstanceOf(atoum\test\adapter\calls::class)913 ->mock($calls)->call('getAfterIdenticalTo')->withArguments($call, $position)->once()914 ;915 }916 public function testHasAfterEqualTo()917 {918 $this919 ->if($calls = new testedClass())920 ->then921 ->boolean($calls->hasAfterEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()922 ->if($calls[] = $call1 = new adapter\call(uniqid()))923 ->then924 ->boolean($calls->hasAfterEqualTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()925 ->boolean($calls->hasAfterEqualTo(new adapter\call($call1), 0))->isFalse()926 ->boolean($calls->hasAfterEqualTo(new adapter\call($call1), 1))->isFalse()927 ->boolean($calls->hasAfterEqualTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))->isFalse()928 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))929 ->then930 ->boolean($calls->hasAfterEqualTo(new adapter\call(uniqid()), 1))->isFalse()931 ->boolean($calls->hasAfterEqualTo($call1, 1))->isFalse()932 ->boolean($calls->hasAfterEqualTo($call1, 2))->isFalse()933 ->boolean($afterCalls = $calls->hasAfterEqualTo($call2, 1))->isTrue()934 ->boolean($calls->hasAfterEqualTo($call2, 2))->isFalse()935 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))936 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))937 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))938 ->then939 ->boolean($calls->hasAfterEqualTo(new adapter\call(uniqid()), 1))->isFalse()940 ->boolean($calls->hasAfterEqualTo($call1, 1))->isFalse()941 ->boolean($calls->hasAfterEqualTo($call1, 2))->isFalse()942 ->boolean($afterCalls = $calls->hasAfterEqualTo($call2, 1))->isTrue()943 ->boolean($calls->hasAfterEqualTo($call2, 2))->isFalse()944 ->boolean($afterCalls = $calls->hasAfterEqualTo($call3, 1))->isTrue()945 ->boolean($afterCalls = $calls->hasAfterEqualTo($call3, 3))->isTrue()946 ->boolean($afterCalls = $calls->hasAfterEqualTo($call4, 1))->isTrue()947 ;948 }949 public function testHasAfterIdenticalTo()950 {951 $this952 ->if($calls = new testedClass())953 ->then954 ->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()955 ->if($calls[] = $call1 = new adapter\call(uniqid()))956 ->then957 ->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()958 ->boolean($calls->hasAfterIdenticalTo(new adapter\call($call1), 0))->isFalse()959 ->boolean($calls->hasAfterIdenticalTo(new adapter\call($call1), 1))->isFalse()960 ->boolean($calls->hasAfterIdenticalTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))->isFalse()961 ->if($calls[] = $call2 = new adapter\call(uniqid(), []))962 ->then963 ->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), 1))->isFalse()964 ->boolean($calls->hasAfterIdenticalTo($call1, 1))->isFalse()965 ->boolean($calls->hasAfterIdenticalTo($call1, 2))->isFalse()966 ->boolean($afterCalls = $calls->hasAfterIdenticalTo($call2, 1))->isTrue()967 ->boolean($calls->hasAfterIdenticalTo($call2, 2))->isFalse()968 ->if($calls[] = $call3 = new adapter\call(uniqid(), [$object = new \mock\phpObject()]))969 ->if($calls[] = $call4 = new adapter\call($call3->getFunction(), [clone $object]))970 ->and($calls[] = $call5 = new adapter\call(uniqid(), []))971 ->then972 ->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), 1))->isFalse()973 ->boolean($calls->hasAfterIdenticalTo($call1, 1))->isFalse()974 ->boolean($calls->hasAfterIdenticalTo($call1, 2))->isFalse()975 ->boolean($afterCalls = $calls->hasAfterIdenticalTo($call2, 1))->isTrue()976 ->boolean($calls->hasAfterIdenticalTo($call2, 2))->isFalse()977 ->boolean($afterCalls = $calls->hasAfterIdenticalTo($call3, 1))->isTrue()978 ->boolean($afterCalls = $calls->hasAfterIdenticalTo($call3, 3))->isFalse()979 ->boolean($afterCalls = $calls->hasAfterIdenticalTo($call4, 1))->isTrue()980 ;981 }982 public function testHasAfter()983 {984 $this985 ->if($calls = new mockedTestedClass())986 ->then987 ->boolean($calls->hasAfter($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX)))->isFalse()988 ->mock($calls)->call('hasAfterEqualTo')->withArguments($call, $position)->once()989 ->boolean($calls->hasAfter($call = new adapter\call(uniqid()), $position = rand(1, PHP_INT_MAX), true))->isFalse()990 ->mock($calls)->call('hasAfterIdenticalTo')->withArguments($call, $position)->once()991 ;992 }993 public function testGet()994 {995 $this996 ->if($calls = new testedClass())997 ->then998 ->object($calls->get(new adapter\call(uniqid())))999 ->isInstanceOf(atoum\test\adapter\calls::class)1000 ->hasSize(0)1001 ->if($calls[] = $call1 = new adapter\call(uniqid()))1002 ->then1003 ->object($calls->get(new adapter\call(uniqid())))1004 ->isInstanceOf(atoum\test\adapter\calls::class)1005 ->hasSize(0)1006 ->object($calls->get($call1))1007 ->isInstanceOf(atoum\test\adapter\calls::class)1008 ->hasSize(1)1009 ->array($calls->get($call1)->toArray())1010 ->isEqualTo([1 => $call1])1011 ->if($calls[] = $call2 = new adapter\call($call1->getFunction(), []))1012 ->then1013 ->object($calls->get(new adapter\call(uniqid())))1014 ->isInstanceOf(atoum\test\adapter\calls::class)1015 ->hasSize(0)1016 ->object($calls->get($call1))1017 ->isInstanceOf(atoum\test\adapter\calls::class)1018 ->hasSize(2)1019 ->array($calls->get($call1)->toArray())1020 ->isEqualTo([1 => $call1, 2 => $call2])1021 ->object($calls->get($call2))1022 ->isInstanceOf(atoum\test\adapter\calls::class)1023 ->hasSize(1)1024 ->array($calls->get($call2)->toArray())1025 ->isEqualTo([2 => $call2])1026 ->if($calls[] = $call3 = new adapter\call($call1->getFunction(), [$object = new \mock\phpObject()]))1027 ->then1028 ->object($calls->get(new adapter\call(uniqid())))1029 ->isInstanceOf(atoum\test\adapter\calls::class)1030 ->hasSize(0)1031 ->object($calls->get($call1))1032 ->isInstanceOf(atoum\test\adapter\calls::class)1033 ->hasSize(3)1034 ->array($calls->get($call1)->toArray())1035 ->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3])1036 ->object($calls->get($call2))1037 ->isInstanceOf(atoum\test\adapter\calls::class)1038 ->hasSize(1)1039 ->array($calls->get($call2)->toArray())1040 ->isEqualTo([2 => $call2])1041 ->object($calls->get($call3))1042 ->isInstanceOf(atoum\test\adapter\calls::class)1043 ->hasSize(1)1044 ->array($calls->get($call3)->toArray())1045 ->isEqualTo([3 => $call3])1046 ->if($calls[] = $call4 = new adapter\call($call1->getFunction(), [$object = new \mock\phpObject(), $arg = uniqid()]))1047 ->then1048 ->object($calls->get(new adapter\call(uniqid())))1049 ->isInstanceOf(atoum\test\adapter\calls::class)1050 ->hasSize(0)1051 ->object($calls->get($call1))1052 ->isInstanceOf(atoum\test\adapter\calls::class)1053 ->hasSize(4)1054 ->array($calls->get($call1)->toArray())1055 ->isEqualTo([1 => $call1, 2 => $call2, 3 => $call3, 4 => $call4])1056 ->object($calls->get($call2))1057 ->isInstanceOf(atoum\test\adapter\calls::class)1058 ->hasSize(1)1059 ->array($calls->get($call2)->toArray())1060 ->isEqualTo([2 => $call2])1061 ->object($calls->get($call3))1062 ->isInstanceOf(atoum\test\adapter\calls::class)1063 ->hasSize(2)1064 ->array($calls->get($call3)->toArray())1065 ->isEqualTo([3 => $call3, 4 => $call4])1066 ->object($calls->get(new adapter\call($call1->getFunction(), [clone $object])))1067 ->isInstanceOf(atoum\test\adapter\calls::class)1068 ->hasSize(2)1069 ->array($calls->get($call3)->toArray())1070 ->isEqualTo([3 => $call3, 4 => $call4])1071 ->object($calls->get($call4))1072 ->isInstanceOf(atoum\test\adapter\calls::class)1073 ->hasSize(1)1074 ->array($calls->get($call4)->toArray())1075 ->isEqualTo([4 => $call4])1076 ->object($calls->get(new adapter\call($call1->getFunction(), [clone $object, $arg])))1077 ->isInstanceOf(atoum\test\adapter\calls::class)1078 ->hasSize(1)1079 ->array($calls->get($call4)->toArray())1080 ->isEqualTo([4 => $call4])1081 ->if($calls = new testedClass())1082 ->then1083 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))1084 ->isInstanceOf(atoum\test\adapter\calls::class)1085 ->hasSize(0)1086 ->if($calls[] = $call5 = new adapter\call(uniqid()))1087 ->then1088 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))1089 ->isInstanceOf(atoum\test\adapter\calls::class)1090 ->hasSize(0)1091 ->object($calls->getIdenticalTo($call5))1092 ->isInstanceOf(atoum\test\adapter\calls::class)1093 ->hasSize(1)1094 ->array($calls->getIdenticalTo($call5)->toArray())1095 ->isEqualTo([5 => $call5])1096 ->if($calls[] = $call6 = new adapter\call($call5->getFunction(), []))1097 ->then1098 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))1099 ->isInstanceOf(atoum\test\adapter\calls::class)1100 ->hasSize(0)1101 ->object($calls->getIdenticalTo($call5))1102 ->isInstanceOf(atoum\test\adapter\calls::class)1103 ->hasSize(2)1104 ->array($calls->getIdenticalTo($call5)->toArray())1105 ->isEqualTo([5 => $call5, 6 => $call6])1106 ->object($calls->getIdenticalTo($call6))1107 ->isInstanceOf(atoum\test\adapter\calls::class)1108 ->hasSize(1)1109 ->array($calls->getIdenticalTo($call6)->toArray())1110 ->isEqualTo([6 => $call6])1111 ->if($calls[] = $call7 = new adapter\call($call5->getFunction(), [$object = new \mock\phpObject()]))1112 ->then1113 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))1114 ->isInstanceOf(atoum\test\adapter\calls::class)1115 ->hasSize(0)1116 ->object($calls->getIdenticalTo($call5))1117 ->isInstanceOf(atoum\test\adapter\calls::class)1118 ->hasSize(3)1119 ->array($calls->getIdenticalTo($call5)->toArray())1120 ->isEqualTo([5 => $call5, 6 => $call6, 7 => $call7])1121 ->object($calls->getIdenticalTo($call6))1122 ->isInstanceOf(atoum\test\adapter\calls::class)1123 ->hasSize(1)1124 ->array($calls->getIdenticalTo($call6)->toArray())1125 ->isEqualTo([6 => $call6])1126 ->object($calls->getIdenticalTo($call7))1127 ->isInstanceOf(atoum\test\adapter\calls::class)1128 ->hasSize(1)1129 ->array($calls->getIdenticalTo($call7)->toArray())1130 ->isEqualTo([7 => $call7])1131 ->object($calls->getIdenticalTo(new adapter\call($call5->getFunction(), [clone $object])))1132 ->isInstanceOf(atoum\test\adapter\calls::class)1133 ->hasSize(0)1134 ->if($calls[] = $call8 = new adapter\call($call5->getFunction(), [$object = new \mock\phpObject(), $arg = uniqid()]))1135 ->then1136 ->object($calls->getIdenticalTo(new adapter\call(uniqid())))1137 ->isInstanceOf(atoum\test\adapter\calls::class)1138 ->hasSize(0)1139 ->object($calls->getIdenticalTo($call5))1140 ->isInstanceOf(atoum\test\adapter\calls::class)1141 ->hasSize(4)1142 ->array($calls->getIdenticalTo($call5)->toArray())1143 ->isEqualTo([5 => $call5, 6 => $call6, 7 => $call7, 8 => $call8])1144 ->object($calls->getIdenticalTo($call6))1145 ->isInstanceOf(atoum\test\adapter\calls::class)1146 ->hasSize(1)1147 ->array($calls->getIdenticalTo($call6)->toArray())1148 ->isEqualTo([6 => $call6])1149 ->object($calls->getIdenticalTo($call7))1150 ->isInstanceOf(atoum\test\adapter\calls::class)1151 ->hasSize(1)1152 ->array($calls->getIdenticalTo($call7)->toArray())1153 ->isEqualTo([7 => $call7])1154 ->object($calls->getIdenticalTo(new adapter\call($call5->getFunction(), [clone $object])))1155 ->isInstanceOf(atoum\test\adapter\calls::class)1156 ->hasSize(0)1157 ->object($calls->getIdenticalTo($call8))1158 ->isInstanceOf(atoum\test\adapter\calls::class)1159 ->hasSize(1)1160 ->array($calls->getIdenticalTo($call8)->toArray())1161 ->isEqualTo([8 => $call8])1162 ->object($calls->getIdenticalTo(new adapter\call($call1->getFunction(), [clone $object, $arg])))1163 ->isInstanceOf(atoum\test\adapter\calls::class)1164 ->hasSize(0)1165 ;1166 }1167 public function testGetTimeline()1168 {1169 $this1170 ->if($calls = new testedClass())1171 ->then1172 ->array($calls->getTimeline())->isEmpty()1173 ->if($calls[] = $call1 = new adapter\call(uniqid()))1174 ->then...
PhpObjectTest.php
Source:PhpObjectTest.php
...42 ['foo' => 'hello', 'bar' => 61,],43 ['foo' => 'world', 'bar' => 6616111,],44 ],45 ],46 $demo->fromJson($foobarString)->toArray(false)47 );48 }49 public function testGenerator()50 {51 $jsonString = <<<HH52{53 "foo_bar": {54 "foo": 1.3,55 "bar": [56 6100,57 610058 ]59 },60 "f_oo_bars": [...
toArray
Using AI Code Generation
1$obj = new phpObject();2$obj->name = "Rajesh";3$obj->age = 24;4$obj->country = "India";5print_r($obj->toArray());6$obj = new phpObject();7$obj->name = "Rajesh";8$obj->age = 24;9$obj->country = "India";10print_r($obj->toJson());11{"name":"Rajesh","age":24,"country":"India"}12$obj = new phpObject();13$obj->name = "Rajesh";14$obj->age = 24;15$obj->country = "India";16print_r($obj->toXml());17$obj = new phpObject();18$obj->name = "Rajesh";19$obj->age = 24;20$obj->country = "India";21print_r($obj->toCsv());22$obj = new phpObject();23$obj->name = "Rajesh";24$obj->age = 24;25$obj->country = "India";26print_r($obj->toJson());27{"name":"Rajesh","age":24,"country":"India"}28$obj = new phpObject();29$obj->name = "Rajesh";30$obj->age = 24;31$obj->country = "India";32print_r($obj->toYaml());33$obj = new phpObject();34$obj->name = "Rajesh";
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 toArray 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!!