How to use toArray method of calls class

Best Atoum code snippet using calls.toArray

calls.php

Source:calls.php Github

copy

Full Screen

...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...

Full Screen

Full Screen

WheresTheTest.php

Source:WheresTheTest.php Github

copy

Full Screen

...59 }60 public function testWhereIdWithNoOperator()61 {62 $u = User::where('id', $this->ab->id)->first();63 $this->assertEquals($this->ab->toArray(), $u->toArray());64 }65 public function testWhereIdSelectingProperties()66 {67 $u = User::where('id', $this->ab->id)->first(['id', 'name', 'email']);68 $this->assertEquals($this->ab->id, $u->id);69 $this->assertEquals($this->ab->name, $u->name);70 $this->assertEquals($this->ab->email, $u->email);71 }72 public function testWhereIdWithEqualsOperator()73 {74 $u = User::where('id', '=', $this->cd->id)->first();75 $this->assertEquals($this->cd->toArray(), $u->toArray());76 }77 public function testWherePropertyWithoutOperator()78 {79 $u = User::where('alias', 'ab')->first();80 $this->assertEquals($this->ab->toArray(), $u->toArray());81 }82 public function testWherePropertyEqualsOperator()83 {84 $u = User::where('alias', '=', 'ab')->first();85 $this->assertEquals($this->ab->toArray(), $u->toArray());86 }87 public function testWhereGreaterThanOperator()88 {89 $u = User::where('calls', '>', 10)->first();90 $this->assertEquals($this->cd->toArray(), $u->toArray());91 $others = User::where('calls', '>', 10)->get();92 $this->assertCount(4, $others);93 $brothers = new Collection(array(94 $this->cd,95 $this->ef,96 $this->gh,97 $this->ij, ));98 $this->assertEquals($others->toArray(), $brothers->toArray());99 $lastTwo = User::where('calls', '>=', 40)->get();100 $this->assertCount(2, $lastTwo);101 $mothers = new Collection(array($this->gh, $this->ij));102 $this->assertEquals($lastTwo->toArray(), $mothers->toArray());103 $none = User::where('calls', '>', 9000)->get();104 $this->assertCount(0, $none);105 }106 public function testWhereLessThanOperator()107 {108 $u = User::where('calls', '<', 10)->get();109 $this->assertCount(0, $u);110 $ab = User::where('calls', '<', 20)->first();111 $this->assertEquals($this->ab->toArray(), $ab->toArray());112 $three = User::where('calls', '<=', 30)->get();113 $this->assertCount(3, $three);114 $cocoa = new Collection(array($this->ab,115 $this->cd,116 $this->ef, ));117 $this->assertEquals($cocoa->toArray(), $three->toArray());118 $below = User::where('calls', '<', -100)->get();119 $this->assertCount(0, $below);120 $nil = User::where('calls', '<=', 0)->first();121 $this->assertNull($nil);122 }123 public function testWhereDifferentThanOperator()124 {125 $notab = User::where('alias', '<>', 'ab')->get();126 $dudes = new Collection(array(127 $this->cd,128 $this->ef,129 $this->gh,130 $this->ij, ));131 $this->assertCount(4, $notab);132 $this->assertEquals($notab->toArray(), $dudes->toArray());133 }134 public function testWhereIn()135 {136 $alpha = User::whereIn('alias', ['ab', 'cd', 'ef', 'gh', 'ij'])->get();137 $crocodile = new Collection(array($this->ab,138 $this->cd,139 $this->ef,140 $this->gh,141 $this->ij, ));142 $this->assertEquals($alpha->toArray(), $crocodile->toArray());143 }144 public function testWhereNotNull()145 {146 $alpha = User::whereNotNull('alias')->get();147 $crocodile = new Collection(array($this->ab,148 $this->cd,149 $this->ef,150 $this->gh,151 $this->ij, ));152 $this->assertEquals($alpha->toArray(), $crocodile->toArray());153 }154 public function testWhereNull()155 {156 $u = User::whereNull('calls')->get();157 $this->assertCount(0, $u);158 }159 public function testWhereNotIn()160 {161 /*162 * There is no WHERE NOT IN [ids] in Neo4j, it should be something like this:163 *164 * MATCH (actor:Actor {name:"Tom Hanks"} )-[:ACTED_IN]->(movies)<-[:ACTED_IN]-(coactor)165 * WITH collect(distinct coactor) as coactors166 * MATCH (actor:Actor)167 * WHERE actor NOT IN coactors168 * RETURN actor169 */170 $u = User::whereNotIn('alias', ['ab', 'cd', 'ef'])->get();171 $still = new Collection(array($this->gh, $this->ij));172 $rest = [$this->gh->toArray(), $this->ij->toArray()];173 $this->assertCount(2, $u);174 $this->assertEquals($rest, $still->toArray());175 }176 public function testWhereBetween()177 {178 /*179 * There is no WHERE BETWEEN180 */181 $this->markTestIncomplete();182 $u = User::whereBetween('id', [$this->ab->id, $this->ij->id])->get();183 $mwahaha = new Collection(array($this->ab,184 $this->cd,185 $this->ef,186 $this->gh,187 $this->ij, ));188 $this->assertCount(5, $u);189 $this->assertEquals($buddies->toArray(), $mwahaha->toArray());190 }191 public function testOrWhere()192 {193 $buddies = User::where('name', 'Ey Bee')194 ->orWhere('alias', 'cd')195 ->orWhere('email', 'ef@alpha.bet')196 ->orWhere('id', $this->gh->id)197 ->orWhere('calls', '>', 40)198 ->get();199 $this->assertCount(5, $buddies);200 $bigBrothers = new Collection(array($this->ab,201 $this->cd,202 $this->ef,203 $this->gh,204 $this->ij, ));205 $this->assertEquals($buddies->toArray(), $bigBrothers->toArray());206 }207 public function testOrWhereIn()208 {209 $all = User::whereIn('id', [$this->ab->id, $this->cd->id])210 ->orWhereIn('alias', ['ef', 'gh', 'ij'])->get();211 $padrougas = new Collection(array($this->ab,212 $this->cd,213 $this->ef,214 $this->gh,215 $this->ij, ));216 $array = $all->toArray();217 usort($array, static fn (array $x, array $y) => $x['id'] <=> $y['id']);218 $padrougasArray = $padrougas->toArray();219 usort($padrougasArray, static fn (array $x, array $y) => $x['id'] <=> $y['id']);220 $this->assertEquals($array, $padrougasArray);221 }222 public function testWhereNotFound()223 {224 $u = User::where('id', '<', 1)->get();225 $this->assertCount(0, $u);226 $u2 = User::where('glasses', 'always on')->first();227 $this->assertNull($u2);228 }229 /**230 * Regression test for issue #19.231 *232 * @see https://github.com/Vinelab/NeoEloquent/issues/19233 */234 public function testWhereMultipleValuesForSameColumn()235 {236 $u = User::where('alias', '=', 'ab')->orWhere('alias', '=', 'cd')->get();237 $this->assertCount(2, $u);238 $this->assertEquals('ab', $u[0]->alias);239 $this->assertEquals('cd', $u[1]->alias);240 }241 /**242 * Regression test for issue #41.243 *244 * @see https://github.com/Vinelab/NeoEloquent/issues/41245 */246 public function testWhereWithIn()247 {248 $ab = User::where('alias', 'IN', ['ab'])->first();249 $this->assertEquals($this->ab->toArray(), $ab->toArray());250 $users = User::where('alias', 'IN', ['cd', 'ef'])->get();251 $l = (new User())->getConnection()->getQueryLog();252 $this->assertEquals($this->cd->toArray(), $users[0]->toArray());253 $this->assertEquals($this->ef->toArray(), $users[1]->toArray());254 }255}...

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

