How to use isZero method of integer class

Best Atoum code snippet using integer.isZero

iterator.php

Source:iterator.php Github

copy

Full Screen

...19 {20 $iterator = new tokenizer\iterator();21 $this->assert22 ->array($iterator->getSkipedValues())->isEmpty()23 ->sizeOf($iterator)->isZero()24 ->boolean($iterator->valid())->isFalse()25 ->variable($iterator->current())->isNull()26 ->variable($iterator->key())->isNull()27 ;28 }29 public function test__toString()30 {31 $iterator = new tokenizer\iterator();32 $this->assert33 ->castToString($iterator)->isEmpty()34 ;35 $iterator->append($token1 = new tokenizer\token(uniqid()));36 $this->assert37 ->integer($iterator->key())->isZero()38 ->castToString($iterator)->isEqualTo($token1)39 ->integer($iterator->key())->isZero()40 ;41 $iterator->append($token2 = new tokenizer\token(uniqid(), rand(1, PHP_INT_MAX)))->end();42 $this->assert43 ->integer($iterator->key())->isEqualTo(1)44 ->castToString($iterator)->isEqualTo($token1 . $token2)45 ->integer($iterator->key())->isEqualTo(1)46 ;47 $innerInnerIterator = new tokenizer\iterator();48 $innerInnerIterator->append($token3 = new tokenizer\token(uniqid()));49 $innerIterator = new tokenizer\iterator();50 $innerIterator51 ->append($token2 = new tokenizer\token(uniqid()))52 ->append($innerInnerIterator)53 ;54 $iterator = new tokenizer\iterator();55 $iterator56 ->append($token1 = new tokenizer\token(uniqid()))57 ->append($innerIterator)58 ;59 $this->assert60 ->castToString($iterator)->isEqualTo($token1 . $token2 . $token3)61 ;62 }63 public function testValid()64 {65 $iterator = new tokenizer\iterator();66 $this->assert67 ->boolean($iterator->valid())->isFalse()68 ;69 $iterator->append(new tokenizer\token(uniqid()));70 $this->assert71 ->boolean($iterator->valid())->isTrue()72 ;73 $iterator->next();74 $this->assert75 ->boolean($iterator->valid())->isFalse()76 ;77 }78 public function testKey()79 {80 $iterator = new tokenizer\iterator();81 $this->assert82 ->variable($iterator->key())->isNull()83 ;84 $iterator->append(new tokenizer\token(uniqid()));85 $this->assert86 ->integer($iterator->key())->isZero()87 ;88 $iterator->next();89 $this->assert90 ->variable($iterator->key())->isNull()91 ;92 $iterator->append(new tokenizer\token(uniqid()));93 $this->assert94 ->integer($iterator->key())->isEqualTo(1)95 ;96 $iterator->next();97 $this->assert98 ->variable($iterator->key())->isNull()99 ;100 $innerIterator = new tokenizer\iterator();101 $innerIterator102 ->append(new tokenizer\token(uniqid()))103 ->append(new tokenizer\token(uniqid()))104 ->append(new tokenizer\token(uniqid()))105 ;106 $iterator107 ->append($innerIterator)108 ->append(new tokenizer\token(uniqid()))109 ;110 $iterator->rewind();111 $this->assert112 ->integer($iterator->key())->isEqualTo(0)113 ->integer($iterator->next()->key())->isEqualTo(1)114 ->integer($iterator->next()->key())->isEqualTo(2)115 ->integer($iterator->next()->key())->isEqualTo(3)116 ->integer($iterator->next()->key())->isEqualTo(4)117 ->integer($iterator->next()->key())->isEqualTo(5)118 ->variable($iterator->next()->key())->isNull()119 ;120 }121 public function testCurrent()122 {123 $iterator = new tokenizer\iterator();124 $this->assert125 ->variable($iterator->current())->isNull()126 ;127 $iterator->append($token1 = new tokenizer\token(uniqid()));128 $this->assert129 ->object($iterator->current())->isIdenticalTo($token1)130 ->variable($iterator->next()->current())->isNull()131 ;132 $iterator->append($token2 = new tokenizer\token(uniqid()));133 $this->assert134 ->object($iterator->current())->isIdenticalTo($token2)135 ->variable($iterator->next()->current())->isNull()136 ;137 $innerIterator = new tokenizer\iterator();138 $innerIterator139 ->append($token3 = new tokenizer\token(uniqid()))140 ->append($token4 = new tokenizer\token(uniqid()))141 ->append($token5 = new tokenizer\token(uniqid()))142 ;143 $iterator144 ->append($innerIterator)145 ->append($token6 = new tokenizer\token(uniqid()))146 ;147 $iterator->rewind();148 $this->assert149 ->object($iterator->current())->isIdenticalTo($token1)150 ->object($iterator->next()->current())->isIdenticalTo($token2)151 ->object($iterator->next()->current())->isIdenticalTo($token3)152 ->object($iterator->next()->current())->isIdenticalTo($token4)153 ->object($iterator->next()->current())->isIdenticalTo($token5)154 ->object($iterator->next()->current())->isIdenticalTo($token6)155 ->variable($iterator->next()->current())->isNull()156 ;157 }158 public function testPrev()159 {160 $iterator = new tokenizer\iterator();161 $this->assert162 ->boolean($iterator->valid())->isFalse()163 ->variable($iterator->key())->isNull()164 ->variable($iterator->current())->isNull()165 ->object($iterator->prev())->isIdenticalTo($iterator)166 ->boolean($iterator->valid())->isFalse()167 ->variable($iterator->key())->isNull()168 ->variable($iterator->current())->isNull()169 ;170 $iterator->append($token1 = new tokenizer\token(uniqid()));171 $this->assert172 ->boolean($iterator->valid())->isTrue()173 ->integer($iterator->key())->isZero()174 ->object($iterator->current())->isIdenticalTo($token1)175 ->object($iterator->prev())->isIdenticalTo($iterator)176 ->boolean($iterator->valid())->isFalse()177 ->variable($iterator->key())->isNull()178 ->variable($iterator->current())->isNull()179 ;180 $iterator->append($token2 = new tokenizer\token(uniqid()))->end();181 $this->assert182 ->boolean($iterator->valid())->isTrue()183 ->integer($iterator->key())->isEqualTo(1)184 ->object($iterator->current())->isIdenticalTo($token2)185 ->object($iterator->prev())->isIdenticalTo($iterator)186 ->boolean($iterator->valid())->isTrue()187 ->integer($iterator->key())->isZero()188 ->object($iterator->current())->isIdenticalTo($token1)189 ->object($iterator->prev())->isIdenticalTo($iterator)190 ->boolean($iterator->valid())->isFalse()191 ->variable($iterator->key())->isNull()192 ->variable($iterator->current())->isNull()193 ;194 $innerIterator = new tokenizer\iterator();195 $iterator->append($innerIterator)->end();196 $this->assert197 ->boolean($iterator->valid())->isTrue()198 ->integer($iterator->key())->isEqualTo(1)199 ->object($iterator->current())->isIdenticalTo($token2)200 ->object($iterator->prev())->isIdenticalTo($iterator)201 ->boolean($iterator->valid())->isTrue()202 ->integer($iterator->key())->isZero()203 ->object($iterator->current())->isIdenticalTo($token1)204 ->object($iterator->prev())->isIdenticalTo($iterator)205 ->boolean($iterator->valid())->isFalse()206 ->variable($iterator->key())->isNull()207 ->variable($iterator->current())->isNull()208 ;209 $iterator = new tokenizer\iterator();210 $iterator = new tokenizer\iterator();211 $iterator212 ->append($token1 = new tokenizer\token(uniqid()))213 ->append($token2 = new tokenizer\token(uniqid()))214 ->append($token3 = new tokenizer\token(uniqid()))215 ->end()216 ->skipValue($token2)217 ;218 $this->assert219 ->boolean($iterator->valid())->isTrue()220 ->integer($iterator->key())->isEqualTo(2)221 ->object($iterator->current())->isIdenticalTo($token3)222 ->object($iterator->prev())->isIdenticalTo($iterator)223 ->boolean($iterator->valid())->isTrue()224 ->integer($iterator->key())->isEqualTo(0)225 ->object($iterator->current())->isIdenticalTo($token1)226 ->object($iterator->prev())->isIdenticalTo($iterator)227 ->boolean($iterator->valid())->isFalse()228 ->variable($iterator->key())->isNull()229 ->variable($iterator->current())->isNull()230 ;231 $iterator = new tokenizer\iterator();232 $iterator233 ->append($token1 = new tokenizer\token(uniqid()))234 ->append($token2 = new tokenizer\token(uniqid()))235 ->append($token3 = new tokenizer\token(uniqid()))236 ->end()237 ;238 $this->assert239 ->boolean($iterator->valid())->isTrue()240 ->integer($iterator->key())->isEqualTo(2)241 ->object($iterator->current())->isIdenticalTo($token3)242 ->object($iterator->prev(1))->isIdenticalTo($iterator)243 ->boolean($iterator->valid())->isTrue()244 ->integer($iterator->key())->isEqualTo(1)245 ->object($iterator->current())->isIdenticalTo($token2)246 ->object($iterator->end()->prev(2))->isIdenticalTo($iterator)247 ->boolean($iterator->valid())->isTrue()248 ->integer($iterator->key())->isZero()249 ->object($iterator->current())->isIdenticalTo($token1)250 ->object($iterator->end()->prev(3))->isIdenticalTo($iterator)251 ->boolean($iterator->valid())->isFalse()252 ->variable($iterator->key())->isNull()253 ->variable($iterator->current())->isNull()254 ;255 $iterator = new tokenizer\iterator();256 $iterator257 ->append($token1 = new tokenizer\token(uniqid()))258 ->append($token2 = new tokenizer\token(uniqid()))259 ->append($token3 = new tokenizer\token(uniqid()))260 ->append($token4 = new tokenizer\token(uniqid()))261 ->end()262 ->skipValue($token2)263 ;264 $this->assert265 ->boolean($iterator->valid())->isTrue()266 ->integer($iterator->key())->isEqualTo(3)267 ->object($iterator->current())->isIdenticalTo($token4)268 ->object($iterator->prev(1))->isIdenticalTo($iterator)269 ->boolean($iterator->valid())->isTrue()270 ->integer($iterator->key())->isEqualTo(2)271 ->object($iterator->current())->isIdenticalTo($token3)272 ->object($iterator->end()->prev(2))->isIdenticalTo($iterator)273 ->boolean($iterator->valid())->isTrue()274 ->integer($iterator->key())->isZero()275 ->object($iterator->current())->isIdenticalTo($token1)276 ->object($iterator->end()->prev(rand(3, PHP_INT_MAX)))->isIdenticalTo($iterator)277 ->boolean($iterator->valid())->isFalse()278 ->variable($iterator->key())->isNull()279 ->variable($iterator->current())->isNull()280 ;281 }282 public function testNext()283 {284 $iterator = new tokenizer\iterator();285 $this->assert286 ->boolean($iterator->valid())->isFalse()287 ->variable($iterator->key())->isNull()288 ->variable($iterator->current())->isNull()289 ->object($iterator->next())->isIdenticalTo($iterator)290 ->boolean($iterator->valid())->isFalse()291 ->variable($iterator->key())->isNull()292 ->variable($iterator->current())->isNull()293 ->object($iterator->next(rand(2, PHP_INT_MAX)))->isIdenticalTo($iterator)294 ->boolean($iterator->valid())->isFalse()295 ->variable($iterator->key())->isNull()296 ->variable($iterator->current())->isNull()297 ;298 $iterator->append($token1 = new tokenizer\token(uniqid()));299 $this->assert300 ->boolean($iterator->valid())->isTrue()301 ->integer($iterator->key())->isEqualTo(0)302 ->object($iterator->current())->isIdenticalTo($token1)303 ->object($iterator->next())->isIdenticalTo($iterator)304 ->boolean($iterator->valid())->isFalse()305 ->variable($iterator->key())->isNull()306 ->variable($iterator->current())->isNull()307 ;308 $iterator309 ->append(new tokenizer\iterator())310 ->append($token2 = new tokenizer\token(uniqid()))311 ->rewind();312 ;313 $this->assert314 ->boolean($iterator->valid())->isTrue()315 ->integer($iterator->key())->isEqualTo(0)316 ->object($iterator->current())->isIdenticalTo($token1)317 ->object($iterator->next())->isIdenticalTo($iterator)318 ->boolean($iterator->valid())->isTrue()319 ->integer($iterator->key())->isEqualTo(1)320 ->object($iterator->current())->isIdenticalTo($token2)321 ->object($iterator->next())->isIdenticalTo($iterator)322 ->boolean($iterator->valid())->isFalse()323 ->variable($iterator->key())->isNull()324 ->variable($iterator->current())->isNull()325 ;326 $iterator = new tokenizer\iterator();327 $iterator328 ->append($token1 = new tokenizer\token(uniqid()))329 ->append($token2 = new tokenizer\token(uniqid()))330 ->append($token3 = new tokenizer\token(uniqid()))331 ->skipValue($token2)332 ;333 $this->assert334 ->integer($iterator->key())->isZero()335 ->object($iterator->current())->isIdenticalTo($token1)336 ->object($iterator->next())->isIdenticalTo($iterator)337 ->integer($iterator->key())->isEqualTo(2)338 ->object($iterator->current())->isIdenticalTo($token3)339 ->object($iterator->next())->isIdenticalTo($iterator)340 ->variable($iterator->key())->isNull()341 ->variable($iterator->current())->isNull()342 ;343 $iterator = new tokenizer\iterator();344 $iterator345 ->append($token1 = new tokenizer\token(uniqid()))346 ->append($token2 = new tokenizer\token(uniqid()))347 ->append($token3 = new tokenizer\token(uniqid()))348 ;349 $this->assert350 ->boolean($iterator->valid())->isTrue()351 ->integer($iterator->key())->isZero()352 ->object($iterator->current())->isIdenticalTo($token1)353 ->object($iterator->next(1))->isIdenticalTo($iterator)354 ->boolean($iterator->valid())->isTrue()355 ->integer($iterator->key())->isEqualTo(1)356 ->object($iterator->current())->isIdenticalTo($token2)357 ->object($iterator->rewind()->next(2))->isIdenticalTo($iterator)358 ->boolean($iterator->valid())->isTrue()359 ->integer($iterator->key())->isEqualTo(2)360 ->object($iterator->current())->isIdenticalTo($token3)361 ->object($iterator->rewind()->next(rand(3, PHP_INT_MAX)))->isIdenticalTo($iterator)362 ->boolean($iterator->valid())->isFalse()363 ->variable($iterator->key())->isNull()364 ->variable($iterator->current())->isNull()365 ;366 $iterator = new tokenizer\iterator();367 $iterator368 ->append($token1 = new tokenizer\token(uniqid()))369 ->append($token2 = new tokenizer\token(uniqid()))370 ->append($token3 = new tokenizer\token(uniqid()))371 ->append($token4 = new tokenizer\token(uniqid()))372 ->skipValue($token2)373 ;374 $this->assert375 ->boolean($iterator->valid())->isTrue()376 ->integer($iterator->key())->isZero()377 ->object($iterator->current())->isIdenticalTo($token1)378 ->object($iterator->next(1))->isIdenticalTo($iterator)379 ->boolean($iterator->valid())->isTrue()380 ->integer($iterator->key())->isEqualTo(2)381 ->object($iterator->current())->isIdenticalTo($token3)382 ->object($iterator->rewind()->next(2))->isIdenticalTo($iterator)383 ->boolean($iterator->valid())->isTrue()384 ->integer($iterator->key())->isEqualTo(3)385 ->object($iterator->current())->isIdenticalTo($token4)386 ->object($iterator->rewind()->next(rand(3, PHP_INT_MAX)))->isIdenticalTo($iterator)387 ->boolean($iterator->valid())->isFalse()388 ->variable($iterator->key())->isNull()389 ->variable($iterator->current())->isNull()390 ;391 }392 public function testCount()393 {394 $iterator = new tokenizer\iterator();395 $this->assert396 ->sizeOf($iterator)->isEqualTo(0)397 ;398 $iterator->append(new tokenizer\token(uniqid()));399 $this->assert400 ->sizeOf($iterator)->isEqualTo(1)401 ;402 $innerIterator = new tokenizer\iterator();403 $iterator->append($innerIterator);404 $this->assert405 ->sizeOf($iterator)->isEqualTo(1)406 ;407 $innerIterator->append(new tokenizer\token(uniqid()));408 $this->assert409 ->sizeOf($iterator)->isEqualTo(2)410 ;411 $innerInnerIterator = new tokenizer\iterator();412 $innerInnerIterator->append(new tokenizer\token(uniqid()));413 $innerIterator = new tokenizer\iterator();414 $innerIterator415 ->append(new tokenizer\token(uniqid()))416 ->append($innerInnerIterator)417 ;418 $iterator = new tokenizer\iterator();419 $iterator420 ->append(new tokenizer\token(uniqid()))421 ->append($innerIterator)422 ;423 $innerIterator->append(new tokenizer\token(uniqid()));424 $this->assert425 ->sizeOf($iterator)->isEqualTo(4)426 ;427 $innerInnerIterator->append(new tokenizer\token(uniqid()));428 $this->assert429 ->sizeOf($iterator)->isEqualTo(5)430 ;431 }432 public function testRewind()433 {434 $iterator = new tokenizer\iterator();435 $this->assert436 ->variable($iterator->key())->isNull()437 ->object($iterator->rewind())->isIdenticalTo($iterator)438 ->variable($iterator->key())->isNull()439 ;440 $iterator->append(new tokenizer\token(uniqid()));441 $this->assert442 ->integer($iterator->key())->isZero()443 ->object($iterator->rewind())->isIdenticalTo($iterator)444 ->integer($iterator->key())->isZero()445 ;446 $iterator->append(new tokenizer\token(uniqid()))->next();447 $this->assert448 ->integer($iterator->key())->isEqualTo(1)449 ->object($iterator->rewind())->isIdenticalTo($iterator)450 ->integer($iterator->key())->isZero()451 ;452 $innerIterator = new tokenizer\iterator();453 $innerIterator454 ->append(new tokenizer\token('1'))455 ->append(new tokenizer\token('2'))456 ->next();457 ;458 $iterator->append($innerIterator)->end();459 $this->assert460 ->integer($iterator->key())->isEqualTo(3)461 ->integer($innerIterator->key())->isEqualTo(1)462 ->object($iterator->rewind())->isIdenticalTo($iterator)463 ->integer($iterator->key())->isZero()464 ->integer($innerIterator->key())->isEqualTo(1)465 ;466 $iterator = new tokenizer\iterator();467 $iterator468 ->append($token1 = new tokenizer\token(uniqid()))469 ->append($token2 = new tokenizer\token(uniqid()))470 ->append($token3 = new tokenizer\token(uniqid()))471 ->skipValue($token1)472 ->end()473 ;474 $this->assert475 ->integer($iterator->key())->isEqualTo(2)476 ->object($iterator->current())->isIdenticalTo($token3)477 ->object($iterator->rewind())->isIdenticalTo($iterator)478 ->integer($iterator->key())->isEqualTo(1)479 ->object($iterator->current())->isIdenticalTo($token2)480 ;481 }482 public function testEnd()483 {484 $iterator = new tokenizer\iterator();485 $this->assert486 ->variable($iterator->key())->isNull()487 ->variable($iterator->current())->isNull()488 ->object($iterator->end())->isIdenticalTo($iterator)489 ->variable($iterator->key())->isNull()490 ->variable($iterator->current())->isNull()491 ;492 $iterator->append($token1 = new tokenizer\token(uniqid()));493 $this->assert494 ->integer($iterator->key())->isZero()495 ->object($iterator->current())->isIdenticalTo($token1)496 ->object($iterator->end())->isIdenticalTo($iterator)497 ->integer($iterator->key())->isZero()498 ->object($iterator->current())->isIdenticalTo($token1)499 ;500 $iterator->append($token2 = new tokenizer\token(uniqid()));501 $this->assert502 ->integer($iterator->key())->isZero()503 ->object($iterator->current())->isIdenticalTo($token1)504 ->object($iterator->end())->isIdenticalTo($iterator)505 ->integer($iterator->key())->isEqualTo(1)506 ->object($iterator->current())->isIdenticalTo($token2)507 ;508 $innerIterator = new tokenizer\iterator();509 $innerIterator510 ->append($token3 = new tokenizer\token(uniqid()))511 ->append($token4 = new tokenizer\token(uniqid()))512 ;513 $iterator->append($innerIterator);514 $this->assert515 ->integer($iterator->key())->isEqualTo(1)516 ->object($iterator->current())->isIdenticalTo($token2)517 ->object($iterator->end())->isIdenticalTo($iterator)518 ->integer($iterator->key())->isEqualTo(3)519 ->object($iterator->current())->isIdenticalTo($token4)520 ;521 $iterator = new tokenizer\iterator();522 $iterator523 ->append($token1 = new tokenizer\token(uniqid()))524 ->append($token2 = new tokenizer\token(uniqid()))525 ->append($token3 = new tokenizer\token(uniqid()))526 ->skipValue($token3)527 ;528 $this->assert529 ->integer($iterator->key())->isZero()530 ->object($iterator->current())->isIdenticalTo($token1)531 ->object($iterator->end())->isIdenticalTo($iterator)532 ->integer($iterator->key())->isEqualTo(1)533 ->object($iterator->current())->isIdenticalTo($token2)534 ;535 }536 public function testAppend()537 {538 $iterator = new tokenizer\iterator();539 $this->assert540 ->variable($iterator->key())->isNull()541 ->variable($iterator->current())->isNull()542 ->object($iterator->append($token1 = new tokenizer\token(uniqid())))->isIdenticalTo($iterator)543 ->integer($iterator->key())->isZero()544 ->object($iterator->current())->isIdenticalTo($token1)545 ;546 $iterator = new tokenizer\iterator();547 $innerIterator = new tokenizer\iterator();548 $innerIterator549 ->append($token1 = new tokenizer\token(uniqid()))550 ->append($token2 = new tokenizer\token(uniqid()))551 ;552 $this->assert553 ->variable($iterator->key())->isNull()554 ->variable($iterator->current())->isNull()555 ->object($iterator->append($innerIterator))->isIdenticalTo($iterator)556 ->integer($iterator->key())->isZero()557 ->object($iterator->current())->isIdenticalTo($token1)558 ;559 $iterator->end()->next();560 $otherInnerIterator = new tokenizer\iterator();561 $otherInnerIterator562 ->append($token3 = new tokenizer\token(uniqid()))563 ->append($token4 = new tokenizer\token(uniqid()))564 ->end()565 ;566 $this->assert567 ->variable($iterator->key())->isNull()568 ->variable($iterator->current())->isNull()569 ->integer($otherInnerIterator->key())->isEqualTo(1)570 ->object($otherInnerIterator->current())->isIdenticalTo($token4)571 ->object($iterator->append($otherInnerIterator))->isIdenticalTo($iterator)572 ->integer($iterator->key())->isEqualTo(2)573 ->object($iterator->current())->isIdenticalTo($token3)574 ->integer($otherInnerIterator->key())->isZero()575 ->object($otherInnerIterator->current())->isIdenticalTo($token3)576 ;577 $this->assert578 ->exception(function() use ($iterator, $innerIterator) {579 $iterator->append($innerIterator);580 }581 )582 ->isInstanceOf('mageekguy\atoum\exceptions\runtime')583 ->hasMessage('Unable to append value because it has already a parent')584 ;585 $iterator = new tokenizer\iterator();586 $iterator->skipValue($skipedValue = uniqid());587 $innerIterator = new tokenizer\iterator();588 $this->assert589 ->object($iterator->append($innerIterator))->isIdenticalTo($iterator)590 ->sizeOf($iterator)->isZero()591 ->array($innerIterator->getSkipedValues())->isEmpty()592 ;593 $iterator = new tokenizer\iterator();594 $iterator->skipValue($skipedValue = uniqid());595 $innerIterator = new tokenizer\iterator();596 $innerIterator->skipValue($skipedValue);597 $this->assert598 ->object($iterator->append($innerIterator))->isIdenticalTo($iterator)599 ->sizeOf($iterator)->isZero()600 ->array($innerIterator->getSkipedValues())->isEqualTo(array($skipedValue))601 ;602 $iterator = new tokenizer\iterator();603 $iterator->skipValue($skipedValue1 = uniqid());604 $iterator = new tokenizer\iterator();605 $iterator606 ->append($token1 = new tokenizer\token(uniqid()))607 ->append($token2 = new tokenizer\token(uniqid()))608 ->append($token3 = new tokenizer\token(uniqid()))609 ;610 $this->assert611 ->object($iterator->current())->isIdenticalTo($token1)612 ;613 }614 public function testSkipValue()615 {616 $iterator = new tokenizer\iterator();617 $this->assert618 ->object($iterator->skipValue($skipedValue = uniqid()))->isIdenticalTo($iterator)619 ->array($iterator->getSkipedValues())->isEqualTo(array($skipedValue))620 ->object($iterator->skipValue($skipedValue))->isIdenticalTo($iterator)621 ->array($iterator->getSkipedValues())->isEqualTo(array($skipedValue))622 ;623 }624 public function testReset()625 {626 $iterator = new tokenizer\iterator();627 $this->assert628 ->boolean($iterator->valid())->isFalse()629 ->variable($iterator->key())->isNull()630 ->variable($iterator->current())->isNull()631 ->sizeOf($iterator)->isZero()632 ->object($iterator->reset())->isIdenticalTo($iterator)633 ->boolean($iterator->valid())->isFalse()634 ->variable($iterator->key())->isNull()635 ->variable($iterator->current())->isNull()636 ->sizeOf($iterator)->isZero()637 ;638 $iterator->append($token = new tokenizer\token(uniqid()));639 $this->assert640 ->boolean($iterator->valid())->isTrue()641 ->integer($iterator->key())->isZero()642 ->variable($iterator->current())->isIdenticalTo($token)643 ->sizeOf($iterator)->isEqualTo(1)644 ->object($iterator->reset())->isIdenticalTo($iterator)645 ->boolean($iterator->valid())->isFalse()646 ->variable($iterator->key())->isNull()647 ->variable($iterator->current())->isNull()648 ->sizeOf($iterator)->isZero()649 ;650 }651 public function testGetValue()652 {653 $iterator = new tokenizer\iterator();654 $this->assert655 ->variable($iterator->getValue())->isNull()656 ;657 $innerIterator = new tokenizer\iterator();658 $innerIterator->append(new tokenizer\token(uniqid()));659 $iterator660 ->append($token1 = new tokenizer\token(uniqid()))661 ->append($innerIterator)662 ->append($token2 = new tokenizer\token(uniqid()))663 ;664 $this->assert665 ->object($iterator->getValue())->isIdenticalTo($token1)666 ->object($iterator->next()->getValue())->isIdenticalTo($innerIterator)667 ->object($iterator->next()->getValue())->isIdenticalTo($token2)668 ->variable($iterator->next()->getValue())->isNull()669 ;670 }671 public function testGetParent()672 {673 $iterator = new tokenizer\iterator();674 $this->assert675 ->variable($iterator->getParent())->isNull()676 ;677 $parentIterator = new tokenizer\iterator();678 $parentIterator->append($iterator);679 $this->assert680 ->object($iterator->getParent())->isIdenticalTo($parentIterator)681 ;682 }683 public function testGetRoot()684 {685 $childIterator = new tokenizer\iterator();686 $this->assert687 ->variable($childIterator->getRoot())->isNull()688 ;689 $parentIterator = new tokenizer\iterator();690 $parentIterator->append($childIterator);691 $this->assert692 ->object($childIterator->getRoot())->isIdenticalTo($parentIterator)693 ;694 $grandFatherIterator = new tokenizer\iterator();695 $grandFatherIterator->append($parentIterator);696 $this->assert697 ->object($childIterator->getRoot())->isIdenticalTo($grandFatherIterator)698 ->object($parentIterator->getRoot())->isIdenticalTo($grandFatherIterator)699 ;700 }701 public function testSeek()702 {703 $iterator = new tokenizer\iterator();704 $this->assert705 ->boolean($iterator->valid())->isFalse()706 ->variable($iterator->key())->isNull()707 ->variable($iterator->current())->isNull()708 ->object($iterator->seek(rand(0, PHP_INT_MAX)))->isIdenticalTo($iterator)709 ->boolean($iterator->valid())->isFalse()710 ->variable($iterator->key())->isNull()711 ;712 $iterator->append($token1 = new tokenizer\token(uniqid()));713 $this->assert714 ->boolean($iterator->valid())->isTrue()715 ->integer($iterator->key())->isZero()716 ->object($iterator->current())->isIdenticalTo($token1)717 ->object($iterator->seek(0))->isIdenticalTo($iterator)718 ->integer($iterator->key())->isZero()719 ->object($iterator->current())->isIdenticalTo($token1)720 ->object($iterator->seek(rand(1, PHP_INT_MAX)))->isIdenticalTo($iterator)721 ->boolean($iterator->valid())->isFalse()722 ->variable($iterator->key())->isNull()723 ->variable($iterator->current())->isNull()724 ;725 $iterator->rewind()->append($token2 = new tokenizer\token(uniqid()));726 $this->assert727 ->boolean($iterator->valid())->isTrue()728 ->integer($iterator->key())->isZero()729 ->object($iterator->current())->isIdenticalTo($token1)730 ->object($iterator->seek(0))->isIdenticalTo($iterator)731 ->integer($iterator->key())->isZero()732 ->object($iterator->current())->isIdenticalTo($token1)733 ->object($iterator->seek(1))->isIdenticalTo($iterator)734 ->integer($iterator->key())->isEqualTo(1)735 ->object($iterator->current())->isIdenticalTo($token2)736 ->object($iterator->seek(rand(2, PHP_INT_MAX)))->isIdenticalTo($iterator)737 ->boolean($iterator->valid())->isFalse()738 ->variable($iterator->key())->isNull()739 ->variable($iterator->current())->isNull()740 ;741 $iterator->rewind()->append($token3 = new tokenizer\token(uniqid()));742 $this->assert743 ->boolean($iterator->valid())->isTrue()744 ->integer($iterator->key())->isZero()745 ->object($iterator->current())->isIdenticalTo($token1)746 ->object($iterator->seek(2))->isIdenticalTo($iterator)747 ->boolean($iterator->valid())->isTrue()748 ->integer($iterator->key())->isEqualTo(2)749 ->object($iterator->current())->isIdenticalTo($token3)750 ->object($iterator->seek(3))->isIdenticalTo($iterator)751 ->boolean($iterator->valid())->isFalse()752 ->variable($iterator->key())->isNull()753 ->variable($iterator->current())->isNull()754 ->object($iterator->seek(1))->isIdenticalTo($iterator)755 ->boolean($iterator->valid())->isTrue()756 ->integer($iterator->key())->isEqualTo(1)757 ->object($iterator->current())->isIdenticalTo($token2)758 ->object($iterator->rewind()->prev()->seek(1))->isIdenticalTo($iterator)759 ->boolean($iterator->valid())->isTrue()760 ->integer($iterator->key())->isEqualTo(1)761 ->object($iterator->current())->isIdenticalTo($token2)762 ->object($iterator->rewind()->seek(2))->isIdenticalTo($iterator)763 ->boolean($iterator->valid())->isTrue()764 ->integer($iterator->key())->isEqualTo(2)765 ->object($iterator->current())->isIdenticalTo($token3)766 ->object($iterator->seek(0))->isIdenticalTo($iterator)767 ->boolean($iterator->valid())->isTrue()768 ->integer($iterator->key())->isZero()769 ->object($iterator->current())->isIdenticalTo($token1)770 ;771 }772 public function testFindTag()773 {774 $iterator = new tokenizer\iterator();775 $this->assert776 ->variable($iterator->key())->isNull()777 ->variable($iterator->findTag(uniqid()))->isNull()778 ->variable($iterator->key())->isNull()779 ;780 $iterator->append(new tokenizer\token($token = uniqid()));781 $this->assert782 ->integer($iterator->key())->isZero()783 ->variable($iterator->findTag(uniqid()))->isNull()784 ->variable($iterator->key())->isNull()785 ->integer($iterator->findTag($token))->isZero()786 ->integer($iterator->key())->isZero()787 ;788 }789 public function testGoToNextTagWhichIsNot()790 {791 $iterator = new tokenizer\iterator();792 $this->assert793 ->object($iterator->goToNextTagWhichIsNot(array()))->isIdenticalTo($iterator)794 ;795 $iterator->append(new tokenizer\token(T_FUNCTION));796 $this->assert797 ->integer($iterator->key())->isZero()798 ->object($iterator->goToNextTagWhichIsNot(array(T_WHITESPACE)))->isIdenticalTo($iterator)799 ->variable($iterator->key())->isNull()800 ;801 $iterator->append(new tokenizer\token(T_WHITESPACE));802 $this->assert803 ->object($iterator->rewind()->goToNextTagWhichIsNot(array(T_STRING)))->isIdenticalTo($iterator)804 ->integer($iterator->key())->isEqualTo(1)805 ->object($iterator->rewind()->goToNextTagWhichIsNot(array(T_WHITESPACE)))->isIdenticalTo($iterator)806 ->variable($iterator->key())->isNull()807 ;808 $iterator->append(new tokenizer\token(T_COMMENT));809 $this->assert810 ->object($iterator->rewind()->goToNextTagWhichIsNot(array(T_STRING)))->isIdenticalTo($iterator)811 ->integer($iterator->key())->isEqualTo(1)...

Full Screen

Full Screen

ToTargetValue.php

Source:ToTargetValue.php Github

copy

Full Screen

1<?php2namespace UnitTest\Suites\Model_Entity\Cases;3use UnitTest\Suites\Model_Entity\Classes\TestEntity;4class ToTargetValue extends \UnitTest\Core\TestCase {5 public function Run() {6 $booleanValue = false;7 $integerValue = 0;8 $doubleValue = 0.0;9 $stringValue = '';10 $timeValue = new \Core\Time();11 // Empty string12 self::verify(TestEntity::ToTargetValue('', $booleanValue) === false);13 self::verify(TestEntity::ToTargetValue('', $integerValue) === 0);14 self::verify(TestEntity::ToTargetValue('', $doubleValue) === 0.0);15 self::verify(TestEntity::ToTargetValue('', $stringValue) === '');16 self::verify(TestEntity::ToTargetValue('', $timeValue)->IsZero());17 // '0'18 self::verify(TestEntity::ToTargetValue('0', $booleanValue) === false);19 self::verify(TestEntity::ToTargetValue('0', $integerValue) === 0);20 self::verify(TestEntity::ToTargetValue('0', $doubleValue) === 0.0);21 self::verify(TestEntity::ToTargetValue('0', $stringValue) === '0');22 self::verify(TestEntity::ToTargetValue('0', $timeValue)->IsZero());23 // 024 self::verify(TestEntity::ToTargetValue(0, $booleanValue) === false);25 self::verify(TestEntity::ToTargetValue(0, $integerValue) === 0);26 self::verify(TestEntity::ToTargetValue(0, $doubleValue) === 0.0);27 self::verify(TestEntity::ToTargetValue(0, $stringValue) === '0');28 self::verify(TestEntity::ToTargetValue(0, $timeValue)->IsZero());29 // '1'30 self::verify(TestEntity::ToTargetValue('1', $booleanValue) === true);31 self::verify(TestEntity::ToTargetValue('1', $integerValue) === 1);32 self::verify(TestEntity::ToTargetValue('1', $doubleValue) === 1.0);33 self::verify(TestEntity::ToTargetValue('1', $stringValue) === '1');34 self::verify(TestEntity::ToTargetValue('1', $timeValue)->IsZero());35 // 136 self::verify(TestEntity::ToTargetValue(1, $booleanValue) === true);37 self::verify(TestEntity::ToTargetValue(1, $integerValue) === 1);38 self::verify(TestEntity::ToTargetValue(1, $doubleValue) === 1.0);39 self::verify(TestEntity::ToTargetValue(1, $stringValue) === '1');40 self::verify(TestEntity::ToTargetValue(1, $timeValue)->IsZero());41 // '42'42 self::verify(TestEntity::ToTargetValue('42', $booleanValue) === true);43 self::verify(TestEntity::ToTargetValue('42', $integerValue) === 42);44 self::verify(TestEntity::ToTargetValue('42', $doubleValue) === 42.0);45 self::verify(TestEntity::ToTargetValue('42', $stringValue) === '42');46 self::verify(TestEntity::ToTargetValue('42', $timeValue)->IsZero());47 // 4248 self::verify(TestEntity::ToTargetValue(42, $booleanValue) === true);49 self::verify(TestEntity::ToTargetValue(42, $integerValue) === 42);50 self::verify(TestEntity::ToTargetValue(42, $doubleValue) === 42.0);51 self::verify(TestEntity::ToTargetValue(42, $stringValue) === '42');52 self::verify(TestEntity::ToTargetValue(42, $timeValue)->IsZero());53 // '3.14159'54 self::verify(TestEntity::ToTargetValue('3.14159', $booleanValue) === true);55 self::verify(TestEntity::ToTargetValue('3.14159', $integerValue) === 3);56 self::verify(TestEntity::ToTargetValue('3.14159', $doubleValue) === 3.14159);57 self::verify(TestEntity::ToTargetValue('3.14159', $stringValue) === '3.14159');58 self::verify(TestEntity::ToTargetValue('3.14159', $timeValue)->IsZero());59 // 3.1415960 self::verify(TestEntity::ToTargetValue(3.14159, $booleanValue) === true);61 self::verify(TestEntity::ToTargetValue(3.14159, $integerValue) === 3);62 self::verify(TestEntity::ToTargetValue(3.14159, $doubleValue) === 3.14159);63 self::verify(TestEntity::ToTargetValue(3.14159, $stringValue) === '3.14159');64 self::verify(TestEntity::ToTargetValue(3.14159, $timeValue)->IsZero());65 // HTML tags66 self::verify(TestEntity::ToTargetValue('<h1>Good&ensp;Title</h1><p>Some <span class="nice">paragraph</span></p>', $stringValue) === 'Good&amp;ensp;TitleSome paragraph');67 // HTML special chars68 self::verify(TestEntity::ToTargetValue('this & that', $stringValue) === 'this &amp; that');69 self::verify(TestEntity::ToTargetValue("The 'single' quote", $stringValue) === 'The &apos;single&apos; quote');70 self::verify(TestEntity::ToTargetValue('The "double" quote', $stringValue) === 'The &quot;double&quot; quote');71 self::verify(TestEntity::ToTargetValue('-1 is < 0 but > -2', $stringValue) === '-1 is &lt; 0 but &gt; -2');72 // Time: success73 self::verify(TestEntity::ToTargetValue('2018-05-03 17:42:08', $timeValue)->ToMySQLString() === '2018-05-03 17:42:08');74 // Time: errors75 self::verify(TestEntity::ToTargetValue('2019-01-15T20:34:14+03:00', $timeValue)->IsZero());76 self::verify(TestEntity::ToTargetValue('03.05.2018', $timeValue)->IsZero());77 self::verify(TestEntity::ToTargetValue('03.05.2018 17:42:08', $timeValue)->IsZero());78 // Unsupported types79 self::verify(TestEntity::ToTargetValue(0, array()) === null);80 self::verify(TestEntity::ToTargetValue(0, new \stdClass) === null);81 self::verify(TestEntity::ToTargetValue(0, null) === null);82 }83}84?>...

Full Screen

Full Screen

integer.php

Source:integer.php Github

copy

Full Screen

...12 */13class integer extends variable14{15 /**16 * "isZero" checks that the integer is equal to 0.17 *18 * <?php19 * $zero = 0;20 * $notZero = -1;21 *22 * $this23 * ->integer($zero)24 * ->isZero() // passes25 *26 * ->integer($notZero)27 * ->isZero() // fails28 * ;29 *30 * Note: "isZero" is equivalent to "isEqualTo(0)".31 *32 * @var static33 *34 * @link http://docs.atoum.org/en/latest/asserters.html#integer-is-zero35 */36 public $isZero;37 /**38 * "isZero" checks that the integer is equal to 0.39 *40 * <?php41 * $zero = 0;42 * $notZero = -1;43 *44 * $this45 * ->integer($zero)46 * ->isZero() // passes47 *48 * ->integer($notZero)49 * ->isZero() // fails50 * ;51 *52 * Note: "isZero" is equivalent to "isEqualTo(0)".53 *54 * @param string $failMessage55 *56 * @link http://docs.atoum.org/en/latest/asserters.html#integer-is-zero57 *58 * @return $this59 */60 public function isZero($failMessage = null) {}61 /**62 * "isGreaterThan" checks that the integer is strictly higher than given63 * one.64 *65 * <?php66 * $zero = 0;67 *68 * $this69 * ->integer($zero)70 * ->isGreaterThan(-1) // passes71 * ->isGreaterThan('-1') // fails because "-1"72 * // isn't an integer73 * ->isGreaterThan(0) // fails74 * ;...

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1$int = new Integer(0);2$int = new Integer(1);3$int = new Integer(0);4$int = new Integer(1);5class Integer {6 public static function autoload($class) {7 include $class . '.php';8 }9}10spl_autoload_register(array('Integer', 'autoload'));11$int = new Integer(0);

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1$integer = new integer(0);2echo $integer->isZero();3echo $integer->isPositive();4echo $integer->isNegative();5echo $integer->isOdd();6echo $integer->isEven();7echo $integer->isPrime();8echo $integer->factorial();9echo $integer->isPalindrome();10echo $integer->isArmstrong();11echo $integer->isPerfect();12echo $integer->isAmicable();13echo $integer->isHappy();14echo $integer->isAbundant();15echo $integer->isDeficient();16echo $integer->isSquare();17echo $integer->isTriangular();18echo $integer->isHexagonal();19echo $integer->isHeptagonal();20echo $integer->isOctagonal();21echo $integer->isNarcissistic();22echo $integer->isPronic();23echo $integer->isCatalan();24echo $integer->isCarmichael();25echo $integer->isFibonacci();26echo $integer->isLucas();27echo $integer->isMersenne();28echo $integer->isPandigital();29echo $integer->isPandigitalPrime();30echo $integer->isPandigitalSquare();31echo $integer->isPandigitalCube();32echo $integer->isPandigitalFifth();33echo $integer->isPandigitalSixth();34echo $integer->isPandigitalSeventh();35echo $integer->isPandigitalEighth();36echo $integer->isPandigitalNinth();37echo $integer->isPandigitalTenth();38echo $integer->isPandigitalEleventh();39echo $integer->isPandigitalTwelfth();40echo $integer->isPandigitalThirteenth();41echo $integer->isPandigitalFourteenth();42echo $integer->isPandigitalFifteenth();43echo $integer->isPandigitalSixteenth();44echo $integer->isPandigitalSeventeenth();45echo $integer->isPandigitalEighteenth();46echo $integer->isPandigitalNineteenth();47echo $integer->isPandigitalTwentieth();48echo $integer->isPandigitalTwentyFirst();49echo $integer->isPandigitalTwentySecond();50echo $integer->isPandigitalTwentyThird();51echo $integer->isPandigitalTwentyFourth();52echo $integer->isPandigitalTwentyFifth();

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1require_once('Integer.php');2$integer = new Integer(0);3echo $integer->isZero();4require_once('Integer.php');5$integer = new Integer(0);6echo $integer->isZero();

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1$integer = new integer(0);2if($integer->isZero()){3 echo "integer is zero";4}5$float = new float(0.0);6if($float->isZero()){7 echo "float is zero";8}9$double = new double(0.0);10if($double->isZero()){11 echo "double is zero";12}13$long = new long(0);14if($long->isZero()){15 echo "long is zero";16}17$short = new short(0);18if($short->isZero()){19 echo "short is zero";20}21$byte = new byte(0);22if($byte->isZero()){23 echo "byte is zero";24}25$bigInteger = new bigInteger(0);26if($bigInteger->isZero()){27 echo "bigInteger is zero";28}29$bigDecimal = new bigDecimal(0.0);30if($bigDecimal->isZero()){31 echo "bigDecimal is zero";32}33$boolean = new boolean(false);34if($boolean->isZero()){35 echo "boolean is zero";36}37$string = new string("");38if($string->isZero()){39 echo "string is zero";40}41$array = new array(array());42if($array->isZero()){43 echo "array is zero";44}45$object = new object(new stdClass());46if($object->isZero()){47 echo "object is zero";48}49$resource = new resource(fopen("1.php", "r"));50if($resource->isZero()){51 echo "resource is zero";52}53$null = new null(null);54if($null->isZero()){55 echo "null is zero";56}57$callable = new callable(function(){});58if($callable->isZero()){59 echo "callable is zero";

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1include "integer.php";2$number= new integer(0);3if($number->isZero())4{5echo "The number is zero";6}7{8echo "The number is not zero";9}10include "integer.php";11$number= new integer(1);12if($number->isZero())13{14echo "The number is zero";15}16{

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1$int = new integer(0);2if($int->isZero()) {3 echo "Value is Zero";4} else {5 echo "Value is not Zero";6}7$int = new integer(1);8if($int->isZero()) {9 echo "Value is Zero";10} else {11 echo "Value is not Zero";12}

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1require_once 'integer.php';2$int = new integer();3$int->setNumber(0);4echo $int->isZero();5";6echo $int->isPositive();7";8echo $int->isNegative();9";10echo $int->isOdd();11";12echo $int->isEven();13require_once 'integer.php';14$int = new integer();15$int->setNumber(0);16echo $int->isZero();17";18echo $int->isPositive();19";20echo $int->isNegative();21";22echo $int->isOdd();23";24echo $int->isEven();25require_once 'integer.php';26$int = new integer();27$int->setNumber(0);28echo $int->isZero();29";30echo $int->isPositive();31";32echo $int->isNegative();33";34echo $int->isOdd();35";36echo $int->isEven();37require_once 'integer.php';38$int = new integer();39$int->setNumber(0);40echo $int->isZero();41";42echo $int->isPositive();43";44echo $int->isNegative();45";46echo $int->isOdd();47";48echo $int->isEven();49require_once 'integer.php';50$int = new integer();51$int->setNumber(0);52echo $int->isZero();53";54echo $int->isPositive();55";56echo $int->isNegative();57";58echo $int->isOdd();59";60echo $int->isEven();

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1include("integer.class.php");2$integer=new integer(0);3if($integer->isZero()) {4echo "The integer is zero";5}6else {7echo "The integer is not zero";8}

Full Screen

Full Screen

isZero

Using AI Code Generation

copy

Full Screen

1include('integer.php');2$num = new integer(0);3if($num->isZero())4{5echo "Number is zero";6}7{8echo "Number is not zero";9}

Full Screen

Full Screen

Automation Testing Tutorials

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

LambdaTest Learning Hubs:

YouTube

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

Run Atoum automation tests on LambdaTest cloud grid

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

Trigger isZero code on LambdaTest Cloud Grid

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

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful