How to use setWith method of phpArray class

Best Atoum code snippet using phpArray.setWith

phpArray.php

Source:phpArray.php Github

copy

Full Screen

...49 ->object($this->testedInstance->getInnerAsserter())->isEqualTo($generator->phpString)50 ->object($this->testedInstance->error)->isInstanceOf($generator->error)51 ->variable($this->testedInstance->getInnerAsserter())->isNull()52 ->if(53 $this->testedInstance->setWith(54 [55 0 => [56 0 => [57 1 => ['foo', 'bar']58 ],59 1 => [1, new \mock\phpObject()]60 ],61 1 => 'foobar'62 ]63 )64 )65 ->then66 ->object($this->testedInstance->phpArray[0][0][1]->isEqualTo(['foo', 'bar']))->isTestedInstance67 ->object($this->testedInstance->phpString[1]->isEqualTo('foobar'))->isTestedInstance68 ->given($this->newTestedInstance->setWith([$array1 = ['foo', 'bar'], $array2 = [1, new \mock\phpObject()]]))69 ->then70 ->object($this->testedInstance->phpArray[0]->phpString[0]->isEqualTo('foo'))->isInstanceOf(atoum\asserters\phpArray::class)71 ->object($this->testedInstance->phpArray[1]->isEqualTo($array2))->isInstanceOf(atoum\asserters\phpArray::class)72 ;73 }74 public function testReset()75 {76 $this77 ->given($this->newTestedInstance)78 ->then79 ->object($this->testedInstance->reset())->isTestedInstance80 ->variable($this->testedInstance->getValue())->isNull()81 ->boolean($this->testedInstance->wasSet())->isFalse()82 ->boolean($this->testedInstance->isSetByReference())->isFalse()83 ->variable($this->testedInstance->getKey())->isNull()84 ->variable($this->testedInstance->getInnerAsserter())->isNull()85 ->variable($this->testedInstance->getInnerValue())->isNull()86 ->if($this->testedInstance->setWith([]))87 ->then88 ->object($this->testedInstance->reset())->isTestedInstance89 ->variable($this->testedInstance->getValue())->isNull()90 ->boolean($this->testedInstance->wasSet())->isFalse()91 ->boolean($this->testedInstance->isSetByReference())->isFalse()92 ->variable($this->testedInstance->getKey())->isNull()93 ->variable($this->testedInstance->getInnerAsserter())->isNull()94 ->variable($this->testedInstance->getInnerValue())->isNull()95 ->if(96 $reference = range(1, 5),97 $this->testedInstance->setByReferenceWith($reference)98 )99 ->then100 ->object($this->testedInstance->reset())->isTestedInstance101 ->variable($this->testedInstance->getValue())->isNull()102 ->boolean($this->testedInstance->wasSet())->isFalse()103 ->boolean($this->testedInstance->isSetByReference())->isFalse()104 ->variable($this->testedInstance->getKey())->isNull()105 ->variable($this->testedInstance->getInnerAsserter())->isNull()106 ->variable($this->testedInstance->getInnerValue())->isNull()107 ->if($this->testedInstance->object)108 ->then109 ->object($this->testedInstance->reset())->isTestedInstance110 ->variable($this->testedInstance->getValue())->isNull()111 ->boolean($this->testedInstance->wasSet())->isFalse()112 ->boolean($this->testedInstance->isSetByReference())->isFalse()113 ->variable($this->testedInstance->getKey())->isNull()114 ->variable($this->testedInstance->getInnerAsserter())->isNull()115 ->variable($this->testedInstance->getInnerValue())->isNull()116 ->if(117 $this->testedInstance->setWith(range(1, 5)),118 $this->testedInstance->atKey(2)119 )120 ->then121 ->object($this->testedInstance->reset())->isTestedInstance122 ->variable($this->testedInstance->getValue())->isNull()123 ->boolean($this->testedInstance->wasSet())->isFalse()124 ->boolean($this->testedInstance->isSetByReference())->isFalse()125 ->variable($this->testedInstance->getKey())->isNull()126 ->variable($this->testedInstance->getInnerAsserter())->isNull()127 ->variable($this->testedInstance->getInnerValue())->isNull()128 ;129 }130 public function testSetWith()131 {132 $this133 ->given(134 $asserter = $this->newTestedInstance135 ->setLocale($locale = new \mock\atoum\locale())136 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())137 )138 ->if(139 $this->calling($locale)->_ = $notAnArray = uniqid(),140 $this->calling($analyzer)->getTypeOf = $type = uniqid()141 )142 ->then143 ->exception(function () use ($asserter, & $value) {144 $asserter->setWith($value = uniqid());145 })146 ->isInstanceOf(atoum\asserter\exception::class)147 ->hasMessage($notAnArray)148 ->mock($locale)->call('_')->withArguments('%s is not an array', $type)->once149 ->object($asserter->setWith($value = []))->isIdenticalTo($asserter)150 ->array($asserter->getValue())->isEqualTo($value)151 ->variable($asserter->getKey())->isNull()152 ->variable($asserter->getInnerAsserter())->isNull()153 ->variable($asserter->getInnerValue())->isNull()154 ->boolean($asserter->isSetByReference())->isFalse()155 ->if($asserter->object)156 ->then157 ->variable($innerAsserter = $asserter->getInnerAsserter())->isNotNull()158 ->object($objectAsserter = $asserter->setWith($object = new \mock\phpObject()))->isIdenticalTo($innerAsserter)159 ->object($objectAsserter->getValue())->isIdenticalTo($object)160 ->variable($asserter->getValue())->isNull()161 ->boolean($asserter->wasSet())->isFalse()162 ->boolean($asserter->isSetByReference())->isFalse()163 ->variable($asserter->getKey())->isNull()164 ->variable($asserter->getInnerAsserter())->isNull()165 ->variable($asserter->getInnerValue())->isNull()166 ;167 }168 public function testOffsetGet()169 {170 $this171 ->given(172 $asserter = $this->newTestedInstance173 ->setLocale($locale = new \mock\atoum\locale())174 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())175 )176 ->then177 ->exception(function () use ($asserter) {178 $asserter[2];179 })180 ->isInstanceOf(atoum\exceptions\logic::class)181 ->hasMessage('Array is undefined')182 ->if(183 $this->calling($locale)->_ = $notAnArray = uniqid(),184 $this->calling($analyzer)->getTypeOf = $type = uniqid(),185 $asserter->setWith([1, 2, $object = new \mock\phpObject(), clone $object])186 )187 ->then188 ->exception(function () use ($asserter, & $value) {189 $asserter[2];190 })191 ->isInstanceOf(atoum\asserter\exception::class)192 ->hasMessage($notAnArray)193 ->mock($locale)->call('_')->withArguments('Value %s at key %s is not an array', $type, 2)->once194 ->if($asserter->setWith([1, 2, $object = new \mock\phpObject(), clone $object]))195 ->then196 ->object($asserter->object[2]->isIdenticalTo($object))->isIdenticalTo($asserter)197 ->object($asserter->object[2]->isIdenticalTo($object))->isIdenticalTo($asserter)198 ->object($asserter->object[3]->isCloneOf($object))->isIdenticalTo($asserter)199 ->object($asserter->object[2])->isIdenticalTo($asserter)200 ->given(201 $asserter = $this->newTestedInstance202 ->setLocale($locale)203 ->setAnalyzer($analyzer)204 )205 ->if($asserter->setWith($array = [$integer = rand(1, PHP_INT_MAX), 2, $innerArray = [3, 4, 5, $object]]))206 ->then207 ->object($asserter[2])208 ->isIdenticalTo($asserter)209 ->array($asserter->getValue())->isEqualTo($innerArray)210 ->if($asserter->setWith($array))211 ->then212 ->object($asserter->integer[0]->isEqualTo($integer))->isIdenticalTo($asserter)213 ->object($asserter->object[2][3]->isIdenticalTo($object))->isIdenticalTo($asserter)214 ->object($asserter->object[2][3]->isIdenticalTo($object)->integer[0]->isEqualTo($integer))->isIdenticalTo($asserter)215 ->object($asserter->object[2][3]->isIdenticalTo($object)->integer($integer)->isEqualTo($integer))216 ->isNotIdenticalTo($asserter)217 ->isInstanceOf(atoum\asserters\integer::class)218 ->if(219 $this->calling($locale)->_ = $unknownKey = uniqid(),220 $this->calling($analyzer)->getTypeOf = function ($value) use ($innerArray, & $innerArrayType, & $keyType) {221 return ($innerArray === $value ? ($innerArrayType = uniqid()) : ($keyType = uniqid()));222 }223 )224 ->then225 ->exception(function () use ($asserter) {226 $asserter->object[2][4];227 })228 ->isInstanceOf(atoum\asserter\exception::class)229 ->hasMessage($unknownKey)230 ->mock($locale)->call('_')->withArguments('%s has no key %s', $innerArrayType, $keyType)->once231 ;232 }233 public function testOffsetSet()234 {235 $this236 ->given($asserter = $this->newTestedInstance)237 ->then238 ->exception(function () use ($asserter) {239 $asserter[rand(0, PHP_INT_MAX)] = rand(0, PHP_INT_MAX);240 })241 ->isInstanceOf(atoum\exceptions\logic::class)242 ->hasMessage('Tested array is read only')243 ;244 }245 public function testOffsetUnset()246 {247 $this248 ->given($asserter = $this->newTestedInstance)249 ->then250 ->exception(function () use ($asserter) {251 unset($asserter[rand(0, PHP_INT_MAX)]);252 })253 ->isInstanceOf(atoum\exceptions\logic::class)254 ->hasMessage('Array is read only')255 ;256 }257 public function testOffsetExists()258 {259 $this260 ->given($asserter = $this->newTestedInstance)261 ->then262 ->boolean(isset($asserter[rand(0, PHP_INT_MAX)]))->isFalse()263 ->if($asserter->setWith([]))264 ->then265 ->boolean(isset($asserter[rand(0, PHP_INT_MAX)]))->isFalse()266 ->if($asserter->setWith([uniqid()]))267 ->then268 ->boolean(isset($asserter[0]))->isTrue()269 ->boolean(isset($asserter[rand(1, PHP_INT_MAX)]))->isFalse()270 ->if($asserter->setWith([$key = uniqid() => uniqid()]))271 ->then272 ->boolean(isset($asserter[$key]))->isTrue()273 ->boolean(isset($asserter[0]))->isFalse()274 ->boolean(isset($asserter[rand(1, PHP_INT_MAX)]))->isFalse()275 ;276 }277 public function testHasSize()278 {279 $this280 ->given(281 $asserter = $this->newTestedInstance282 ->setLocale($locale = new \mock\atoum\locale())283 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())284 )285 ->then286 ->exception(function () use ($asserter) {287 $asserter->hasSize(rand(0, PHP_INT_MAX));288 })289 ->isInstanceOf(atoum\exceptions\logic::class)290 ->hasMessage('Array is undefined')291 ->if(292 $this->calling($locale)->_ = $badSize = uniqid(),293 $this->calling($analyzer)->getTypeOf = $type = uniqid(),294 $asserter->setWith([])295 )296 ->then297 ->exception(function () use ($asserter, & $size) {298 $asserter->hasSize($size = rand(1, PHP_INT_MAX));299 })300 ->isInstanceOf(atoum\asserter\exception::class)301 ->hasMessage($badSize)302 ->mock($locale)->call('_')->withArguments('%s has size %d, expected size %d', $asserter, 0, $size)->once303 ->exception(function () use ($asserter, & $failMessage) {304 $asserter->hasSize(rand(1, PHP_INT_MAX), $failMessage = uniqid());305 })306 ->isInstanceOf(atoum\asserter\exception::class)307 ->hasMessage($failMessage)308 ->object($asserter->hasSize(0))->isIdenticalTo($asserter)309 ->if($asserter->setWith(range(1, 5)))310 ->then311 ->object($asserter->hasSize(5))->isIdenticalTo($asserter)312 ;313 }314 public function testHasSizeOnInnerAsserter()315 {316 $this317 ->given($asserter = $this->newTestedInstance)318 ->then319 ->exception(function () use ($asserter) {320 $asserter->isEmpty();321 })322 ->isInstanceOf(atoum\exceptions\logic::class)323 ->hasMessage('Array is undefined')324 ->if($asserter->setWith([range(1, 5)]))325 ->then326 ->object($childAsserter = $asserter->child[0](function ($child) {327 $child->hasSize(5);328 }))->isInstanceOf(atoum\asserters\phpArray\child::class)329 ->object($childAsserter->hasSize(1))->isIdenticalTo($asserter)330 ->given($asserter = $this->newTestedInstance)331 ->if($asserter->setWith([[range(1, 5), range(1, 3)]]))332 ->then333 ->object($childAsserter = $asserter->child[0][1](function ($child) {334 $child->hasSize(3);335 }))->isInstanceOf(atoum\asserters\phpArray\child::class)336 ->object($childAsserter->hasSize(1))->isIdenticalTo($asserter)337 ;338 }339 public function testIsEmpty()340 {341 $this342 ->given(343 $asserter = $this->newTestedInstance344 ->setLocale($locale = new \mock\atoum\locale())345 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())346 )347 ->then348 ->exception(function () use ($asserter) {349 $asserter->isEmpty();350 })351 ->isInstanceOf(atoum\exceptions\logic::class)352 ->hasMessage('Array is undefined')353 ->if(354 $this->calling($locale)->_ = $notEmpty = uniqid(),355 $asserter->setWith([uniqid()])356 )357 ->then358 ->exception(function () use ($asserter) {359 $asserter->isEmpty();360 })361 ->isInstanceOf(atoum\asserter\exception::class)362 ->hasMessage($notEmpty)363 ->mock($locale)->call('_')->withArguments('%s is not empty', $asserter)->once364 ->exception(function () use ($asserter) {365 $asserter->isEmpty;366 })367 ->isInstanceOf(atoum\asserter\exception::class)368 ->hasMessage($notEmpty)369 ->mock($locale)->call('_')->withArguments('%s is not empty', $asserter)->twice370 ->exception(function () use ($asserter, & $failMessage) {371 $asserter->isEmpty($failMessage = uniqid());372 })373 ->isInstanceOf(atoum\asserter\exception::class)374 ->hasMessage($failMessage)375 ->if($asserter->setWith([]))376 ->then377 ->object($asserter->isEmpty())->isIdenticalTo($asserter)378 ;379 }380 public function testIsNotEmpty()381 {382 $this383 ->given(384 $asserter = $this->newTestedInstance385 ->setLocale($locale = new \mock\atoum\locale())386 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())387 )388 ->then389 ->exception(function () use ($asserter) {390 $asserter->isNotEmpty();391 })392 ->isInstanceOf(atoum\exceptions\logic::class)393 ->hasMessage('Array is undefined')394 ->if(395 $this->calling($locale)->_ = $isEmpty = uniqid(),396 $this->calling($analyzer)->getTypeOf = $type = uniqid(),397 $asserter->setWith([])398 )399 ->then400 ->exception(function () use ($asserter) {401 $asserter->isNotEmpty();402 })403 ->isInstanceOf(atoum\asserter\exception::class)404 ->hasMessage($isEmpty)405 ->mock($locale)->call('_')->withArguments('%s is empty', $asserter)->once406 ->exception(function () use ($asserter) {407 $asserter->isNotEmpty;408 })409 ->isInstanceOf(atoum\asserter\exception::class)410 ->hasMessage($isEmpty)411 ->mock($locale)->call('_')->withArguments('%s is empty', $asserter)->twice412 ->exception(function () use ($asserter, & $failMessage) {413 $asserter->isNotEmpty($failMessage = uniqid());414 })415 ->isInstanceOf(atoum\asserter\exception::class)416 ->hasMessage($failMessage)417 ->if($asserter->setWith([uniqid()]))418 ->then419 ->object($asserter->isNotEmpty())->isIdenticalTo($asserter)420 ;421 }422 public function testAtKey()423 {424 $this425 ->given(426 $asserter = $this->newTestedInstance427 ->setLocale($locale = new \mock\atoum\locale())428 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())429 )430 ->then431 ->exception(function () use ($asserter) {432 $asserter->atKey(uniqid());433 })434 ->isInstanceOf(atoum\exceptions\logic::class)435 ->hasMessage('Array is undefined')436 ->if($asserter->setWith([uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid()]))437 ->object($asserter->atKey(0))->isIdenticalTo($asserter)438 ->object($asserter->atKey('0'))->isIdenticalTo($asserter)439 ->object($asserter->atKey(1))->isIdenticalTo($asserter)440 ->object($asserter->atKey(2))->isIdenticalTo($asserter)441 ->object($asserter->atKey(3))->isIdenticalTo($asserter)442 ->object($asserter->atKey(4))->isIdenticalTo($asserter)443 ->if(444 $this->calling($locale)->_ = $unknownKey = uniqid(),445 $this->calling($analyzer)->getTypeOf = $type = uniqid()446 )447 ->then448 ->exception(function () use ($asserter, & $key) {449 $asserter->atKey($key = rand(5, PHP_INT_MAX));450 })451 ->isInstanceOf(atoum\asserter\exception::class)452 ->hasMessage($unknownKey)453 ->mock($locale)->call('_')->withArguments('%s has no key %s', $asserter, $type)->once454 ->mock($analyzer)->call('getTypeOf')->withArguments($key)->once455 ->exception(function () use ($asserter, & $failMessage) {456 $asserter->atKey(rand(5, PHP_INT_MAX), $failMessage = uniqid());457 })458 ->isInstanceOf(atoum\asserter\exception::class)459 ->hasMessage($failMessage)460 ;461 }462 public function testContains()463 {464 $this465 ->given(466 $asserter = $this->newTestedInstance467 ->setLocale($locale = new \mock\atoum\locale())468 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())469 )470 ->then471 ->exception(function () use ($asserter) {472 $asserter->contains(uniqid());473 })474 ->isInstanceOf(atoum\exceptions\logic::class)475 ->hasMessage('Array is undefined')476 ->if(477 $this->calling($locale)->_ = $notInArray = uniqid(),478 $this->calling($analyzer)->getTypeOf = $type = uniqid(),479 $asserter->setWith([uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid()])480 )481 ->then482 ->exception(function () use ($asserter, & $unknownValue) {483 $asserter->contains($unknownValue = uniqid());484 })485 ->isInstanceOf(atoum\asserter\exception::class)486 ->hasMessage($notInArray)487 ->mock($locale)->call('_')->withArguments('%s does not contain %s', $asserter, $type)->once488 ->mock($analyzer)->call('getTypeOf')->withArguments($unknownValue)->once489 ->exception(function () use ($asserter, & $failMessage) {490 $asserter->contains(uniqid(), $failMessage = uniqid());491 })492 ->isInstanceOf(atoum\asserter\exception::class)493 ->hasMessage($failMessage)494 ->object($asserter->contains($data))->isIdenticalTo($asserter)495 ->object($asserter->contains((string) $data))->isIdenticalTo($asserter)496 ->if(497 $this->calling($locale)->_ = $notInArrayAtKey = uniqid(),498 $this->calling($analyzer)->getTypeOf = $type = uniqid(),499 $asserter->setWith([uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid()])500 )501 ->then502 ->exception(function () use ($asserter, $data) {503 $asserter->atKey(0)->contains($data);504 })505 ->isInstanceOf(atoum\asserter\exception::class)506 ->hasMessage($notInArrayAtKey)507 ->object($asserter->contains($data))->isIdenticalTo($asserter)508 ->object($asserter->atKey(2)->contains($data))->isIdenticalTo($asserter)509 ->exception(function () use ($asserter, & $failMessage) {510 $asserter->atKey(0)->contains(uniqid(), $failMessage = uniqid());511 })512 ->isInstanceOf(atoum\asserter\exception::class)513 ->hasMessage($failMessage)514 ;515 }516 public function testStrictlyContains()517 {518 $this519 ->given(520 $asserter = $this->newTestedInstance521 ->setLocale($locale = new \mock\atoum\locale())522 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())523 )524 ->then525 ->exception(function () use ($asserter) {526 $asserter->strictlyContains(uniqid());527 })528 ->isInstanceOf(atoum\exceptions\logic::class)529 ->hasMessage('Array is undefined')530 ->if(531 $this->calling($locale)->_ = $notInArray = uniqid(),532 $this->calling($analyzer)->getTypeOf = $type = uniqid(),533 $asserter->setWith([1, 2, 3, 4, 5, '3'])534 )535 ->then536 ->exception(function () use ($asserter) {537 $asserter->strictlyContains('1');538 })539 ->isInstanceOf(atoum\asserter\exception::class)540 ->hasMessage($notInArray)541 ->mock($locale)->call('_')->withArguments('%s does not strictly contain %s', $asserter, $type)->once542 ->mock($analyzer)->call('getTypeOf')->withArguments('1')->once543 ->exception(function () use ($asserter, & $failMessage) {544 $asserter->strictlyContains('1', $failMessage = uniqid());545 })546 ->isInstanceOf(atoum\asserter\exception::class)547 ->hasMessage($failMessage)548 ->object($asserter->strictlyContains(1))->isIdenticalTo($asserter)549 ->if($this->calling($analyzer)->getTypeOf = function ($value) use (& $notInArrayType, & $keyType) {550 return ($value === 2 ? ($notInArrayType = uniqid()) : ($keyType = uniqid()));551 })552 ->then553 ->exception(function () use ($asserter) {554 $asserter->atKey(0)->strictlyContains(2);555 })556 ->isInstanceOf(atoum\asserter\exception::class)557 ->hasMessage($notInArray)558 ->mock($locale)->call('_')->withArguments('%s does not strictly contain %s at key %s', $asserter, $notInArrayType, $keyType)->once559 ->mock($analyzer)->call('getTypeOf')->withArguments(2)->once560 ->exception(function () use ($asserter, & $failMessage) {561 $asserter->atKey(0)->strictlyContains(2, $failMessage = uniqid());562 })563 ->isInstanceOf(atoum\asserter\exception::class)564 ->hasMessage($failMessage)565 ;566 }567 public function testNotContains()568 {569 $this570 ->given(571 $asserter = $this->newTestedInstance572 ->setLocale($locale = new \mock\atoum\locale())573 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())574 )575 ->then576 ->exception(function () use ($asserter) {577 $asserter->notContains(uniqid());578 })579 ->isInstanceOf(atoum\exceptions\logic::class)580 ->hasMessage('Array is undefined')581 ->if($asserter->setWith([uniqid(), uniqid(), $isInArray = uniqid(), uniqid(), uniqid()]))582 ->then583 ->object($asserter->notContains(uniqid()))->isIdenticalTo($asserter)584 ->if(585 $this->calling($locale)->_ = $inArray = uniqid(),586 $this->calling($analyzer)->getTypeOf = $type = uniqid()587 )588 ->then589 ->exception(function () use ($asserter, $isInArray) {590 $asserter->notContains($isInArray);591 })592 ->isInstanceOf(atoum\asserter\exception::class)593 ->hasMessage($inArray)594 ->mock($locale)->call('_')->withArguments('%s contains %s', $asserter, $type)->once595 ->mock($analyzer)->call('getTypeOf')->withArguments($isInArray)->once596 ->exception(function () use ($asserter, $isInArray, & $failMessage) {597 $asserter->notContains($isInArray, $failMessage = uniqid());598 })599 ->isInstanceOf(atoum\asserter\exception::class)600 ->hasMessage($failMessage)601 ->object($asserter->atKey(0)->notContains($inArray))->isIdenticalTo($asserter)602 ->object($asserter->atKey(1)->notContains($inArray))->isIdenticalTo($asserter)603 ->object($asserter->atKey(3)->notContains($inArray))->isIdenticalTo($asserter)604 ->object($asserter->atKey(4)->notContains($inArray))->isIdenticalTo($asserter)605 ->if(606 $this->calling($locale)->_ = $inArray = uniqid(),607 $this->calling($analyzer)->getTypeOf = function ($value) use ($isInArray, & $isInArrayType, & $keyType) {608 return ($isInArray === $value ? ($isInArrayType = uniqid()) : ($keyType = uniqid()));609 }610 )611 ->then612 ->exception(function () use ($asserter, $isInArray) {613 $asserter->atKey(2)->notContains($isInArray);614 })615 ->isInstanceOf(atoum\asserter\exception::class)616 ->hasMessage($inArray)617 ->mock($locale)->call('_')->withArguments('%s contains %s at key %s', $asserter, $isInArrayType, $keyType)->once618 ->mock($analyzer)619 ->call('getTypeOf')620 ->withArguments($isInArray)->twice621 ->withArguments(2)->once622 ->exception(function () use ($asserter, $isInArray, & $failMessage) {623 $asserter->atKey(2)->notContains($isInArray, $failMessage = 'FAIL');624 })625 ->isInstanceOf(atoum\asserter\exception::class)626 ->hasMessage($failMessage)627 ;628 }629 public function testStrictlyNotContains()630 {631 $this632 ->given(633 $asserter = $this->newTestedInstance634 ->setLocale($locale = new \mock\atoum\locale())635 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())636 )637 ->then638 ->exception(function () use ($asserter) {639 $asserter->strictlyNotContains(uniqid());640 })641 ->isInstanceOf(atoum\exceptions\logic::class)642 ->hasMessage('Array is undefined')643 ->if(644 $this->calling($locale)->_ = $strictlyNotInArray = uniqid(),645 $this->calling($analyzer)->getTypeOf = $type = uniqid(),646 $asserter->setWith([1, 2, 3, 4, 5, '6'])647 )648 ->then649 ->exception(function () use ($asserter) {650 $asserter->strictlyNotContains(1);651 })652 ->isInstanceOf(atoum\asserter\exception::class)653 ->hasMessage($strictlyNotInArray)654 ->mock($locale)->call('_')->withArguments('%s strictly contains %s', $asserter, $type)->once655 ->mock($analyzer)->call('getTypeOf')->withArguments(1)->once656 ->exception(function () use ($asserter, & $failMessage) {657 $asserter->strictlyNotContains(1, $failMessage = uniqid());658 })659 ->isInstanceOf(atoum\asserter\exception::class)660 ->hasMessage($failMessage)661 ->object($asserter->strictlyNotContains('1'))->isIdenticalTo($asserter)662 ->object($asserter->atKey(1)->strictlyNotContains(1))->isIdenticalTo($asserter)663 ->object($asserter->atKey(2)->strictlyNotContains(1))->isIdenticalTo($asserter)664 ->object($asserter->atKey(3)->strictlyNotContains(1))->isIdenticalTo($asserter)665 ->object($asserter->atKey(4)->strictlyNotContains(1))->isIdenticalTo($asserter)666 ->if($this->calling($analyzer)->getTypeOf = function ($value) use (& $strictlyNotInArrayType, & $keyType) {667 return ($value === 1 ? ($strictlyNotInArrayType = uniqid()) : ($keyType = uniqid()));668 })669 ->then670 ->exception(function () use ($asserter) {671 $asserter->atKey(0)->strictlyNotContains(1);672 })673 ->isInstanceOf(atoum\asserter\exception::class)674 ->hasMessage($strictlyNotInArray)675 ->mock($locale)->call('_')->withArguments('%s strictly contains %s at key %s', $asserter, $strictlyNotInArrayType, $keyType)->once676 ->mock($analyzer)->call('getTypeOf')->withArguments(0)->once677 ;678 }679 public function testContainsValues()680 {681 $this682 ->given(683 $asserter = $this->newTestedInstance684 ->setLocale($locale = new \mock\atoum\locale())685 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())686 )687 ->then688 ->exception(function () use ($asserter) {689 $asserter->containsValues([6]);690 })691 ->isInstanceOf(atoum\exceptions\logic::class)692 ->hasMessage('Array is undefined')693 ->if(694 $this->calling($locale)->_ = $notContainsValues = uniqid(),695 $this->calling($analyzer)->getTypeOf = $type = uniqid(),696 $asserter->setWith([1, 2, 3, 4, 5])697 )698 ->then699 ->exception(function () use ($asserter) {700 $asserter->containsValues([6]);701 })702 ->isInstanceOf(atoum\asserter\exception::class)703 ->hasMessage($notContainsValues)704 ->mock($locale)->call('_')->withArguments('%s does not contain values %s', $asserter, $type)->once705 ->mock($analyzer)->call('getTypeOf')->withArguments([6])->once706 ->exception(function () use ($asserter, & $failMessage) {707 $asserter->containsValues([6], $failMessage = uniqid());708 })709 ->isInstanceOf(atoum\asserter\exception::class)710 ->hasMessage($failMessage)711 ->object($asserter->containsValues([1]))->isIdenticalTo($asserter)712 ->object($asserter->containsValues(['1']))->isIdenticalTo($asserter)713 ->object($asserter->containsValues([1, 2, 4]))->isIdenticalTo($asserter)714 ->object($asserter->containsValues(['1', 2, '4']))->isIdenticalTo($asserter)715 ;716 }717 public function testStrictlyContainsValues()718 {719 $this720 ->given(721 $asserter = $this->newTestedInstance722 ->setLocale($locale = new \mock\atoum\locale())723 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())724 )725 ->then726 ->exception(function () use ($asserter) {727 $asserter->strictlyContainsValues([6]);728 })729 ->isInstanceOf(atoum\exceptions\logic::class)730 ->hasMessage('Array is undefined')731 ->if(732 $this->calling($locale)->_ = $strictlyNotContainsValues = uniqid(),733 $this->calling($analyzer)->getTypeOf = $type = uniqid(),734 $asserter->setWith([1, 2, 3, 4, 5])735 )736 ->then737 ->exception(function () use ($asserter) {738 $asserter->strictlyContainsValues([1, '5']);739 })740 ->isInstanceOf(atoum\asserter\exception::class)741 ->hasMessage($strictlyNotContainsValues)742 ->mock($locale)->call('_')->withArguments('%s does not contain strictly values %s', $asserter, $type)->once743 ->mock($analyzer)->call('getTypeOf')->withArguments(['5'])->once744 ->exception(function () use ($asserter, & $failMessage) {745 $asserter->strictlyContainsValues(['5'], $failMessage = uniqid());746 })747 ->isInstanceOf(atoum\asserter\exception::class)748 ->hasMessage($failMessage)749 ->object($asserter->strictlyContainsValues([1]))->isIdenticalTo($asserter)750 ->object($asserter->strictlyContainsValues([1, 2]))->isIdenticalTo($asserter)751 ->object($asserter->strictlyContainsValues([1, 2, 3]))->isIdenticalTo($asserter)752 ->object($asserter->strictlyContainsValues([1, 2, 3, 4]))->isIdenticalTo($asserter)753 ->object($asserter->strictlyContainsValues([1, 2, 3, 4, 5]))->isIdenticalTo($asserter)754 ;755 }756 public function testNotContainsValues()757 {758 $this759 ->given(760 $asserter = $this->newTestedInstance761 ->setLocale($locale = new \mock\atoum\locale())762 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())763 )764 ->then765 ->exception(function () use ($asserter) {766 $asserter->notContainsValues([1, 6]);767 })768 ->isInstanceOf(atoum\exceptions\logic::class)769 ->hasMessage('Array is undefined')770 ->if(771 $this->calling($locale)->_ = $containsValues = uniqid(),772 $this->calling($analyzer)->getTypeOf = $type = uniqid(),773 $asserter->setWith([1, 2, 3, 4, 5])774 )775 ->then776 ->exception(function () use ($asserter) {777 $asserter->notContainsValues([1, 6]);778 })779 ->isInstanceOf(atoum\asserter\exception::class)780 ->hasMessage($containsValues)781 ->mock($locale)->call('_')->withArguments('%s contains values %s', $asserter, $type)->once782 ->mock($analyzer)->call('getTypeOf')->withArguments([1])->once783 ->exception(function () use ($asserter, & $failMessage) {784 $asserter->notContainsValues([1, 6], $failMessage = uniqid());785 })786 ->isInstanceOf(atoum\asserter\exception::class)787 ->hasMessage($failMessage)788 ->object($asserter->notContainsValues([6]))->isIdenticalTo($asserter)789 ->object($asserter->notContainsValues(['6']))->isIdenticalTo($asserter)790 ->object($asserter->notContainsValues([6, 7]))->isIdenticalTo($asserter)791 ->object($asserter->notContainsValues(['6', '7']))->isIdenticalTo($asserter)792 ->object($asserter->notContainsValues([6, 7, 8]))->isIdenticalTo($asserter)793 ->object($asserter->notContainsValues(['6', 7, '8']))->isIdenticalTo($asserter)794 ;795 }796 public function testStrictlyNotContainsValues()797 {798 $this799 ->given(800 $asserter = $this->newTestedInstance801 ->setLocale($locale = new \mock\atoum\locale())802 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())803 )804 ->then805 ->exception(function () use ($asserter) {806 $asserter->strictlyNotContainsValues([1, 6]);807 })808 ->isInstanceOf(atoum\exceptions\logic::class)809 ->hasMessage('Array is undefined')810 ->if(811 $this->calling($locale)->_ = $containsStrictlyValues = uniqid(),812 $this->calling($analyzer)->getTypeOf = $type = uniqid(),813 $asserter->setWith([1, 2, 3, 4, 5])814 )815 ->then816 ->exception(function () use ($asserter) {817 $asserter->strictlyNotContainsValues([1, '2', '4']);818 })819 ->isInstanceOf(atoum\asserter\exception::class)820 ->hasMessage($containsStrictlyValues)821 ->mock($locale)->call('_')->withArguments('%s contains strictly values %s', $asserter, $type)->once822 ->mock($analyzer)->call('getTypeOf')->withArguments([1])->once823 ->exception(function () use ($asserter, & $failMessage) {824 $asserter->strictlyNotContainsValues([1], $failMessage = uniqid());825 })826 ->isInstanceOf(atoum\asserter\exception::class)827 ->hasMessage($failMessage)828 ->object($asserter->strictlyNotContainsValues(['1']))->isIdenticalTo($asserter)829 ->object($asserter->strictlyNotContainsValues(['1', '2']))->isIdenticalTo($asserter)830 ->object($asserter->strictlyNotContainsValues(['1', '2', '3']))->isIdenticalTo($asserter)831 ->object($asserter->strictlyNotContainsValues(['1', '2', '3', '4']))->isIdenticalTo($asserter)832 ->object($asserter->strictlyNotContainsValues(['1', '2', '3', '4', '5']))->isIdenticalTo($asserter)833 ->object($asserter->strictlyNotContainsValues(['6', '7']))->isIdenticalTo($asserter)834 ;835 }836 public function testHasKey()837 {838 $this839 ->given(840 $asserter = $this->newTestedInstance841 ->setLocale($locale = new \mock\atoum\locale())842 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())843 )844 ->then845 ->exception(function () use ($asserter) {846 $asserter->hasKey(rand(0, PHP_INT_MAX));847 })848 ->isInstanceOf(atoum\exceptions\logic::class)849 ->hasMessage('Array is undefined')850 ->if(851 $this->calling($locale)->_ = $notHasKey = uniqid(),852 $this->calling($analyzer)->getTypeOf = $type = uniqid(),853 $asserter->setWith([])854 )855 ->then856 ->exception(function () use ($asserter, & $key) {857 $asserter->hasKey($key = rand(1, PHP_INT_MAX));858 })859 ->isInstanceOf(atoum\asserter\exception::class)860 ->hasMessage($notHasKey)861 ->mock($locale)->call('_')->withArguments('%s has no key %s', $asserter, $type)->once862 ->mock($analyzer)->call('getTypeOf')->withArguments($key)->once863 ->exception(function () use ($asserter, & $key, & $failMessage) {864 $asserter->hasKey($key = rand(1, PHP_INT_MAX), $failMessage = uniqid());865 })866 ->isInstanceOf(atoum\asserter\exception::class)867 ->hasMessage($failMessage)868 ->if($asserter->setWith([uniqid(), uniqid(), uniqid(), uniqid(), uniqid(), '5' => uniqid()]))869 ->then870 ->object($asserter->hasKey(0))->isIdenticalTo($asserter)871 ->object($asserter->hasKey(1))->isIdenticalTo($asserter)872 ->object($asserter->hasKey(2))->isIdenticalTo($asserter)873 ->object($asserter->hasKey(3))->isIdenticalTo($asserter)874 ->object($asserter->hasKey(4))->isIdenticalTo($asserter)875 ->object($asserter->hasKey(5))->isIdenticalTo($asserter)876 ->object($asserter->hasKey('5'))->isIdenticalTo($asserter)877 ;878 }879 public function testNotHasKey()880 {881 $this882 ->given(883 $asserter = $this->newTestedInstance884 ->setLocale($locale = new \mock\atoum\locale())885 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())886 )887 ->then888 ->exception(function () use ($asserter) {889 $asserter->notHasKey(rand(0, PHP_INT_MAX));890 })891 ->isInstanceOf(atoum\exceptions\logic::class)892 ->hasMessage('Array is undefined')893 ->if($asserter->setWith([]))894 ->then895 ->object($asserter->notHasKey(rand(-PHP_INT_MAX, PHP_INT_MAX)))->isIdenticalTo($asserter)896 ->object($asserter->notHasKey(uniqid()))->isIdenticalTo($asserter)897 ->if(898 $this->calling($locale)->_ = $hasKey = uniqid(),899 $this->calling($analyzer)->getTypeOf = $keyType = uniqid(),900 $asserter->setWith([uniqid(), uniqid(), uniqid(), uniqid(), uniqid()])901 )902 ->then903 ->exception(function () use ($asserter) {904 $asserter->notHasKey(0);905 })906 ->isInstanceOf(atoum\asserter\exception::class)907 ->hasMessage($hasKey)908 ->mock($locale)->call('_')->withArguments('%s has key %s', $asserter, $keyType)->once909 ->mock($analyzer)->call('getTypeOf')->withArguments(0)->once910 ->exception(function () use ($asserter) {911 $asserter->notHasKey('0');912 })913 ->isInstanceOf(atoum\asserter\exception::class)914 ->hasMessage($hasKey)915 ->mock($locale)->call('_')->withArguments('%s has key %s', $asserter, $keyType)->twice916 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments('0')->once917 ;918 }919 public function testNotHasKeys()920 {921 $this922 ->given(923 $asserter = $this->newTestedInstance924 ->setLocale($locale = new \mock\atoum\locale())925 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())926 )927 ->then928 ->exception(function () use ($asserter) {929 $asserter->notHasKeys([rand(0, PHP_INT_MAX)]);930 })931 ->isInstanceOf(atoum\exceptions\logic::class)932 ->hasMessage('Array is undefined')933 ->if($asserter->setWith([]))934 ->then935 ->object($asserter->notHasKeys(range(1, 5)))->isIdenticalTo($asserter)936 ->object($asserter->notHasKeys([uniqid(), uniqid()]))->isIdenticalTo($asserter)937 ->if(938 $this->calling($locale)->_ = $hasKeys = uniqid(),939 $this->calling($analyzer)->getTypeOf = $keysType = uniqid(),940 $asserter->setWith([uniqid(), uniqid(), uniqid(), uniqid(), uniqid()])941 )942 ->then943 ->exception(function () use ($asserter) {944 $asserter->notHasKeys([0, 'premier', '2']);945 })946 ->isInstanceOf(atoum\asserter\exception::class)947 ->hasMessage($hasKeys)948 ->mock($locale)->call('_')->withArguments('%s has keys %s', $asserter, $keysType)->once949 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments([0 => 0, 2 => '2'])->once950 ->exception(function () use ($asserter, & $failMessage) {951 $asserter->notHasKeys([0, 'premier', 2], $failMessage = uniqid());952 })953 ->isInstanceOf(atoum\asserter\exception::class)954 ->hasMessage($failMessage)955 ->object($asserter->notHasKeys([5, '6']))->isIdenticalTo($asserter)956 ;957 }958 public function testHasKeys()959 {960 $this961 ->given(962 $asserter = $this->newTestedInstance963 ->setLocale($locale = new \mock\atoum\locale())964 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())965 )966 ->then967 ->exception(function () use ($asserter) {968 $asserter->hasKeys([rand(0, PHP_INT_MAX)]);969 })970 ->isInstanceOf(atoum\exceptions\logic::class)971 ->hasMessage('Array is undefined')972 ->if(973 $this->calling($locale)->_ = $notHasKeys = uniqid(),974 $this->calling($analyzer)->getTypeOf = $keysType = uniqid(),975 $asserter->setWith([])976 )977 ->then978 ->exception(function () use ($asserter) {979 $asserter->hasKeys([0, 1, 2]);980 })981 ->isInstanceOf(atoum\asserter\exception::class)982 ->hasMessage($notHasKeys)983 ->mock($locale)->call('_')->withArguments('%s has no keys %s', $asserter, $keysType)->once984 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments([0, 1, 2])->once985 ->exception(function () use ($asserter, & $failMessage) {986 $asserter->hasKeys([0], $failMessage = uniqid());987 })988 ->isInstanceOf(atoum\asserter\exception::class)989 ->hasMessage($failMessage)990 ->if($asserter->setWith([uniqid(), uniqid(), uniqid(), uniqid(), uniqid()]))991 ->then992 ->exception(function () use ($asserter) {993 $asserter->hasKeys([0, 'first', 2, 'second']);994 })995 ->isInstanceOf(atoum\asserter\exception::class)996 ->hasMessage($notHasKeys)997 ->mock($locale)->call('_')->withArguments('%s has no keys %s', $asserter, $keysType)->twice998 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments([1 => 'first', 3 => 'second'])->once999 ->object($asserter->hasKeys([0, 2, 4]))->isIdenticalTo($asserter)1000 ;1001 }1002 public function testKeys()1003 {1004 $this1005 ->given($asserter = $this->newTestedInstance)1006 ->then1007 ->exception(function () use ($asserter) {1008 $asserter->keys;1009 })1010 ->isInstanceOf(atoum\exceptions\logic::class)1011 ->hasMessage('Array is undefined')1012 ->if($asserter->setWith([]))1013 ->then1014 ->object($array = $asserter->keys)->isInstanceOf(atoum\asserters\phpArray::class)1015 ->array($array->getValue())->isEqualTo([])1016 ->if($asserter->setWith([$key1 = uniqid() => uniqid(), $key2 = uniqid() => uniqid()]))1017 ->then1018 ->object($array = $asserter->keys)->isInstanceOf(atoum\asserters\phpArray::class)1019 ->array($array->getValue())->isEqualTo([$key1, $key2])1020 ;1021 }1022 public function testValues()1023 {1024 $this1025 ->given($asserter = $this->newTestedInstance)1026 ->then1027 ->exception(function () use ($asserter) {1028 $asserter->values;1029 })1030 ->isInstanceOf(atoum\exceptions\logic::class)1031 ->hasMessage('Array is undefined')1032 ->if($asserter->setWith([]))1033 ->then1034 ->object($array = $asserter->values)->isInstanceOf(atoum\asserters\phpArray::class)1035 ->array($array->getValue())->isEqualTo([])1036 ->if($asserter->setWith(['one' => 'first value', 'two' => 'second value']))1037 ->then1038 ->object($array = $asserter->values)->isInstanceOf(atoum\asserters\phpArray::class)1039 ->array($array->getValue())->isEqualTo(['first value', 'second value'])1040 ;1041 }1042 public function testSize()1043 {1044 $this1045 ->given($asserter = $this->newTestedInstance)1046 ->then1047 ->exception(function () use ($asserter) {1048 $asserter->size;1049 })1050 ->isInstanceOf(atoum\exceptions\logic::class)1051 ->hasMessage('Array is undefined')1052 ->if($asserter->setWith([]))1053 ->then1054 ->object($integer = $asserter->size)->isInstanceOf(atoum\asserters\integer::class)1055 ->integer($integer->getValue())->isEqualTo(0)1056 ->if($asserter->setWith([uniqid(), uniqid()]))1057 ->then1058 ->object($integer = $asserter->size)->isInstanceOf(atoum\asserters\integer::class)1059 ->integer($integer->getValue())->isEqualTo(2)1060 ;1061 }1062 public function testIsEqualTo()1063 {1064 $this1065 ->given(1066 $asserter = $this->newTestedInstance1067 ->setLocale($locale = new \mock\atoum\locale())1068 ->setDiff($diff = new \mock\atoum\tools\diffs\variable())1069 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())1070 ->setGenerator($generator = new \mock\atoum\asserter\generator())1071 )1072 ->then1073 ->exception(function () use ($asserter) {1074 $asserter->isEqualTo([]);1075 })1076 ->isInstanceOf(atoum\exceptions\logic::class)1077 ->hasMessage('Array is undefined')1078 ->if($asserter->setWith([]))1079 ->then1080 ->object($asserter->isEqualTo([]))->isIdenticalTo($asserter)1081 ->if($asserter->setWith($array = range(1, 5)))1082 ->then1083 ->object($asserter->isEqualTo($array))->isIdenticalTo($asserter)1084 ->if(1085 $this->calling($locale)->_ = $localizedMessage = uniqid(),1086 $this->calling($diff)->__toString = $diffValue = uniqid(),1087 $this->calling($analyzer)->getTypeOf = $type = uniqid()1088 )1089 ->then1090 ->exception(function () use ($asserter, & $notEqualValue) {1091 $asserter->isEqualTo($notEqualValue = uniqid());1092 })1093 ->isInstanceOf(atoum\asserter\exception::class)1094 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)1095 ->mock($locale)->call('_')->withArguments('%s is not equal to %s', $asserter, $type)->once1096 ->mock($analyzer)->call('getTypeOf')->withArguments($notEqualValue)->once1097 ->object($asserter->isEqualTo($array))->isIdenticalTo($asserter)1098 ->given(1099 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),1100 $this->calling($integerAsserter)->isEqualTo->throw = $exception = new \exception(uniqid())1101 )1102 ->if($asserter->integer)1103 ->then1104 ->exception(function () use ($asserter, & $notEqualValue) {1105 $asserter->isEqualTo($notEqualValue = uniqid());1106 })1107 ->isInstanceOf(atoum\asserter\exception::class)1108 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)1109 ->mock($locale)->call('_')->withArguments('%s is not equal to %s', $asserter, $type)->twice1110 ->mock($analyzer)->call('getTypeOf')->withArguments($notEqualValue)->once1111 ->mock($integerAsserter)->call('isEqualTo')->never1112 ->if($asserter->integer[2])1113 ->then1114 ->exception(function () use ($asserter, & $expectedValue) {1115 $asserter->isEqualTo($expectedValue = rand(4, PHP_INT_MAX));1116 })1117 ->isIdenticalTo($exception)1118 ->mock($integerAsserter)->call('isEqualTo')->withArguments($expectedValue)->once1119 ->if($this->method($integerAsserter)->isEqualTo->isFluent())1120 ->then1121 ->object($asserter->isEqualTo(3))->isIdenticalTo($asserter)1122 ->mock($integerAsserter)->call('isEqualTo')->withArguments(3)->once1123 ;1124 }1125 public function testIsNotEqualTo()1126 {1127 $this1128 ->given(1129 $asserter = $this->newTestedInstance1130 ->setLocale($locale = new \mock\atoum\locale())1131 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())1132 ->setGenerator($generator = new \mock\atoum\asserter\generator())1133 )1134 ->then1135 ->exception(function () use ($asserter) {1136 $asserter->isNotEqualTo([]);1137 })1138 ->isInstanceOf(atoum\exceptions\logic::class)1139 ->hasMessage('Array is undefined')1140 ->if($asserter->setWith([]))1141 ->then1142 ->object($asserter->isNotEqualTo(range(1, 2)))->isIdenticalTo($asserter)1143 ->if(1144 $this->calling($locale)->_ = $localizedMessage = uniqid(),1145 $this->calling($analyzer)->getTypeOf = $type = uniqid()1146 )1147 ->then1148 ->exception(function () use ($asserter) {1149 $asserter->isNotEqualTo([]);1150 })1151 ->isInstanceOf(atoum\asserter\exception::class)1152 ->hasMessage($localizedMessage)1153 ->mock($locale)->call('_')->withArguments('%s is equal to %s', $asserter, $type)->once1154 ->mock($analyzer)->call('getTypeOf')->withArguments([])->once1155 ->if($asserter->setWith($array = range(1, 5)))1156 ->then1157 ->object($asserter->isNotEqualTo([]))->isIdenticalTo($asserter)1158 ->exception(function () use ($asserter, $array) {1159 $asserter->isNotEqualTo($array);1160 })1161 ->isInstanceOf(atoum\asserter\exception::class)1162 ->hasMessage($localizedMessage)1163 ->mock($locale)->call('_')->withArguments('%s is equal to %s', $asserter, $type)->twice1164 ->mock($analyzer)->call('getTypeOf')->withArguments($array)->once1165 ->given(1166 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),1167 $this->calling($integerAsserter)->isNotEqualTo->throw = $exception = new \exception(uniqid())1168 )1169 ->if($asserter->integer)1170 ->then1171 ->object($asserter->isNotEqualTo([]))->isIdenticalTo($asserter)1172 ->exception(function () use ($asserter, $array) {1173 $asserter->isNotEqualTo($array);1174 })1175 ->isInstanceOf(atoum\asserter\exception::class)1176 ->hasMessage($localizedMessage)1177 ->mock($locale)->call('_')->withArguments('%s is equal to %s', $asserter, $type)->thrice1178 ->mock($analyzer)->call('getTypeOf')->withArguments($array)->twice1179 ->mock($integerAsserter)->call('isNotIdenticalTo')->never1180 ->if($asserter->integer[2])1181 ->then1182 ->exception(function () use ($asserter, & $expectedValue) {1183 $asserter->isNotEqualTo($expectedValue = rand(4, PHP_INT_MAX));1184 })1185 ->isIdenticalTo($exception)1186 ->mock($integerAsserter)->call('isNotEqualTo')->withArguments($expectedValue)->once1187 ->if($this->method($integerAsserter)->isNotEqualTo->isFluent())1188 ->then1189 ->object($asserter->isNotEqualTo(3))->isIdenticalTo($asserter)1190 ->mock($integerAsserter)->call('isNotEqualTo')->withArguments(3)->once1191 ;1192 }1193 public function testIsIdenticalTo()1194 {1195 $this1196 ->given(1197 $asserter = $this->newTestedInstance1198 ->setLocale($locale = new \mock\atoum\locale())1199 ->setDiff($diff = new \mock\atoum\tools\diffs\variable())1200 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())1201 ->setGenerator($generator = new \mock\atoum\asserter\generator())1202 )1203 ->then1204 ->exception(function () use ($asserter) {1205 $asserter->isIdenticalTo(new \mock\phpObject());1206 })1207 ->isInstanceOf(atoum\exceptions\logic::class)1208 ->hasMessage('Array is undefined')1209 ->if($asserter->setWith([$object = new \mock\phpObject(), 2]))1210 ->then1211 ->object($asserter->isIdenticalTo([$object, 2]))->isIdenticalTo($asserter)1212 ->if(1213 $this->calling($locale)->_ = $localizedMessage = uniqid(),1214 $this->calling($diff)->__toString = $diffValue = uniqid(),1215 $this->calling($analyzer)->getTypeOf = $type = uniqid()1216 )1217 ->then1218 ->exception(function () use ($asserter, & $notIdenticalValue) {1219 $asserter->isIdenticalTo($notIdenticalValue = uniqid());1220 })1221 ->isInstanceOf(atoum\asserter\exception::class)1222 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)1223 ->mock($locale)->call('_')->withArguments('%s is not identical to %s', $asserter, $type)->once1224 ->mock($analyzer)->call('getTypeOf')->withArguments($notIdenticalValue)->once1225 ->given(1226 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),1227 $this->calling($integerAsserter)->isIdenticalTo->throw = $exception = new \exception(uniqid())1228 )1229 ->if($asserter->integer)1230 ->then1231 ->object($asserter->isIdenticalTo([$object, 2]))->isIdenticalTo($asserter)1232 ->exception(function () use ($asserter, & $notIdenticalValue) {1233 $asserter->isIdenticalTo($notIdenticalValue = uniqid());1234 })1235 ->isInstanceOf(atoum\asserter\exception::class)1236 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)1237 ->mock($locale)->call('_')->withArguments('%s is not identical to %s', $asserter, $type)->twice1238 ->mock($analyzer)->call('getTypeOf')->withArguments($notIdenticalValue)->once1239 ->if($asserter->integer[1])1240 ->then1241 ->exception(function () use ($asserter, & $expectedValue) {1242 $asserter->isIdenticalTo($expectedValue = rand(4, PHP_INT_MAX));1243 })1244 ->isIdenticalTo($exception)1245 ->mock($integerAsserter)->call('isIdenticalTo')->withArguments($expectedValue)->once1246 ->if($this->method($integerAsserter)->isIdenticalTo->isFluent())1247 ->then1248 ->object($asserter->isEqualTo(2))->isIdenticalTo($asserter)1249 ->mock($integerAsserter)->call('isIdenticalTo')->withArguments($expectedValue)->once1250 ;1251 }1252 public function testIsNotIdenticalTo()1253 {1254 $this1255 ->given(1256 $asserter = $this->newTestedInstance1257 ->setLocale($locale = new \mock\atoum\locale())1258 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())1259 ->setGenerator($generator = new \mock\atoum\asserter\generator())1260 )1261 ->then1262 ->exception(function () use ($asserter) {1263 $asserter->isNotIdenticalTo(new \mock\phpObject());1264 })1265 ->isInstanceOf(atoum\exceptions\logic::class)1266 ->hasMessage('Array is undefined')1267 ->if($asserter->setWith($array = [1, 2]))1268 ->then1269 ->object($asserter->isNotIdenticalTo(['1', 2]))->isIdenticalTo($asserter)1270 ->if(1271 $this->calling($locale)->_ = $localizedMessage = uniqid(),1272 $this->calling($analyzer)->getTypeOf = $type = uniqid()1273 )1274 ->then1275 ->exception(function () use ($asserter, $array) {1276 $asserter->isNotIdenticalTo($array);1277 })1278 ->isInstanceOf(atoum\asserter\exception::class)1279 ->hasMessage($localizedMessage)1280 ->mock($locale)->call('_')->withArguments('%s is identical to %s', $asserter, $type)->once1281 ->mock($analyzer)->call('getTypeOf')->withArguments($array)->once...

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1$phpArray = new phpArray();2$phpArray->setWith(array('a','b','c','d','e'));3$phpArray->setWith(array('f','g','h','i','j'));4$phpArray->setWith(array('k','l','m','n','o'));5$phpArray->setWith(array('p','q','r','s','t'));6$phpArray->setWith(array('u','v','w','x','y'));7$phpArray->setWith(array('z'));8$phpArray->setWith(array('1','2','3','4','5'));9$phpArray->setWith(array('6','7','8','9','0'));10$phpArray->setWith(array('!','@','#','$','%','^','&','*','(',')','-','_','=','+','~','`','|','/','?','.',',','<','>'));11$phpArray->setWith(array('A','B','C','D','E'));12$phpArray->setWith(array('F','G','H','I','J'));13$phpArray->setWith(array('K','L','M','N','O'));14$phpArray->setWith(array('P','Q','R','S','T'));15$phpArray->setWith(array('U','V','W','X','Y'));16$phpArray->setWith(array('Z'));17$phpArray->setWith(array('a','b','c','d','e'));18$phpArray->setWith(array('f','g','h','i','j'));19$phpArray->setWith(array('k','l','m','n','o'));20$phpArray->setWith(array('p','q','r','s','t'));21$phpArray->setWith(array('u','v','w','x','y'));22$phpArray->setWith(array('z'));23$phpArray->setWith(array('1','2','3','4','5'));24$phpArray->setWith(array('6','7','8','9','0'));25$phpArray->setWith(array('!','@','#','$','%','^','&','*','(',')','-','_','=','+','~','`','|','/','?','.',',','<','>'));26$phpArray->setWith(array('A','B','C','D','E'));27$phpArray->setWith(array('F','

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1include('phpArray.php');2$array = new phpArray();3$array->setWith(array('a','b','c'));4print_r($array->getArray());5include('phpArray.php');6$array = new phpArray();7$array->setWith(array('a','b','c'));8$array->setWith(array('a','b','c'));9print_r($array->getArray());10include('phpArray.php');11$array = new phpArray();12$array->setWith(array('a','b','c'));13$array->setWith(array('a','b','c','d'));14print_r($array->getArray());15include('phpArray.php');16$array = new phpArray();17$array->setWith(array('a','b','c'));18$array->setWith(array('a','b','c','d'));19$array->setWith(array('a','b','c','d','e'));20print_r($array->getArray());21include('phpArray.php');22$array = new phpArray();23$array->setWith(array('a','b','c'));24$array->setWith(array('a','b','c','d'));25$array->setWith(array('a','b','c','d','e'));26$array->setWith(array('a','b','c','d','e','f'));27print_r($array->getArray());

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1require_once("phpArray.php");2$phpArray = new phpArray();3$phpArray->setWith(array("a" => array("b" => "c")));4echo $phpArray->a->b;5require_once("phpArray.php");6$phpArray = new phpArray(array("a" => array("b" => "c")));7echo $phpArray->a->b;8require_once("phpArray.php");9$phpArray = new phpArray();10$phpArray->setWith(array("a" => array("b" => "c")));11echo $phpArray->a->b;12require_once("phpArray.php");13$phpArray = new phpArray(array("a" => array("b" => "c")));14echo $phpArray->a->b;15require_once("phpArray.php");16$phpArray = new phpArray();17$phpArray->setWith(array("a" => array("b" => "c")));18echo $phpArray->a->b;19require_once("phpArray.php");20$phpArray = new phpArray(array("a" => array("b" => "c")));21echo $phpArray->a->b;22require_once("phpArray.php");23$phpArray = new phpArray();24$phpArray->setWith(array("a" => array("b" => "c")));25echo $phpArray->a->b;26require_once("phpArray.php");27$phpArray = new phpArray(array("a" => array("b" => "c")));28echo $phpArray->a->b;29require_once("phpArray.php");30$phpArray = new phpArray();31$phpArray->setWith(array("a" => array("b"

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1$phpArray->setWith('1.php', '1.php', '1.php');2$phpArray->setWith('2.php', '2.php', '2.php');3$phpArray->setWith('3.php', '3.php', '3.php');4$phpArray->setWith('4.php', '4.php', '4.php');5$phpArray->setWith('1.php', '1.php', '1.php');6$phpArray->setWith('2.php', '2.php', '2.php');7$phpArray->setWith('3.php', '3.php', '3.php');8$phpArray->setWith('1.php', '1.php', '1.php');9$phpArray->setWith('2.php', '2.php', '2.php');10$phpArray->setWith('1.php', '1.php', '1.php');11$phpArray->setWith('1.php', '1.php', '1.php');12$phpArray->setWith('2.php', '2.php', '2.php');13$phpArray->setWith('3.php', '3.php', '3.php');14$phpArray->setWith('4.php', '4.php', '4.php');15$phpArray->setWith('5.php', '5.php', '5.php');16$phpArray->setWith('6.php', '6.php', '6.php');

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1$phpArray = new phpArray();2$phpArray->setWith(array('a','b','c'));3$phpArray->setWith(array('d','e','f'));4echo $phpArray;5$phpArray = new phpArray();6$phpArray->setWith(array('a','b','c'));7$phpArray->setWith(array('d','e','f'));8$phpArray->setWith(array('g','h','i'));9echo $phpArray;10$phpArray = new phpArray();11$phpArray->setWith(array('a','b','c'));12$phpArray->setWith(array('d','e','f'));13$phpArray->setWith(array('g','h','i'));14$phpArray->setWith(array('j','k','l'));15echo $phpArray;16$phpArray = new phpArray();17$phpArray->setWith(array('a','b','c'));18$phpArray->setWith(array('d','e','f'));19$phpArray->setWith(array('g','h','i'));20$phpArray->setWith(array('j','k','l'));21$phpArray->setWith(array('m','n','o'));22echo $phpArray;23$phpArray = new phpArray();24$phpArray->setWith(array('a','b','c'));

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1include_once 'phpArray.php';2$phpArray = new phpArray();3$arr = array("1","2","3");4$phpArray->setWith($arr);5$phpArray->printArray();6include_once 'phpArray.php';7$phpArray = new phpArray();8$phpArray->setWith("1,2,3");9$phpArray->printArray();10include_once 'phpArray.php';11$phpArray = new phpArray();12$phpArray->setWith("1,2,3",";");13$phpArray->printArray();14include_once 'phpArray.php';15$phpArray = new phpArray();16$phpArray->setWith("1;2;3",";");17$phpArray->printArray();18include_once 'phpArray.php';19$phpArray = new phpArray();20$phpArray->setWith("1,2,3");21$phpArray->setWith("4,5,6");22$phpArray->printArray();23include_once 'phpArray.php';24$phpArray = new phpArray();25$phpArray->setWith("1,2,3");26$phpArray->setWith("4;5;6",";");27$phpArray->printArray();28include_once 'phpArray.php';29$phpArray = new phpArray();30$phpArray->setWith("1;2;3",";");31$phpArray->setWith("4,5,6");32$phpArray->printArray();33include_once 'phpArray.php';34$phpArray = new phpArray();35$phpArray->setWith("1;2;3",";");36$phpArray->setWith("4;5;

Full Screen

Full Screen

setWith

Using AI Code Generation

copy

Full Screen

1require_once('phpArray.php');2$phpArray = new phpArray();3$array = array('name'=>'john','age'=>'25');4$phpArray->setWith($array);5$array = $phpArray->get();6print_r($array);7$count = $phpArray->count();8print_r($count);9$first = $phpArray->first();10print_r($first);11$last = $phpArray->last();12print_r($last);13$empty = $phpArray->isEmpty();14print_r($empty);15$contains = $phpArray->contains('name');16print_r($contains);17$contains = $phpArray->contains('john');18print_r($contains);19$value = $phpArray->get('name');20print_r($value);21$key = $phpArray->keyOf('john');22print_r($key);23$has = $phpArray->has('name');24print_r($has);25$has = $phpArray->hasValue('john');26print_r($has);27$keys = $phpArray->keys();28print_r($keys);

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.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger setWith code on LambdaTest Cloud Grid

Execute automation tests with setWith on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful