mageekguy\atoum\asserters\variable::isNotNull PHP Method

isNotNull() public method

public isNotNull ( $failMessage = null )
    public function isNotNull($failMessage = null)
    {
        if ($this->valueIsSet()->value !== null) {
            $this->pass();
        } else {
            $this->fail($failMessage ?: $this->_('%s is null', $this));
        }
        return $this;
    }

Usage Example

Beispiel #1
0
 public function testIsNotTrue()
 {
     $this->if($asserter = new sut($generator = new asserter\generator()))->then->boolean($asserter->wasSet())->isFalse()->exception(function () use($asserter) {
         $asserter->isNotNull(rand(-PHP_INT_MAX, PHP_INT_MAX));
     })->isInstanceOf('logicException')->hasMessage('Value is undefined')->if($asserter->setWith(uniqid()))->then->object($asserter->isNotTrue())->isIdenticalTo($asserter)->if($asserter->setWith(true))->then->exception(function () use($asserter) {
         $asserter->isNotTrue();
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is true'), $asserter));
 }