Best Atoum code snippet using analyzer.getTypeOf
phpArray.php
Source:phpArray.php
...135 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())136 )137 ->if(138 $this->calling($locale)->_ = $notAnArray = uniqid(),139 $this->calling($analyzer)->getTypeOf = $type = uniqid()140 )141 ->then142 ->exception(function() use ($asserter, & $value) { $asserter->setWith($value = uniqid()); })143 ->isInstanceOf('mageekguy\atoum\asserter\exception')144 ->hasMessage($notAnArray)145 ->mock($locale)->call('_')->withArguments('%s is not an array', $type)->once146 ->object($asserter->setWith($value = array()))->isIdenticalTo($asserter)147 ->array($asserter->getValue())->isEqualTo($value)148 ->variable($asserter->getKey())->isNull()149 ->variable($asserter->getInnerAsserter())->isNull()150 ->variable($asserter->getInnerValue())->isNull()151 ->boolean($asserter->isSetByReference())->isFalse()152 ->if($asserter->object)153 ->then154 ->variable($innerAsserter = $asserter->getInnerAsserter())->isNotNull()155 ->object($objectAsserter = $asserter->setWith($object = new \mock\object()))->isIdenticalTo($innerAsserter)156 ->object($objectAsserter->getValue())->isIdenticalTo($object)157 ->variable($asserter->getValue())->isNull()158 ->boolean($asserter->wasSet())->isFalse()159 ->boolean($asserter->isSetByReference())->isFalse()160 ->variable($asserter->getKey())->isNull()161 ->variable($asserter->getInnerAsserter())->isNull()162 ->variable($asserter->getInnerValue())->isNull()163 ;164 }165 public function testOffsetGet()166 {167 $this168 ->given($asserter = $this->newTestedInstance169 ->setLocale($locale = new \mock\atoum\locale())170 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())171 )172 ->then173 ->exception(function() use ($asserter) { $asserter[2]; })174 ->isInstanceOf('mageekguy\atoum\exceptions\logic')175 ->hasMessage('Array is undefined')176 ->if(177 $this->calling($locale)->_ = $notAnArray = uniqid(),178 $this->calling($analyzer)->getTypeOf = $type = uniqid(),179 $asserter->setWith(array(1, 2, $object = new \mock\object(), clone $object))180 )181 ->then182 ->exception(function() use ($asserter, & $value) { $asserter[2]; })183 ->isInstanceOf('mageekguy\atoum\asserter\exception')184 ->hasMessage($notAnArray)185 ->mock($locale)->call('_')->withArguments('Value %s at key %s is not an array', $type, 2)->once186 ->if($asserter->setWith(array(1, 2, $object = new \mock\object(), clone $object)))187 ->then188 ->object($asserter->object[2]->isIdenticalTo($object))->isIdenticalTo($asserter)189 ->object($asserter->object[2]->isIdenticalTo($object))->isIdenticalTo($asserter)190 ->object($asserter->object[3]->isCloneOf($object))->isIdenticalTo($asserter)191 ->object($asserter->object[2])->isIdenticalTo($asserter)192 ->given($asserter = $this->newTestedInstance193 ->setLocale($locale)194 ->setAnalyzer($analyzer)195 )196 ->if($asserter->setWith($array = array($integer = rand(1, PHP_INT_MAX), 2, $innerArray = array(3, 4, 5, $object))))197 ->then198 ->object($asserter[2])199 ->isIdenticalTo($asserter)200 ->array($asserter->getValue())->isEqualTo($innerArray)201 ->if($asserter->setWith($array))202 ->then203 ->object($asserter->integer[0]->isEqualTo($integer))->isIdenticalTo($asserter)204 ->object($asserter->object[2][3]->isIdenticalTo($object))->isIdenticalTo($asserter)205 ->object($asserter->object[2][3]->isIdenticalTo($object)->integer[0]->isEqualTo($integer))->isIdenticalTo($asserter)206 ->object($asserter->object[2][3]->isIdenticalTo($object)->integer($integer)->isEqualTo($integer))207 ->isNotIdenticalTo($asserter)208 ->isInstanceOf('mageekguy\atoum\asserters\integer')209 ->if(210 $this->calling($locale)->_ = $unknownKey = uniqid(),211 $this->calling($analyzer)->getTypeOf = function($value) use ($innerArray, & $innerArrayType, & $keyType) { return ($innerArray === $value ? ($innerArrayType = uniqid()) : ($keyType = uniqid())); }212 )213 ->then214 ->exception(function() use ($asserter) { $asserter->object[2][4]; })215 ->isInstanceOf('mageekguy\atoum\asserter\exception')216 ->hasMessage($unknownKey)217 ->mock($locale)->call('_')->withArguments('%s has no key %s', $innerArrayType, $keyType)->once218 ;219 }220 public function testOffsetSet()221 {222 $this223 ->given($asserter = $this->newTestedInstance)224 ->then225 ->exception(function() use ($asserter) { $asserter[rand(0, PHP_INT_MAX)] = rand(0, PHP_INT_MAX); })226 ->isInstanceOf('mageekguy\atoum\exceptions\logic')227 ->hasMessage('Tested array is read only')228 ;229 }230 public function testOffsetUnset()231 {232 $this233 ->given($asserter = $this->newTestedInstance)234 ->then235 ->exception(function() use ($asserter) { unset($asserter[rand(0, PHP_INT_MAX)]); })236 ->isInstanceOf('mageekguy\atoum\exceptions\logic')237 ->hasMessage('Array is read only')238 ;239 }240 public function testOffsetExists()241 {242 $this243 ->given($asserter = $this->newTestedInstance)244 ->then245 ->boolean(isset($asserter[rand(0, PHP_INT_MAX)]))->isFalse()246 ->if($asserter->setWith(array()))247 ->then248 ->boolean(isset($asserter[rand(0, PHP_INT_MAX)]))->isFalse()249 ->if($asserter->setWith(array(uniqid())))250 ->then251 ->boolean(isset($asserter[0]))->isTrue()252 ->boolean(isset($asserter[rand(1, PHP_INT_MAX)]))->isFalse()253 ->if($asserter->setWith(array($key = uniqid() => uniqid())))254 ->then255 ->boolean(isset($asserter[$key]))->isTrue()256 ->boolean(isset($asserter[0]))->isFalse()257 ->boolean(isset($asserter[rand(1, PHP_INT_MAX)]))->isFalse()258 ;259 }260 public function testHasSize()261 {262 $this263 ->given($asserter = $this->newTestedInstance264 ->setLocale($locale = new \mock\atoum\locale())265 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())266 )267 ->then268 ->exception(function() use ($asserter) { $asserter->hasSize(rand(0, PHP_INT_MAX)); })269 ->isInstanceOf('mageekguy\atoum\exceptions\logic')270 ->hasMessage('Array is undefined')271 ->if(272 $this->calling($locale)->_ = $badSize = uniqid(),273 $this->calling($analyzer)->getTypeOf = $type = uniqid(),274 $asserter->setWith(array())275 )276 ->then277 ->exception(function() use ($asserter, & $size) { $asserter->hasSize($size = rand(1, PHP_INT_MAX)); })278 ->isInstanceOf('mageekguy\atoum\asserter\exception')279 ->hasMessage($badSize)280 ->mock($locale)->call('_')->withArguments('%s has size %d, expected size %d', $asserter, 0, $size)->once281 ->exception(function() use ($asserter, & $failMessage) { $asserter->hasSize(rand(1, PHP_INT_MAX), $failMessage = uniqid()); })282 ->isInstanceOf('mageekguy\atoum\asserter\exception')283 ->hasMessage($failMessage)284 ->object($asserter->hasSize(0))->isIdenticalTo($asserter)285 ->if($asserter->setWith(range(1, 5)))286 ->then287 ->object($asserter->hasSize(5))->isIdenticalTo($asserter)288 ;289 }290 public function testHasSizeOnInnerAsserter()291 {292 $this293 ->given($asserter = $this->newTestedInstance)294 ->then295 ->exception(function() use ($asserter) { $asserter->isEmpty(); })296 ->isInstanceOf('mageekguy\atoum\exceptions\logic')297 ->hasMessage('Array is undefined')298 ->if($asserter->setWith(array(range(1, 5))))299 ->then300 ->object($childAsserter = $asserter->child[0](function($child) { $child->hasSize(5); }))->isInstanceOf('mageekguy\atoum\asserters\phpArray\child')301 ->object($childAsserter->hasSize(1))->isIdenticalTo($asserter)302 ->given($asserter = $this->newTestedInstance)303 ->if($asserter->setWith(array(array(range(1, 5), range(1, 3)))))304 ->then305 ->object($childAsserter = $asserter->child[0][1](function($child) { $child->hasSize(3); }))->isInstanceOf('mageekguy\atoum\asserters\phpArray\child')306 ->object($childAsserter->hasSize(1))->isIdenticalTo($asserter)307 ;308 }309 public function testIsEmpty()310 {311 $this312 ->given($asserter = $this->newTestedInstance313 ->setLocale($locale = new \mock\atoum\locale())314 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())315 )316 ->then317 ->exception(function() use ($asserter) { $asserter->isEmpty(); })318 ->isInstanceOf('mageekguy\atoum\exceptions\logic')319 ->hasMessage('Array is undefined')320 ->if(321 $this->calling($locale)->_ = $notEmpty = uniqid(),322 $asserter->setWith(array(uniqid()))323 )324 ->then325 ->exception(function() use ($asserter) { $asserter->isEmpty(); })326 ->isInstanceOf('mageekguy\atoum\asserter\exception')327 ->hasMessage($notEmpty)328 ->mock($locale)->call('_')->withArguments('%s is not empty', $asserter)->once329 ->exception(function() use ($asserter) { $asserter->isEmpty; })330 ->isInstanceOf('mageekguy\atoum\asserter\exception')331 ->hasMessage($notEmpty)332 ->mock($locale)->call('_')->withArguments('%s is not empty', $asserter)->twice333 ->exception(function() use ($asserter, & $failMessage) { $asserter->isEmpty($failMessage = uniqid()); })334 ->isInstanceOf('mageekguy\atoum\asserter\exception')335 ->hasMessage($failMessage)336 ->if($asserter->setWith(array()))337 ->then338 ->object($asserter->isEmpty())->isIdenticalTo($asserter)339 ;340 }341 public function testIsNotEmpty()342 {343 $this344 ->given($asserter = $this->newTestedInstance345 ->setLocale($locale = new \mock\atoum\locale())346 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())347 )348 ->then349 ->exception(function() use ($asserter) { $asserter->isNotEmpty(); })350 ->isInstanceOf('mageekguy\atoum\exceptions\logic')351 ->hasMessage('Array is undefined')352 ->if(353 $this->calling($locale)->_ = $isEmpty = uniqid(),354 $this->calling($analyzer)->getTypeOf = $type = uniqid(),355 $asserter->setWith(array())356 )357 ->then358 ->exception(function() use ($asserter) { $asserter->isNotEmpty(); })359 ->isInstanceOf('mageekguy\atoum\asserter\exception')360 ->hasMessage($isEmpty)361 ->mock($locale)->call('_')->withArguments('%s is empty', $asserter)->once362 ->exception(function() use ($asserter) { $asserter->isNotEmpty; })363 ->isInstanceOf('mageekguy\atoum\asserter\exception')364 ->hasMessage($isEmpty)365 ->mock($locale)->call('_')->withArguments('%s is empty', $asserter)->twice366 ->exception(function() use ($asserter, & $failMessage) { $asserter->isNotEmpty($failMessage = uniqid()); })367 ->isInstanceOf('mageekguy\atoum\asserter\exception')368 ->hasMessage($failMessage)369 ->if($asserter->setWith(array(uniqid())))370 ->then371 ->object($asserter->isNotEmpty())->isIdenticalTo($asserter)372 ;373 }374 public function testAtKey()375 {376 $this377 ->given($asserter = $this->newTestedInstance378 ->setLocale($locale = new \mock\atoum\locale())379 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())380 )381 ->then382 ->exception(function() use ($asserter) { $asserter->atKey(uniqid()); })383 ->isInstanceOf('mageekguy\atoum\exceptions\logic')384 ->hasMessage('Array is undefined')385 ->if($asserter->setWith(array(uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid())))386 ->object($asserter->atKey(0))->isIdenticalTo($asserter)387 ->object($asserter->atKey('0'))->isIdenticalTo($asserter)388 ->object($asserter->atKey(1))->isIdenticalTo($asserter)389 ->object($asserter->atKey(2))->isIdenticalTo($asserter)390 ->object($asserter->atKey(3))->isIdenticalTo($asserter)391 ->object($asserter->atKey(4))->isIdenticalTo($asserter)392 ->if(393 $this->calling($locale)->_ = $unknownKey = uniqid(),394 $this->calling($analyzer)->getTypeOf = $type = uniqid()395 )396 ->then397 ->exception(function() use ($asserter, & $key) { $asserter->atKey($key = rand(5, PHP_INT_MAX)); })398 ->isInstanceOf('mageekguy\atoum\asserter\exception')399 ->hasMessage($unknownKey)400 ->mock($locale)->call('_')->withArguments('%s has no key %s', $asserter, $type)->once401 ->mock($analyzer)->call('getTypeOf')->withArguments($key)->once402 ->exception(function() use ($asserter, & $failMessage) { $asserter->atKey(rand(5, PHP_INT_MAX), $failMessage = uniqid()); })403 ->isInstanceOf('mageekguy\atoum\asserter\exception')404 ->hasMessage($failMessage)405 ;406 }407 public function testContains()408 {409 $this410 ->given($asserter = $this->newTestedInstance411 ->setLocale($locale = new \mock\atoum\locale())412 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())413 )414 ->then415 ->exception(function() use ($asserter) { $asserter->contains(uniqid()); })416 ->isInstanceOf('mageekguy\atoum\exceptions\logic')417 ->hasMessage('Array is undefined')418 ->if(419 $this->calling($locale)->_ = $notInArray = uniqid(),420 $this->calling($analyzer)->getTypeOf = $type = uniqid(),421 $asserter->setWith(array(uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid()))422 )423 ->then424 ->exception(function() use ($asserter, & $unknownValue) { $asserter->contains($unknownValue = uniqid()); })425 ->isInstanceOf('mageekguy\atoum\asserter\exception')426 ->hasMessage($notInArray)427 ->mock($locale)->call('_')->withArguments('%s does not contain %s', $asserter, $type)->once428 ->mock($analyzer)->call('getTypeOf')->withArguments($unknownValue)->once429 ->exception(function() use ($asserter, & $failMessage) { $asserter->contains(uniqid(), $failMessage = uniqid()); })430 ->isInstanceOf('mageekguy\atoum\asserter\exception')431 ->hasMessage($failMessage)432 ->object($asserter->contains($data))->isIdenticalTo($asserter)433 ->object($asserter->contains((string) $data))->isIdenticalTo($asserter)434 ->if(435 $this->calling($locale)->_ = $notInArrayAtKey = uniqid(),436 $this->calling($analyzer)->getTypeOf = $type = uniqid(),437 $asserter->setWith(array(uniqid(), uniqid(), $data = rand(1, PHP_INT_MAX), uniqid(), uniqid()))438 )439 ->then440 ->exception(function() use ($asserter, $data) { $asserter->atKey(0)->contains($data); })441 ->isInstanceOf('mageekguy\atoum\asserter\exception')442 ->hasMessage($notInArrayAtKey)443 ->object($asserter->contains($data))->isIdenticalTo($asserter)444 ->object($asserter->atKey(2)->contains($data))->isIdenticalTo($asserter)445 ->exception(function() use ($asserter, & $failMessage) { $asserter->atKey(0)->contains(uniqid(), $failMessage = uniqid()); })446 ->isInstanceOf('mageekguy\atoum\asserter\exception')447 ->hasMessage($failMessage)448 ;449 }450 public function testStrictlyContains()451 {452 $this453 ->given($asserter = $this->newTestedInstance454 ->setLocale($locale = new \mock\atoum\locale())455 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())456 )457 ->then458 ->exception(function() use ($asserter) { $asserter->strictlyContains(uniqid()); })459 ->isInstanceOf('mageekguy\atoum\exceptions\logic')460 ->hasMessage('Array is undefined')461 ->if(462 $this->calling($locale)->_ = $notInArray = uniqid(),463 $this->calling($analyzer)->getTypeOf = $type = uniqid(),464 $asserter->setWith(array(1, 2, 3, 4, 5, '3'))465 )466 ->then467 ->exception(function() use ($asserter) {$asserter->strictlyContains('1'); })468 ->isInstanceOf('mageekguy\atoum\asserter\exception')469 ->hasMessage($notInArray)470 ->mock($locale)->call('_')->withArguments('%s does not strictly contain %s', $asserter, $type)->once471 ->mock($analyzer)->call('getTypeOf')->withArguments('1')->once472 ->exception(function() use ($asserter, & $failMessage) {$asserter->strictlyContains('1', $failMessage = uniqid()); })473 ->isInstanceOf('mageekguy\atoum\asserter\exception')474 ->hasMessage($failMessage)475 ->object($asserter->strictlyContains(1))->isIdenticalTo($asserter)476 ->if($this->calling($analyzer)->getTypeOf = function($value) use (& $notInArrayType, & $keyType) { return ($value === 2 ? ($notInArrayType = uniqid()) : ($keyType = uniqid())); })477 ->then478 ->exception(function() use ($asserter) { $asserter->atKey(0)->strictlyContains(2); })479 ->isInstanceOf('mageekguy\atoum\asserter\exception')480 ->hasMessage($notInArray)481 ->mock($locale)->call('_')->withArguments('%s does not strictly contain %s at key %s', $asserter, $notInArrayType, $keyType)->once482 ->mock($analyzer)->call('getTypeOf')->withArguments(2)->once483 ->exception(function() use ($asserter, & $failMessage) { $asserter->atKey(0)->strictlyContains(2, $failMessage = uniqid()); })484 ->isInstanceOf('mageekguy\atoum\asserter\exception')485 ->hasMessage($failMessage)486 ;487 }488 public function testNotContains()489 {490 $this491 ->given($asserter = $this->newTestedInstance492 ->setLocale($locale = new \mock\atoum\locale())493 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())494 )495 ->then496 ->exception(function() use ($asserter) { $asserter->notContains(uniqid()); })497 ->isInstanceOf('mageekguy\atoum\exceptions\logic')498 ->hasMessage('Array is undefined')499 ->if($asserter->setWith(array(uniqid(), uniqid(), $isInArray = uniqid(), uniqid(), uniqid())))500 ->then501 ->object($asserter->notContains(uniqid()))->isIdenticalTo($asserter)502 ->if(503 $this->calling($locale)->_ = $inArray = uniqid(),504 $this->calling($analyzer)->getTypeOf = $type = uniqid()505 )506 ->then507 ->exception(function() use ($asserter, $isInArray) { $asserter->notContains($isInArray); })508 ->isInstanceOf('mageekguy\atoum\asserter\exception')509 ->hasMessage($inArray)510 ->mock($locale)->call('_')->withArguments('%s contains %s', $asserter, $type)->once511 ->mock($analyzer)->call('getTypeOf')->withArguments($isInArray)->once512 ->exception(function() use ($asserter, $isInArray, & $failMessage) { $asserter->notContains($isInArray, $failMessage = uniqid()); })513 ->isInstanceOf('mageekguy\atoum\asserter\exception')514 ->hasMessage($failMessage)515 ->object($asserter->atKey(0)->notContains($inArray))->isIdenticalTo($asserter)516 ->object($asserter->atKey(1)->notContains($inArray))->isIdenticalTo($asserter)517 ->object($asserter->atKey(3)->notContains($inArray))->isIdenticalTo($asserter)518 ->object($asserter->atKey(4)->notContains($inArray))->isIdenticalTo($asserter)519 ->if(520 $this->calling($locale)->_ = $inArray = uniqid(),521 $this->calling($analyzer)->getTypeOf = function($value) use ($isInArray, & $isInArrayType, & $keyType) { return ($isInArray === $value ? ($isInArrayType = uniqid()) : ($keyType = uniqid())); }522 )523 ->then524 ->exception(function() use ($asserter, $isInArray) { $asserter->atKey(2)->notContains($isInArray); })525 ->isInstanceOf('mageekguy\atoum\asserter\exception')526 ->hasMessage($inArray)527 ->mock($locale)->call('_')->withArguments('%s contains %s at key %s', $asserter, $isInArrayType, $keyType)->once528 ->mock($analyzer)529 ->call('getTypeOf')530 ->withArguments($isInArray)->twice531 ->withArguments(2)->once532 ->exception(function() use ($asserter, $isInArray, & $failMessage) { $asserter->atKey(2)->notContains($isInArray, $failMessage = 'FAIL'); })533 ->isInstanceOf('mageekguy\atoum\asserter\exception')534 ->hasMessage($failMessage)535 ;536 }537 public function testStrictlyNotContains()538 {539 $this540 ->given($asserter = $this->newTestedInstance541 ->setLocale($locale = new \mock\atoum\locale())542 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())543 )544 ->then545 ->exception(function() use ($asserter) { $asserter->strictlyNotContains(uniqid()); })546 ->isInstanceOf('mageekguy\atoum\exceptions\logic')547 ->hasMessage('Array is undefined')548 ->if(549 $this->calling($locale)->_ = $strictlyNotInArray = uniqid(),550 $this->calling($analyzer)->getTypeOf = $type = uniqid(),551 $asserter->setWith(array(1, 2, 3, 4, 5, '6'))552 )553 ->then554 ->exception(function() use ($asserter) {$asserter->strictlyNotContains(1); })555 ->isInstanceOf('mageekguy\atoum\asserter\exception')556 ->hasMessage($strictlyNotInArray)557 ->mock($locale)->call('_')->withArguments('%s strictly contains %s', $asserter, $type)->once558 ->mock($analyzer)->call('getTypeOf')->withArguments(1)->once559 ->exception(function() use ($asserter, & $failMessage) {$asserter->strictlyNotContains(1, $failMessage = uniqid()); })560 ->isInstanceOf('mageekguy\atoum\asserter\exception')561 ->hasMessage($failMessage)562 ->object($asserter->strictlyNotContains('1'))->isIdenticalTo($asserter)563 ->object($asserter->atKey(1)->strictlyNotContains(1))->isIdenticalTo($asserter)564 ->object($asserter->atKey(2)->strictlyNotContains(1))->isIdenticalTo($asserter)565 ->object($asserter->atKey(3)->strictlyNotContains(1))->isIdenticalTo($asserter)566 ->object($asserter->atKey(4)->strictlyNotContains(1))->isIdenticalTo($asserter)567 ->if($this->calling($analyzer)->getTypeOf = function($value) use (& $strictlyNotInArrayType, & $keyType) { return ($value === 1 ? ($strictlyNotInArrayType = uniqid()) : ($keyType = uniqid())); })568 ->then569 ->exception(function() use ($asserter) { $asserter->atKey(0)->strictlyNotContains(1); })570 ->isInstanceOf('mageekguy\atoum\asserter\exception')571 ->hasMessage($strictlyNotInArray)572 ->mock($locale)->call('_')->withArguments('%s strictly contains %s at key %s', $asserter, $strictlyNotInArrayType, $keyType)->once573 ->mock($analyzer)->call('getTypeOf')->withArguments(0)->once574 ;575 }576 public function testContainsValues()577 {578 $this579 ->given($asserter = $this->newTestedInstance580 ->setLocale($locale = new \mock\atoum\locale())581 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())582 )583 ->then584 ->exception(function() use ($asserter) { $asserter->containsValues(array(6)); })585 ->isInstanceOf('mageekguy\atoum\exceptions\logic')586 ->hasMessage('Array is undefined')587 ->if(588 $this->calling($locale)->_ = $notContainsValues = uniqid(),589 $this->calling($analyzer)->getTypeOf = $type = uniqid(),590 $asserter->setWith(array(1, 2, 3, 4, 5))591 )592 ->then593 ->exception(function() use ($asserter) { $asserter->containsValues(array(6)); })594 ->isInstanceOf('mageekguy\atoum\asserter\exception')595 ->hasMessage($notContainsValues)596 ->mock($locale)->call('_')->withArguments('%s does not contain values %s', $asserter, $type)->once597 ->mock($analyzer)->call('getTypeOf')->withArguments(array(6))->once598 ->exception(function() use ($asserter, & $failMessage) { $asserter->containsValues(array(6), $failMessage = uniqid()); })599 ->isInstanceOf('mageekguy\atoum\asserter\exception')600 ->hasMessage($failMessage)601 ->object($asserter->containsValues(array(1)))->isIdenticalTo($asserter)602 ->object($asserter->containsValues(array('1')))->isIdenticalTo($asserter)603 ->object($asserter->containsValues(array(1, 2, 4)))->isIdenticalTo($asserter)604 ->object($asserter->containsValues(array('1', 2, '4')))->isIdenticalTo($asserter)605 ;606 }607 public function testStrictlyContainsValues()608 {609 $this610 ->given($asserter = $this->newTestedInstance611 ->setLocale($locale = new \mock\atoum\locale())612 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())613 )614 ->then615 ->exception(function() use ($asserter) { $asserter->strictlyContainsValues(array(6)); })616 ->isInstanceOf('mageekguy\atoum\exceptions\logic')617 ->hasMessage('Array is undefined')618 ->if(619 $this->calling($locale)->_ = $strictlyNotContainsValues = uniqid(),620 $this->calling($analyzer)->getTypeOf = $type = uniqid(),621 $asserter->setWith(array(1, 2, 3, 4, 5))622 )623 ->then624 ->exception(function() use ($asserter) { $asserter->strictlyContainsValues(array(1, '5')); })625 ->isInstanceOf('mageekguy\atoum\asserter\exception')626 ->hasMessage($strictlyNotContainsValues)627 ->mock($locale)->call('_')->withArguments('%s does not contain strictly values %s', $asserter, $type)->once628 ->mock($analyzer)->call('getTypeOf')->withArguments(array('5'))->once629 ->exception(function() use ($asserter, & $failMessage) { $asserter->strictlyContainsValues(array('5'), $failMessage = uniqid()); })630 ->isInstanceOf('mageekguy\atoum\asserter\exception')631 ->hasMessage($failMessage)632 ->object($asserter->strictlyContainsValues(array(1)))->isIdenticalTo($asserter)633 ->object($asserter->strictlyContainsValues(array(1, 2)))->isIdenticalTo($asserter)634 ->object($asserter->strictlyContainsValues(array(1, 2, 3)))->isIdenticalTo($asserter)635 ->object($asserter->strictlyContainsValues(array(1, 2, 3, 4)))->isIdenticalTo($asserter)636 ->object($asserter->strictlyContainsValues(array(1, 2, 3, 4, 5)))->isIdenticalTo($asserter)637 ;638 }639 public function testNotContainsValues()640 {641 $this642 ->given($asserter = $this->newTestedInstance643 ->setLocale($locale = new \mock\atoum\locale())644 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())645 )646 ->then647 ->exception(function() use ($asserter) { $asserter->notContainsValues(array(1, 6)); })648 ->isInstanceOf('mageekguy\atoum\exceptions\logic')649 ->hasMessage('Array is undefined')650 ->if(651 $this->calling($locale)->_ = $containsValues = uniqid(),652 $this->calling($analyzer)->getTypeOf = $type = uniqid(),653 $asserter->setWith(array(1, 2, 3, 4, 5))654 )655 ->then656 ->exception(function() use ($asserter) { $asserter->notContainsValues(array(1, 6)); })657 ->isInstanceOf('mageekguy\atoum\asserter\exception')658 ->hasMessage($containsValues)659 ->mock($locale)->call('_')->withArguments('%s contains values %s', $asserter, $type)->once660 ->mock($analyzer)->call('getTypeOf')->withArguments(array(1))->once661 ->exception(function() use ($asserter, & $failMessage) { $asserter->notContainsValues(array(1, 6), $failMessage = uniqid()); })662 ->isInstanceOf('mageekguy\atoum\asserter\exception')663 ->hasMessage($failMessage)664 ->object($asserter->notContainsValues(array(6)))->isIdenticalTo($asserter)665 ->object($asserter->notContainsValues(array('6')))->isIdenticalTo($asserter)666 ->object($asserter->notContainsValues(array(6, 7)))->isIdenticalTo($asserter)667 ->object($asserter->notContainsValues(array('6', '7')))->isIdenticalTo($asserter)668 ->object($asserter->notContainsValues(array(6, 7, 8)))->isIdenticalTo($asserter)669 ->object($asserter->notContainsValues(array('6', 7, '8')))->isIdenticalTo($asserter)670 ;671 }672 public function testStrictlyNotContainsValues()673 {674 $this675 ->given($asserter = $this->newTestedInstance676 ->setLocale($locale = new \mock\atoum\locale())677 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())678 )679 ->then680 ->exception(function() use ($asserter) { $asserter->strictlyNotContainsValues(array(1, 6)); })681 ->isInstanceOf('mageekguy\atoum\exceptions\logic')682 ->hasMessage('Array is undefined')683 ->if(684 $this->calling($locale)->_ = $containsStrictlyValues = uniqid(),685 $this->calling($analyzer)->getTypeOf = $type = uniqid(),686 $asserter->setWith(array(1, 2, 3, 4, 5))687 )688 ->then689 ->exception(function() use ($asserter) { $asserter->strictlyNotContainsValues(array(1, '2', '4')); })690 ->isInstanceOf('mageekguy\atoum\asserter\exception')691 ->hasMessage($containsStrictlyValues)692 ->mock($locale)->call('_')->withArguments('%s contains strictly values %s', $asserter, $type)->once693 ->mock($analyzer)->call('getTypeOf')->withArguments(array(1))->once694 ->exception(function() use ($asserter, & $failMessage) { $asserter->strictlyNotContainsValues(array(1), $failMessage = uniqid()); })695 ->isInstanceOf('mageekguy\atoum\asserter\exception')696 ->hasMessage($failMessage)697 ->object($asserter->strictlyNotContainsValues(array('1')))->isIdenticalTo($asserter)698 ->object($asserter->strictlyNotContainsValues(array('1', '2')))->isIdenticalTo($asserter)699 ->object($asserter->strictlyNotContainsValues(array('1', '2', '3')))->isIdenticalTo($asserter)700 ->object($asserter->strictlyNotContainsValues(array('1', '2', '3', '4')))->isIdenticalTo($asserter)701 ->object($asserter->strictlyNotContainsValues(array('1', '2', '3', '4', '5')))->isIdenticalTo($asserter)702 ->object($asserter->strictlyNotContainsValues(array('6', '7')))->isIdenticalTo($asserter)703 ;704 }705 public function testHasKey()706 {707 $this708 ->given($asserter = $this->newTestedInstance709 ->setLocale($locale = new \mock\atoum\locale())710 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())711 )712 ->then713 ->exception(function() use ($asserter) { $asserter->hasKey(rand(0, PHP_INT_MAX)); })714 ->isInstanceOf('mageekguy\atoum\exceptions\logic')715 ->hasMessage('Array is undefined')716 ->if(717 $this->calling($locale)->_ = $notHasKey = uniqid(),718 $this->calling($analyzer)->getTypeOf = $type = uniqid(),719 $asserter->setWith(array())720 )721 ->then722 ->exception(function() use ($asserter, & $key) { $asserter->hasKey($key = rand(1, PHP_INT_MAX)); })723 ->isInstanceOf('mageekguy\atoum\asserter\exception')724 ->hasMessage($notHasKey)725 ->mock($locale)->call('_')->withArguments('%s has no key %s', $asserter, $type)->once726 ->mock($analyzer)->call('getTypeOf')->withArguments($key)->once727 ->exception(function() use ($asserter, & $key, & $failMessage) { $asserter->hasKey($key = rand(1, PHP_INT_MAX), $failMessage = uniqid()); })728 ->isInstanceOf('mageekguy\atoum\asserter\exception')729 ->hasMessage($failMessage)730 ->if($asserter->setWith(array(uniqid(), uniqid(), uniqid(), uniqid(), uniqid(), '5' => uniqid())))731 ->then732 ->object($asserter->hasKey(0))->isIdenticalTo($asserter)733 ->object($asserter->hasKey(1))->isIdenticalTo($asserter)734 ->object($asserter->hasKey(2))->isIdenticalTo($asserter)735 ->object($asserter->hasKey(3))->isIdenticalTo($asserter)736 ->object($asserter->hasKey(4))->isIdenticalTo($asserter)737 ->object($asserter->hasKey(5))->isIdenticalTo($asserter)738 ->object($asserter->hasKey('5'))->isIdenticalTo($asserter)739 ;740 }741 public function testNotHasKey()742 {743 $this744 ->given($asserter = $this->newTestedInstance745 ->setLocale($locale = new \mock\atoum\locale())746 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())747 )748 ->then749 ->exception(function() use ($asserter) { $asserter->notHasKey(rand(0, PHP_INT_MAX)); })750 ->isInstanceOf('mageekguy\atoum\exceptions\logic')751 ->hasMessage('Array is undefined')752 ->if($asserter->setWith(array()))753 ->then754 ->object($asserter->notHasKey(rand(-PHP_INT_MAX, PHP_INT_MAX)))->isIdenticalTo($asserter)755 ->object($asserter->notHasKey(uniqid()))->isIdenticalTo($asserter)756 ->if(757 $this->calling($locale)->_ = $hasKey = uniqid(),758 $this->calling($analyzer)->getTypeOf = $keyType = uniqid(),759 $asserter->setWith(array(uniqid(), uniqid(), uniqid(), uniqid(), uniqid()))760 )761 ->then762 ->exception(function() use ($asserter) { $asserter->notHasKey(0); })763 ->isInstanceOf('mageekguy\atoum\asserter\exception')764 ->hasMessage($hasKey)765 ->mock($locale)->call('_')->withArguments('%s has key %s', $asserter, $keyType)->once766 ->mock($analyzer)->call('getTypeOf')->withArguments(0)->once767 ->exception(function() use ($asserter) { $asserter->notHasKey('0'); })768 ->isInstanceOf('mageekguy\atoum\asserter\exception')769 ->hasMessage($hasKey)770 ->mock($locale)->call('_')->withArguments('%s has key %s', $asserter, $keyType)->twice771 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments('0')->once772 ;773 }774 public function testNotHasKeys()775 {776 $this777 ->given($asserter = $this->newTestedInstance778 ->setLocale($locale = new \mock\atoum\locale())779 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())780 )781 ->then782 ->exception(function() use ($asserter) { $asserter->notHasKeys(array(rand(0, PHP_INT_MAX))); })783 ->isInstanceOf('mageekguy\atoum\exceptions\logic')784 ->hasMessage('Array is undefined')785 ->if($asserter->setWith(array()))786 ->then787 ->object($asserter->notHasKeys(range(1, 5)))->isIdenticalTo($asserter)788 ->object($asserter->notHasKeys(array(uniqid(), uniqid())))->isIdenticalTo($asserter)789 ->if(790 $this->calling($locale)->_ = $hasKeys = uniqid(),791 $this->calling($analyzer)->getTypeOf = $keysType = uniqid(),792 $asserter->setWith(array(uniqid(), uniqid(), uniqid(), uniqid(), uniqid()))793 )794 ->then795 ->exception(function() use ($asserter) { $asserter->notHasKeys(array(0, 'premier', '2')); })796 ->isInstanceOf('mageekguy\atoum\asserter\exception')797 ->hasMessage($hasKeys)798 ->mock($locale)->call('_')->withArguments('%s has keys %s', $asserter, $keysType)->once799 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments(array(0 => 0, 2 => '2'))->once800 ->exception(function() use ($asserter, & $failMessage) { $asserter->notHasKeys(array(0, 'premier', 2), $failMessage = uniqid()); })801 ->isInstanceOf('mageekguy\atoum\asserter\exception')802 ->hasMessage($failMessage)803 ->object($asserter->notHasKeys(array(5, '6')))->isIdenticalTo($asserter)804 ;805 }806 public function testHasKeys()807 {808 $this809 ->given($asserter = $this->newTestedInstance810 ->setLocale($locale = new \mock\atoum\locale())811 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())812 )813 ->then814 ->exception(function() use ($asserter) { $asserter->hasKeys(array(rand(0, PHP_INT_MAX))); })815 ->isInstanceOf('mageekguy\atoum\exceptions\logic')816 ->hasMessage('Array is undefined')817 ->if(818 $this->calling($locale)->_ = $notHasKeys = uniqid(),819 $this->calling($analyzer)->getTypeOf = $keysType = uniqid(),820 $asserter->setWith(array())821 )822 ->then823 ->exception(function() use ($asserter) { $asserter->hasKeys(array(0, 1, 2)); })824 ->isInstanceOf('mageekguy\atoum\asserter\exception')825 ->hasMessage($notHasKeys)826 ->mock($locale)->call('_')->withArguments('%s has no keys %s', $asserter, $keysType)->once827 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments(array(0, 1, 2))->once828 ->exception(function() use ($asserter, & $failMessage) { $asserter->hasKeys(array(0), $failMessage = uniqid()); })829 ->isInstanceOf('mageekguy\atoum\asserter\exception')830 ->hasMessage($failMessage)831 ->if($asserter->setWith(array(uniqid(), uniqid(), uniqid(), uniqid(), uniqid())))832 ->then833 ->exception(function() use ($asserter) { $asserter->hasKeys(array(0, 'first', 2, 'second')); })834 ->isInstanceOf('mageekguy\atoum\asserter\exception')835 ->hasMessage($notHasKeys)836 ->mock($locale)->call('_')->withArguments('%s has no keys %s', $asserter, $keysType)->twice837 ->mock($analyzer)->call('getTypeOf')->withIdenticalArguments(array(1 => 'first', 3 => 'second'))->once838 ->object($asserter->hasKeys(array(0, 2, 4)))->isIdenticalTo($asserter)839 ;840 }841 public function testKeys()842 {843 $this844 ->given($asserter = $this->newTestedInstance)845 ->then846 ->exception(function() use ($asserter) { $asserter->keys; })847 ->isInstanceOf('mageekguy\atoum\exceptions\logic')848 ->hasMessage('Array is undefined')849 ->if($asserter->setWith(array()))850 ->then851 ->object($array = $asserter->keys)->isInstanceOf('mageekguy\atoum\asserters\phpArray')852 ->array($array->getValue())->isEqualTo(array())853 ->if($asserter->setWith(array($key1 = uniqid() => uniqid(), $key2 = uniqid() => uniqid())))854 ->then855 ->object($array = $asserter->keys)->isInstanceOf('mageekguy\atoum\asserters\phpArray')856 ->array($array->getValue())->isEqualTo(array($key1, $key2))857 ;858 }859 public function testSize()860 {861 $this862 ->given($asserter = $this->newTestedInstance)863 ->then864 ->exception(function() use ($asserter) { $asserter->size; })865 ->isInstanceOf('mageekguy\atoum\exceptions\logic')866 ->hasMessage('Array is undefined')867 ->if($asserter->setWith(array()))868 ->then869 ->object($integer = $asserter->size)->isInstanceOf('mageekguy\atoum\asserters\integer')870 ->integer($integer->getValue())->isEqualTo(0)871 ->if($asserter->setWith(array(uniqid(), uniqid())))872 ->then873 ->object($integer = $asserter->size)->isInstanceOf('mageekguy\atoum\asserters\integer')874 ->integer($integer->getValue())->isEqualTo(2)875 ;876 }877 public function testIsEqualTo()878 {879 $this880 ->given($asserter = $this->newTestedInstance881 ->setLocale($locale = new \mock\atoum\locale())882 ->setDiff($diff = new \mock\atoum\tools\diffs\variable())883 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())884 ->setGenerator($generator = new \mock\atoum\asserter\generator())885 )886 ->then887 ->exception(function() use ($asserter) { $asserter->isEqualTo(array()); })888 ->isInstanceOf('mageekguy\atoum\exceptions\logic')889 ->hasMessage('Array is undefined')890 ->if($asserter->setWith(array()))891 ->then892 ->object($asserter->isEqualTo(array()))->isIdenticalTo($asserter)893 ->if($asserter->setWith($array = range(1, 5)))894 ->then895 ->object($asserter->isEqualTo($array))->isIdenticalTo($asserter)896 ->if(897 $this->calling($locale)->_ = $localizedMessage = uniqid(),898 $this->calling($diff)->__toString = $diffValue = uniqid(),899 $this->calling($analyzer)->getTypeOf = $type = uniqid()900 )901 ->then902 ->exception(function() use ($asserter, & $notEqualValue) { $asserter->isEqualTo($notEqualValue = uniqid()); })903 ->isInstanceOf('mageekguy\atoum\asserter\exception')904 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)905 ->mock($locale)->call('_')->withArguments('%s is not equal to %s', $asserter, $type)->once906 ->mock($analyzer)->call('getTypeOf')->withArguments($notEqualValue)->once907 ->object($asserter->isEqualTo($array))->isIdenticalTo($asserter)908 ->given(909 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),910 $this->calling($integerAsserter)->isEqualTo->throw = $exception = new \exception(uniqid())911 )912 ->if($asserter->integer)913 ->then914 ->exception(function() use ($asserter, & $notEqualValue) { $asserter->isEqualTo($notEqualValue = uniqid()); })915 ->isInstanceOf('mageekguy\atoum\asserter\exception')916 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)917 ->mock($locale)->call('_')->withArguments('%s is not equal to %s', $asserter, $type)->twice918 ->mock($analyzer)->call('getTypeOf')->withArguments($notEqualValue)->once919 ->mock($integerAsserter)->call('isEqualTo')->never920 ->if($asserter->integer[2])921 ->then922 ->exception(function() use ($asserter, & $expectedValue) { $asserter->isEqualTo($expectedValue = rand(4, PHP_INT_MAX)); })923 ->isIdenticalTo($exception)924 ->mock($integerAsserter)->call('isEqualTo')->withArguments($expectedValue)->once925 ->if($this->method($integerAsserter)->isEqualTo->isFluent())926 ->then927 ->object($asserter->isEqualTo(3))->isIdenticalTo($asserter)928 ->mock($integerAsserter)->call('isEqualTo')->withArguments(3)->once929 ;930 }931 public function testIsNotEqualTo()932 {933 $this934 ->given($asserter = $this->newTestedInstance935 ->setLocale($locale = new \mock\atoum\locale())936 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())937 ->setGenerator($generator = new \mock\atoum\asserter\generator())938 )939 ->then940 ->exception(function() use ($asserter) { $asserter->isNotEqualTo(array()); })941 ->isInstanceOf('mageekguy\atoum\exceptions\logic')942 ->hasMessage('Array is undefined')943 ->if($asserter->setWith(array()))944 ->then945 ->object($asserter->isNotEqualTo(range(1, 2)))->isIdenticalTo($asserter)946 ->if(947 $this->calling($locale)->_ = $localizedMessage = uniqid(),948 $this->calling($analyzer)->getTypeOf = $type = uniqid()949 )950 ->then951 ->exception(function() use ($asserter) { $asserter->isNotEqualTo(array()); })952 ->isInstanceOf('mageekguy\atoum\asserter\exception')953 ->hasMessage($localizedMessage)954 ->mock($locale)->call('_')->withArguments('%s is equal to %s', $asserter, $type)->once955 ->mock($analyzer)->call('getTypeOf')->withArguments(array())->once956 ->if($asserter->setWith($array = range(1, 5)))957 ->then958 ->object($asserter->isNotEqualTo(array()))->isIdenticalTo($asserter)959 ->exception(function() use ($asserter, $array) { $asserter->isNotEqualTo($array); })960 ->isInstanceOf('mageekguy\atoum\asserter\exception')961 ->hasMessage($localizedMessage)962 ->mock($locale)->call('_')->withArguments('%s is equal to %s', $asserter, $type)->twice963 ->mock($analyzer)->call('getTypeOf')->withArguments($array)->once964 ->given(965 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),966 $this->calling($integerAsserter)->isNotEqualTo->throw = $exception = new \exception(uniqid())967 )968 ->if($asserter->integer)969 ->then970 ->object($asserter->isNotEqualTo(array()))->isIdenticalTo($asserter)971 ->exception(function() use ($asserter, $array) { $asserter->isNotEqualTo($array); })972 ->isInstanceOf('mageekguy\atoum\asserter\exception')973 ->hasMessage($localizedMessage)974 ->mock($locale)->call('_')->withArguments('%s is equal to %s', $asserter, $type)->thrice975 ->mock($analyzer)->call('getTypeOf')->withArguments($array)->twice976 ->mock($integerAsserter)->call('isNotIdenticalTo')->never977 ->if($asserter->integer[2])978 ->then979 ->exception(function() use ($asserter, & $expectedValue) { $asserter->isNotEqualTo($expectedValue = rand(4, PHP_INT_MAX)); })980 ->isIdenticalTo($exception)981 ->mock($integerAsserter)->call('isNotEqualTo')->withArguments($expectedValue)->once982 ->if($this->method($integerAsserter)->isNotEqualTo->isFluent())983 ->then984 ->object($asserter->isNotEqualTo(3))->isIdenticalTo($asserter)985 ->mock($integerAsserter)->call('isNotEqualTo')->withArguments(3)->once986 ;987 }988 public function testIsIdenticalTo()989 {990 $this991 ->given($asserter = $this->newTestedInstance992 ->setLocale($locale = new \mock\atoum\locale())993 ->setDiff($diff = new \mock\atoum\tools\diffs\variable())994 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())995 ->setGenerator($generator = new \mock\atoum\asserter\generator())996 )997 ->then998 ->exception(function() use ($asserter) { $asserter->isIdenticalTo(new \mock\object()); })999 ->isInstanceOf('mageekguy\atoum\exceptions\logic')1000 ->hasMessage('Array is undefined')1001 ->if($asserter->setWith(array($object = new \mock\object(), 2)))1002 ->then1003 ->object($asserter->isIdenticalTo(array($object, 2)))->isIdenticalTo($asserter)1004 ->if(1005 $this->calling($locale)->_ = $localizedMessage = uniqid(),1006 $this->calling($diff)->__toString = $diffValue = uniqid(),1007 $this->calling($analyzer)->getTypeOf = $type = uniqid()1008 )1009 ->then1010 ->exception(function() use ($asserter, & $notIdenticalValue) { $asserter->isIdenticalTo($notIdenticalValue = uniqid()); })1011 ->isInstanceOf('mageekguy\atoum\asserter\exception')1012 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)1013 ->mock($locale)->call('_')->withArguments('%s is not identical to %s', $asserter, $type)->once1014 ->mock($analyzer)->call('getTypeOf')->withArguments($notIdenticalValue)->once1015 ->given(1016 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),1017 $this->calling($integerAsserter)->isIdenticalTo->throw = $exception = new \exception(uniqid())1018 )1019 ->if($asserter->integer)1020 ->then1021 ->object($asserter->isIdenticalTo(array($object, 2)))->isIdenticalTo($asserter)1022 ->exception(function() use ($asserter, & $notIdenticalValue) { $asserter->isIdenticalTo($notIdenticalValue = uniqid()); })1023 ->isInstanceOf('mageekguy\atoum\asserter\exception')1024 ->hasMessage($localizedMessage . PHP_EOL . $diffValue)1025 ->mock($locale)->call('_')->withArguments('%s is not identical to %s', $asserter, $type)->twice1026 ->mock($analyzer)->call('getTypeOf')->withArguments($notIdenticalValue)->once1027 ->if($asserter->integer[1])1028 ->then1029 ->exception(function() use ($asserter, & $expectedValue) { $asserter->isIdenticalTo($expectedValue = rand(4, PHP_INT_MAX)); })1030 ->isIdenticalTo($exception)1031 ->mock($integerAsserter)->call('isIdenticalTo')->withArguments($expectedValue)->once1032 ->if($this->method($integerAsserter)->isIdenticalTo->isFluent())1033 ->then1034 ->object($asserter->isEqualTo(2))->isIdenticalTo($asserter)1035 ->mock($integerAsserter)->call('isIdenticalTo')->withArguments($expectedValue)->once1036 ;1037 }1038 public function testIsNotIdenticalTo()1039 {1040 $this1041 ->given($asserter = $this->newTestedInstance1042 ->setLocale($locale = new \mock\atoum\locale())1043 ->setAnalyzer($analyzer = new \mock\atoum\tools\variable\analyzer())1044 ->setGenerator($generator = new \mock\atoum\asserter\generator())1045 )1046 ->then1047 ->exception(function() use ($asserter) { $asserter->isNotIdenticalTo(new \mock\object()); })1048 ->isInstanceOf('mageekguy\atoum\exceptions\logic')1049 ->hasMessage('Array is undefined')1050 ->if($asserter->setWith($array = array(1, 2)))1051 ->then1052 ->object($asserter->isNotIdenticalTo(array('1', 2)))->isIdenticalTo($asserter)1053 ->if(1054 $this->calling($locale)->_ = $localizedMessage = uniqid(),1055 $this->calling($analyzer)->getTypeOf = $type = uniqid()1056 )1057 ->then1058 ->exception(function() use ($asserter, $array) { $asserter->isNotIdenticalTo($array); })1059 ->isInstanceOf('mageekguy\atoum\asserter\exception')1060 ->hasMessage($localizedMessage)1061 ->mock($locale)->call('_')->withArguments('%s is identical to %s', $asserter, $type)->once1062 ->mock($analyzer)->call('getTypeOf')->withArguments($array)->once1063 ->given(1064 $this->calling($generator)->__get = $integerAsserter = new \mock\atoum\asserters\integer(),1065 $this->calling($integerAsserter)->isNotIdenticalTo->throw = $exception = new \exception(uniqid())1066 )1067 ->if($asserter->integer)1068 ->then1069 ->object($asserter->isNotIdenticalTo(array('1', 2)))->isIdenticalTo($asserter)1070 ->mock($integerAsserter)->call('isNotIdenticalTo')->never1071 ->if($asserter->integer[1])1072 ->then1073 ->exception(function() use ($asserter, & $expectedValue) { $asserter->isNotIdenticalTo($expectedValue = rand(4, PHP_INT_MAX)); })1074 ->isIdenticalTo($exception)1075 ->mock($integerAsserter)->call('isNotIdenticalTo')->withArguments($expectedValue)->once1076 ->if($this->method($integerAsserter)->isNotIdenticalTo->isFluent())...
getTypeOf
Using AI Code Generation
1$analyzer = new Analyzer();2echo $analyzer->getTypeOf('1.php');3$analyzer = new Analyzer();4echo $analyzer->getTypeOf('2.php');5$analyzer = new Analyzer();6echo $analyzer->getTypeOf('3.php');7$analyzer = new Analyzer();8echo $analyzer->getTypeOf('4.php');9$analyzer = new Analyzer();10echo $analyzer->getTypeOf('5.php');11$analyzer = new Analyzer();12echo $analyzer->getTypeOf('6.php');13$analyzer = new Analyzer();14echo $analyzer->getTypeOf('7.php');15$analyzer = new Analyzer();16echo $analyzer->getTypeOf('8.php');17$analyzer = new Analyzer();18echo $analyzer->getTypeOf('9.php');19$analyzer = new Analyzer();20echo $analyzer->getTypeOf('10.php');21$analyzer = new Analyzer();22echo $analyzer->getTypeOf('11.php');23$analyzer = new Analyzer();24echo $analyzer->getTypeOf('12.php');25$analyzer = new Analyzer();26echo $analyzer->getTypeOf('13.php');27$analyzer = new Analyzer();28echo $analyzer->getTypeOf('14.php');
getTypeOf
Using AI Code Generation
1require_once 'analyzer.php';2$analyzer = new Analyzer();3echo $analyzer->getTypeOf(1);4echo $analyzer->getTypeOf(1.1);5echo $analyzer->getTypeOf('1');6echo $analyzer->getTypeOf(true);7echo $analyzer->getTypeOf(array());8echo $analyzer->getTypeOf(new stdClass());9echo $analyzer->getTypeOf(null);
getTypeOf
Using AI Code Generation
1require_once 'analyzer.php';2$analyzer = new Analyzer();3echo $analyzer->getTypeOf('1.0');4require_once 'analyzer.php';5$analyzer = new Analyzer();6echo $analyzer->getTypeOf(1.0);7require_once 'analyzer.php';8$analyzer = new Analyzer();9echo $analyzer->getTypeOf('1');10require_once 'analyzer.php';11$analyzer = new Analyzer();12echo $analyzer->getTypeOf(1);13require_once 'analyzer.php';14$analyzer = new Analyzer();15echo $analyzer->getTypeOf('0');16require_once 'analyzer.php';17$analyzer = new Analyzer();18echo $analyzer->getTypeOf(0);19require_once 'analyzer.php';20$analyzer = new Analyzer();21echo $analyzer->getTypeOf('true');22require_once 'analyzer.php';23$analyzer = new Analyzer();24echo $analyzer->getTypeOf(true);25require_once 'analyzer.php';26$analyzer = new Analyzer();27echo $analyzer->getTypeOf('false');28require_once 'analyzer.php';29$analyzer = new Analyzer();30echo $analyzer->getTypeOf(false);31require_once 'analyzer.php';32$analyzer = new Analyzer();33echo $analyzer->getTypeOf('null');34require_once 'analyzer.php';35$analyzer = new Analyzer();36echo $analyzer->getTypeOf(null);
getTypeOf
Using AI Code Generation
1require 'Analyzer.php';2$analyzer = new Analyzer();3echo $analyzer->getTypeOf("1.php");4require 'Analyzer.php';5$analyzer = new Analyzer();6echo $analyzer->getTypeOf("2.php");7require 'Analyzer.php';8$analyzer = new Analyzer();9echo $analyzer->getTypeOf("3.php");10require 'Analyzer.php';11$analyzer = new Analyzer();12echo $analyzer->getTypeOf("4.php");13require 'Analyzer.php';14$analyzer = new Analyzer();15echo $analyzer->getTypeOf("5.php");16require 'Analyzer.php';17$analyzer = new Analyzer();18echo $analyzer->getTypeOf("6.php");19require 'Analyzer.php';20$analyzer = new Analyzer();21echo $analyzer->getTypeOf("7.php");22require 'Analyzer.php';23$analyzer = new Analyzer();24echo $analyzer->getTypeOf("8.php");25require 'Analyzer.php';26$analyzer = new Analyzer();27echo $analyzer->getTypeOf("9.php");28require 'Analyzer.php';29$analyzer = new Analyzer();30echo $analyzer->getTypeOf("10.php");31require 'Analyzer.php';32$analyzer = new Analyzer();33echo $analyzer->getTypeOf("11.php");34require 'Analyzer.php';35$analyzer = new Analyzer();36echo $analyzer->getTypeOf("12.php");37require 'Analyzer.php';
getTypeOf
Using AI Code Generation
1include 'analyzer.php';2$analyzer = new analyzer();3$type = $analyzer->getTypeOf('1.php');4print_r($type);5include 'analyzer.php';6$analyzer = new analyzer();7$mime = $analyzer->getMimeType('1.php');8print_r($mime);9include 'analyzer.php';10$analyzer = new analyzer();11$ext = $analyzer->getExtension('1.php');12print_r($ext);13include 'analyzer.php';14$analyzer = new analyzer();15$enc = $analyzer->getEncoding('1.php');16print_r($enc);17include 'analyzer.php';18$analyzer = new analyzer();19$mime = $analyzer->getMimeType('1.php');20print_r($mime);21include 'analyzer.php';22$analyzer = new analyzer();23$ext = $analyzer->getExtension('1.php');24print_r($ext);25include 'analyzer.php';26$analyzer = new analyzer();
getTypeOf
Using AI Code Generation
1include_once('analyzer.php');2$analyzer = new analyzer();3$type = $analyzer->getTypeOf('1.php');4echo $type;5include_once('analyzer.php');6$analyzer = new analyzer();7$type = $analyzer->getTypeOf('1.php');8echo $type;9include_once('analyzer.php');10$analyzer = new analyzer();11$type = $analyzer->getTypeOf('1.php');12echo $type;13include_once('analyzer.php');14$analyzer = new analyzer();
getTypeOf
Using AI Code Generation
1require_once 'analyzer.php';2$analyzer = new Analyzer();3$analyzer->getTypeOf(1);4$analyzer->getTypeOf('a');5$analyzer->getTypeOf(1.1);6$analyzer->getTypeOf(true);7$analyzer->getTypeOf(array());8$analyzer->getTypeOf(new Analyzer());9$analyzer->getTypeOf(null);10$analyzer->getTypeOf(fopen('1.php', 'r'));11$analyzer->getTypeOf(new Exception());
getTypeOf
Using AI Code Generation
1include_once("analyzer.php");2$analyzer = new Analyzer();3$analyzer->getTypeOf("1.php");4include_once("analyzer.php");5$analyzer = new Analyzer();6$analyzer->getTypeOf("1.php");7include_once("analyzer.php");8$analyzer = new Analyzer();9$analyzer->getTypeOf("1.php");
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 getTypeOf 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!!