mageekguy\atoum\asserters\dateTime::setWith PHP Метод

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

public setWith ( $value, $checkType = true )
    public function setWith($value, $checkType = true)
    {
        parent::setWith($value, false);
        if ($checkType === true) {
            if (self::isDateTime($this->value)) {
                $this->pass();
            } else {
                $this->fail($this->_('%s is not an instance of \\dateTime', $this));
            }
        }
        return $this;
    }

Usage Example

Пример #1
0
 public function setWith($value, $checkType = true)
 {
     $phpDate = \dateTime::createFromFormat(self::mysqlDateTimeFormat, $value);
     if ($phpDate !== false) {
         parent::setWith($phpDate, $checkType);
     } else {
         parent::setWith($value, false);
         if ($checkType === true) {
             $this->fail(sprintf($this->getLocale()->_('%s is not in format Y-m-d H:i:s'), $this));
         }
     }
     return $this;
 }
All Usage Examples Of mageekguy\atoum\asserters\dateTime::setWith