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

isLessThan() public method

public isLessThan ( $value, $failMessage = null )
    public function isLessThan($value, $failMessage = null)
    {
        if ($this->valueIsSet()->value < $value) {
            $this->pass();
        } else {
            $this->fail($failMessage ?: $this->_('%s is not less than %s', $this, $this->getTypeOf($value)));
        }
        return $this;
    }

Usage Example

示例#1
0
 public function testIsLessThan()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->and($asserter->setWith($value = -rand(1, PHP_INT_MAX - 1)))->then->object($asserter->isLessThan(0))->isIdenticalTo($asserter)->if($diff = new diffs\variable())->and($diff->setExpected(-PHP_INT_MAX)->setActual($value))->then->exception(function () use($asserter, $value) {
         $asserter->isLessThan(-PHP_INT_MAX);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is not less than %s'), $asserter, $asserter->getTypeOf(-PHP_INT_MAX)))->if($diff = new diffs\variable())->and($diff->setExpected($value)->setActual($value))->then->exception(function () use($asserter, $value) {
         $asserter->isLessThan($value);
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is not less than %s'), $asserter, $asserter->getTypeOf($value)));
 }