1$call = new Calls();2$call->toArray();3$call = new Calls();4$call->toArray();5$call = new Calls();6$call->toArray();7$call = new Calls();8$call->toArray();9$call = new Calls();10$call->toArray();11$call = new Calls();12$call->toArray();13$call = new Calls();14$call->toArray();15$call = new Calls();16$call->toArray();17$call = new Calls();18$call->toArray();19$call = new Calls();20$call->toArray();21$call = new Calls();22$call->toArray();23$call = new Calls();24$call->toArray();25$call = new Calls();26$call->toArray();27$call = new Calls();28$call->toArray();29$call = new Calls();30$call->toArray();31$call = new Calls();32$call->toArray();33$call = new Calls();34$call->toArray();35$call = new Calls();36$call->toArray();

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

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

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

1$call = new Calls();2$call->toArray();3$call = new Calls();4$call->toArray();5$call = new Calls();6$call->toArray();7$call = new Calls();8$call->toArray();9$call = new Calls();10$call->toArray();11$call = new Calls();12$call->toArray();13$call = new Calls();14$call->toArray();15$call = new Calls();16$call->toArray();17$call = new Calls();18$call->toArray();19$call = new Calls();20$call->toArray();21$call = new Calls();22$call->toArray();23$call = new Calls();24$call->toArray();25$call = new Calls();26$call->toArray();

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

