mageekguy\atoum\asserters\phpArray::isNotEmpty PHP Метод

isNotEmpty() публичный Метод

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

Usage Example

Пример #1
0
 public function testIsNotEmpty()
 {
     $this->if($asserter = new asserters\phpArray($generator = new asserter\generator()))->then->boolean($asserter->wasSet())->isFalse()->exception(function () use($asserter) {
         $asserter->isNotEmpty();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Array is undefined')->if($asserter->setWith(array()))->then->exception(function () use($asserter) {
         $asserter->isNotEmpty();
     })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is empty'), $asserter))->if($asserter->setWith(array(uniqid())))->then->object($asserter->isNotEmpty())->isIdenticalTo($asserter);
 }