mageekguy\atoum\asserters\integer::setWith PHP Method

setWith() public method

public setWith ( $value )
    public function setWith($value)
    {
        parent::setWith($value);
        if ($this->analyzer->isInteger($this->value) === true) {
            $this->pass();
        } else {
            $this->fail($this->_('%s is not an integer', $this));
        }
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 protected function matches($actual)
 {
     if ($this->analyzer->isInteger($this->expected) === false) {
         throw new \PHPUnit_Framework_Exception('Expected value of ' . __CLASS__ . ' must be an integer');
     }
     switch (true) {
         case $this->analyzer->isArray($actual):
             $asserter = new asserters\phpArray(null, $this->analyzer);
             $asserter->setWith($actual)->hasSize($this->expected);
             break;
         case $actual instanceof \countable:
             $asserter = new asserters\sizeOf(null, $this->analyzer);
             $asserter->setWith($actual)->isEqualTo($this->expected);
             break;
         case $actual instanceof \iteratorAggregate:
             $asserter = new asserters\integer(null, $this->analyzer);
             $asserter->setWith(iterator_count($actual->getIterator()))->isEqualTo($this->expected);
             break;
         case $actual instanceof \traversable:
         case $actual instanceof \iterator:
             $asserter = new asserters\integer(null, $this->analyzer);
             $asserter->setWith(iterator_count($actual))->isEqualTo($this->expected);
             break;
         default:
             throw new \PHPUnit_Framework_Exception('Actual value of ' . __CLASS__ . ' must be an array, a countable object or a traversable object');
     }
 }
All Usage Examples Of mageekguy\atoum\asserters\integer::setWith