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

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

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

Usage Example

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