Best Atoum code snippet using phpArray.isIdenticalTo
phpArray.php
Source:phpArray.php
...27 ->variable($this->testedInstance->getInnerAsserter())->isNull()28 ->variable($this->testedInstance->getInnerValue())->isNull()29 ->if($this->newTestedInstance($generator = new asserter\generator(), $analyzer = new variable\analyzer(), $locale = new atoum\locale()))30 ->then31 ->object($this->testedInstance->getGenerator())->isIdenticalTo($generator)32 ->object($this->testedInstance->getAnalyzer())->isIdenticalTo($analyzer)33 ->object($this->testedInstance->getLocale())->isIdenticalTo($locale)34 ->variable($this->testedInstance->getValue())->isNull()35 ->boolean($this->testedInstance->wasSet())->isFalse()36 ->variable($this->testedInstance->getKey())->isNull()37 ->variable($this->testedInstance->getInnerAsserter())->isNull()38 ->variable($this->testedInstance->getInnerValue())->isNull()39 ;40 }41 public function test__get()42 {43 $this44 ->given($this->newTestedInstance($generator = new \mock\atoum\atoum\asserter\generator()))45 ->then46 ->object($this->testedInstance->object)->isTestedInstance47 ->object($this->testedInstance->getInnerAsserter())->isEqualTo($generator->object)48 ->object($this->testedInstance->object->phpString)->isTestedInstance49 ->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\atoum\locale())136 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())174 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())283 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())345 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())386 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())428 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())468 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())522 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())573 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())635 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())685 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())723 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())762 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())802 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())842 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())885 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())925 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())964 ->setAnalyzer($analyzer = new \mock\atoum\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\atoum\locale())1068 ->setDiff($diff = new \mock\atoum\atoum\tools\diffs\variable())1069 ->setAnalyzer($analyzer = new \mock\atoum\atoum\tools\variable\analyzer())1070 ->setGenerator($generator = new \mock\atoum\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\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\atoum\locale())1131 ->setAnalyzer($analyzer = new \mock\atoum\atoum\tools\variable\analyzer())1132 ->setGenerator($generator = new \mock\atoum\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\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\atoum\locale())1199 ->setDiff($diff = new \mock\atoum\atoum\tools\diffs\variable())1200 ->setAnalyzer($analyzer = new \mock\atoum\atoum\tools\variable\analyzer())1201 ->setGenerator($generator = new \mock\atoum\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\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\atoum\locale())1258 ->setAnalyzer($analyzer = new \mock\atoum\atoum\tools\variable\analyzer())1259 ->setGenerator($generator = new \mock\atoum\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)->once1282 ->given(1283 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\atoum\asserters\integer(),1284 $this->calling($integerAsserter)->isNotIdenticalTo->throw = $exception = new \exception(uniqid())1285 )1286 ->if($asserter->integer)1287 ->then1288 ->object($asserter->isNotIdenticalTo(['1', 2]))->isIdenticalTo($asserter)1289 ->mock($integerAsserter)->call('isNotIdenticalTo')->never1290 ->if($asserter->integer[1])1291 ->then1292 ->exception(function () use ($asserter, & $expectedValue) {1293 $asserter->isNotIdenticalTo($expectedValue = rand(4, PHP_INT_MAX));1294 })1295 ->isIdenticalTo($exception)1296 ->mock($integerAsserter)->call('isNotIdenticalTo')->withArguments($expectedValue)->once1297 ->if($this->method($integerAsserter)->isNotIdenticalTo->isFluent())1298 ->then1299 ->object($asserter->isNotIdenticalTo(3))->isIdenticalTo($asserter)1300 ->mock($integerAsserter)->call('isNotIdenticalTo')->withArguments(3)->once1301 ;1302 }1303}...
isIdenticalTo
Using AI Code Generation
1require_once 'phpArray.php';2$array1 = new phpArray(array(1,2,3,4,5));3$array2 = new phpArray(array(1,2,3,4,5));4if($array1->isIdenticalTo($array2))5{6 echo "Both arrays are identical";7}8{9 echo "Both arrays are not identical";10}11Related posts: PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP: Check if two arrays are equal using isIdenticalTo() method of phpArray class PHP: Check if two arrays are equal using isEqualTo() method of phpArray class PHP
isIdenticalTo
Using AI Code Generation
1require_once 'phpArray.php';2$array1 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange');3$array2 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange');4$array3 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes');5$array4 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes', 'e' => 'papaya');6$array5 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes', 'e' => 'papaya', 'f' => 'strawberry');7$array6 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes', 'e' => 'papaya', 'f' => 'strawberry', 'g' => 'mango');8$array7 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes', 'e' => 'papaya', 'f' => 'strawberry', 'g' => 'mango', 'h' => 'pineapple');9$array8 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes', 'e' => 'papaya', 'f' => 'strawberry', 'g' => 'mango', 'h' => 'pineapple', 'i' => 'jackfruit');10$array9 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'grapes', 'e' => 'papaya', 'f' => 'strawberry', 'g' => 'mango', 'h' => 'pineapple', 'i' => 'jackfruit', 'j' => 'watermelon');11$array10 = array('a' => 'apple', 'b' => 'banana', 'c' => 'orange', 'd' => 'gr
isIdenticalTo
Using AI Code Generation
1$phpArray = new phpArray();2$phpArray->setArray(array(1,2,3));3$phpArray = new phpArray();4$phpArray->setArray(array('a','b','c'));5$phpArray = new phpArray();6$phpArray->setArray(array('a','b','c','d','e'));7$phpArray = new phpArray();8$phpArray->setArray(array('a','b','c
isIdenticalTo
Using AI Code Generation
1require_once 'phpArray.php';2$array1 = array(1, 2, 3);3$array2 = array(1, 2, 3);4$array3 = array(1, 2, 3, 4);5$array4 = array(1, 2, 3, 4, 5);6$array5 = array(1, 2, 3, 5);7$array6 = array(1, 2, 3, 5);8$array7 = array(1, 2, 3, 5, 6);9$array8 = array(1, 2, 3, 5, 6, 7);10$array9 = array(1, 2, 3, 5, 6, 7, 8);11$array10 = array(1, 2, 3, 5, 6, 7, 8, 9);12$array11 = array(1, 2, 3, 5, 6, 7, 8, 9, 10);13$array12 = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11);14$array13 = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12);15$array14 = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13);16$array15 = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);17$array16 = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);18$array17 = array(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);19$array18 = array(1, 2, 3, 5, 6
isIdenticalTo
Using AI Code Generation
1require_once "phpArray.php";2$phpArray = new phpArray();3$array1 = array("a","b","c");4$array2 = array("a","b","c");5$result = $phpArray->isIdenticalTo($array1,$array2);6if($result)7{8 echo "The two arrays are identical";9}10{11 echo "The two arrays are not identical";12}13Related posts: PHP – How to use isNotIdenticalTo() method of phpArray class PHP – How to use isSubsetOf() method of phpArray class PHP – How to use isNotSubsetOf() method of phpArray class PHP – How to use isSupersetOf() method of phpArray class PHP – How to use isNotSupersetOf() method of phpArray class PHP – How to use isStrictSubsetOf() method of phpArray class PHP – How to use isNotStrictSubsetOf() method of phpArray class PHP – How to use isStrictSupersetOf() method of phpArray class PHP – How to use isNotStrictSupersetOf() method of phpArray class PHP – How to use isNotEqualTo() method of phpArray class
isIdenticalTo
Using AI Code Generation
1require_once 'phpArray.php';2$a1 = array(1, 2, 3);3$a2 = array(1, 2, 3);4$a3 = array(1, 2, 4);5$a4 = array(1, 2, 3, 4);6$a5 = array(1, 2, 3, 4);7$array = new phpArray($a1);8require_once 'phpArray.php';9$a1 = array(1, 2, 3);10$a2 = array(1, 2, 3);11$a3 = array(1, 2, 4);12$a4 = array(1, 2, 3, 4);13$a5 = array(1, 2, 3, 4);14$array = new phpArray($a1);15require_once 'phpArray.php';16$a1 = array(1, 2, 3);17$a2 = array(1, 2, 3);18$a3 = array(1, 2, 4);19$a4 = array(1, 2, 3, 4);20$a5 = array(1, 2, 3, 4);21$array = new phpArray($a1);
isIdenticalTo
Using AI Code Generation
1$array = new phpArray(array(1, 2, 3, 4, 5));2$array2 = new phpArray(array(1, 2, 3, 4, 5));3if($array->isIdenticalTo($array2)) {4 echo 'Both array are identical';5} else {6 echo 'Both array are not identical';7}8$array = new phpArray(array(1, 2, 3, 4, 5));9$array2 = new phpArray(array(1, 2, 3, 4, 5, 6));10if($array->isIdenticalTo($array2)) {11 echo 'Both array are identical';12} else {13 echo 'Both array are not identical';14}15$array = new phpArray(array(1, 2, 3, 4, 5));16$array2 = new phpArray(array(1, 2, 3, 4, 6));17if($array->isIdenticalTo($array2)) {18 echo 'Both array are identical';19} else {20 echo 'Both array are not identical';21}22$array = new phpArray(array(1, 2, 3, 4, 5));23$array2 = new phpArray(array(1, 2, 3, 4, 5));24if($array->isIdenticalTo($array2, true)) {25 echo 'Both array are identical';26} else {27 echo 'Both array are not identical';28}29$array = new phpArray(array(1, 2, 3
isIdenticalTo
Using AI Code Generation
1$phpArray1 = new phpArray(array(1,2,3));2$phpArray2 = new phpArray(array(1,2,3));3if ($phpArray1->isIdenticalTo($phpArray2)) {4 echo "The two arrays are identical";5} else {6 echo "The two arrays are not identical";7}8$phpArray1 = new phpArray(array(1,2,3));9$phpArray2 = new phpArray(array(1,2,3,4));10if ($phpArray1->isIdenticalTo($phpArray2)) {11 echo "The two arrays are identical";12} else {13 echo "The two arrays are not identical";14}15Related Posts: PHP | array_diff() function16PHP | array_diff_assoc() function17PHP | array_diff_key() function18PHP | array_diff_uassoc() function19PHP | array_diff_ukey() function20PHP | array_udiff() function21PHP | array_udiff_assoc() function22PHP | array_udiff_uassoc() function23PHP | array_uintersect() function24PHP | array_uintersect_assoc() function25PHP | array_uintersect_uassoc() function26PHP | array_intersect() function27PHP | array_intersect_assoc() function28PHP | array_intersect_key() function29PHP | array_intersect_uassoc() function30PHP | array_intersect_ukey() function31PHP | array_uintersect_assoc() function32PHP | array_uintersect_uassoc() function33PHP | array_unique() function34PHP | array_merge_recursive() function35PHP | array_merge() function36PHP | array_replace() function37PHP | array_replace_recursive() function38PHP | array_values() function39PHP | array_keys() function40PHP | array_filter() function41PHP | array_map() function42PHP | array_walk() function43PHP | array_walk_recursive() function44PHP | array_pad() function45PHP | array_reverse() function46PHP | array_search() function47PHP | array_slice() function48PHP | array_splice() function49PHP | array_sum() function50PHP | array_product() function51PHP | array_push() function
isIdenticalTo
Using AI Code Generation
1include('phpArray.php');2$phpArrayObject = new phpArray();3$array = array(1,2,3,4,5);4$phpArrayObject->setArray($array);5include('phpArray.php');6$phpArrayObject = new phpArray();7$array = array(1,2,3,4,5);8$phpArrayObject->setArray($array);9include('phpArray.php');10$phpArrayObject = new phpArray();11$array = array(1,2,3,4,5);12$phpArrayObject->setArray($array);13$phpArrayObject->isIdenticalTo(array(1
isIdenticalTo
Using AI Code Generation
1require('phpArray.php');2$array1 = array(1,2,3,4,5);3$array2 = array(1,2,3,4,5);4$phpArray = new phpArray();5$result = $phpArray->isIdenticalTo($array1, $array2);6echo "Result: ".$result;
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with isIdenticalTo on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!