1$calls = new Calls();2$calls->toArray();3$calls = new Calls();4$calls->toArray();5include_once("calls.php");6$calls = new Calls();7$calls->toArray();8$calls = new Calls();9$calls->toArray();

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

1$call = new Calls();2$call->call_id = '123';3$call->name = 'test';4$call->toArray();5$call = new Calls();6$call->call_id = '123';7$call->name = 'test';8$call->toArray();9$call = new Calls();10$call->call_id = '123';11$call->name = 'test';12$call->toArray();13$call = new Calls();14$call->call_id = '123';15$call->name = 'test';16$call->toArray();17$call = new Calls();18$call->call_id = '123';19$call->name = 'test';20$call->toArray();21$call = new Calls();22$call->call_id = '123';23$call->name = 'test';24$call->toArray();25$call = new Calls();26$call->call_id = '123';27$call->name = 'test';28$call->toArray();29$call = new Calls();30$call->call_id = '123';31$call->name = 'test';32$call->toArray();33$call = new Calls();34$call->call_id = '123';35$call->name = 'test';36$call->toArray();37$call = new Calls();38$call->call_id = '123';39$call->name = 'test';40$call->toArray();

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

1$calls = new Calls();2$call_arr = $calls->toArray();3foreach($call_arr as $call){4 echo $call->id;5}6$calls = new Calls();7$call_arr = $calls->toArray();8foreach($call_arr as $call){9 echo $call->id;10}11$calls = new Calls();12$call_arr = $calls->toArray();13foreach($call_arr as $call){14 echo $call->id;15}16$calls = new Calls();17$call_arr = $calls->toArray();18foreach($call_arr as $call){19 echo $call->id;20}21$calls = new Calls();22$call_arr = $calls->toArray();23foreach($call_arr as $call){24 echo $call->id;25}26$calls = new Calls();27$call_arr = $calls->toArray();28foreach($call_arr as $call){29 echo $call->id;30}31$calls = new Calls();32$call_arr = $calls->toArray();33foreach($call_arr as $call){34 echo $call->id;35}36$calls = new Calls();37$call_arr = $calls->toArray();38foreach($call_arr as $call){39 echo $call->id;40}41$calls = new Calls();42$call_arr = $calls->toArray();43foreach($call_arr as $call){44 echo $call->id;45}

Full Screen

Full Screen

toArray

Using AI Code Generation

copy

Full Screen

1$call = new Calls();2$call->setCallId(1);3$call->setCallType("Incoming");4$call->setCallTime("2013-05-09 11:30:00");5$call->setCallDuration(10);6$call->setCallCost(1.5);7$call->setCallStatus("answered");8$call->setCallSource(1);9$call->setCallDestination(2);10$call->setCallRecordPath("C:\xampp\htdocs\1.wav");11$call->setCallNotes("Notes");12$call->setCallTags("Tags");13$call->setCallUser(1);14$call->setCallDate("2013-05-09");15$call->setCallContactId(1);16$call->setCallContactName("John Doe");17$call->setCallContactNumber("111-222-3333");18$call->setCallContactEmail("

Full Screen

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful