本文整理汇总了PHP中Zend_Validate_Date::getLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_Date::getLocale方法的具体用法?PHP Zend_Validate_Date::getLocale怎么用?PHP Zend_Validate_Date::getLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Validate_Date
的用法示例。
在下文中一共展示了Zend_Validate_Date::getLocale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUseLocaleFormat
/**
* Ensures that the validator can handle different dateformats from locale
*
* @see http://framework.zend.com/issues/browse/ZF-2003
* @return void
*/
public function testUseLocaleFormat()
{
$errorOccurredLocal = false;
set_error_handler(array($this, 'errorHandlerIgnore'));
$valuesExpected = array('10.01.2008' => true, '32.02.2008' => false, '20 April 2008' => true, '1 Jul 2008' => true, '2008/20/03' => false, '99/99/2000' => false, 0 => false, 999999999999 => false, 'Jan 1 2007' => false);
foreach ($valuesExpected as $input => $resultExpected) {
$resultActual = $this->_validator->setLocale('de_AT')->isValid($input);
if (!$this->_errorOccurred) {
$this->assertEquals($resultExpected, $resultActual, "'{$input}' expected to be " . ($resultExpected ? '' : 'in') . 'valid');
} else {
$errorOccurredLocal = true;
}
$this->_errorOccurred = false;
}
$this->assertEquals('de_AT', $this->_validator->getLocale());
restore_error_handler();
if ($errorOccurredLocal) {
$this->markTestSkipped('Affected by bug described in ZF-2789');
}
}