本文整理汇总了PHP中lmb_i18n函数的典型用法代码示例。如果您正苦于以下问题:PHP lmb_i18n函数的具体用法?PHP lmb_i18n怎么用?PHP lmb_i18n使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lmb_i18n函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRequiredRuleFailure
function testRequiredRuleFailure()
{
$rule = new lmbRequiredRule('testfield');
$dataspace = new lmbSet();
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} is required', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($dataspace, $this->error_list);
}
示例2: testLocaleDateRuleError
function testLocaleDateRuleError()
{
$rule = new lmbLocaleDateRule('test', new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/en.ini')));
$data = new lmbSet(array('test' => '02jjklklak/sdsdskj34-sdsdsjkjkj78'));
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must have a valid date format', 'validation'), array('Field' => 'test'), array()));
$rule->validate($data, $this->error_list);
}
示例3: testSizeRangeRuleTooSmall
function testSizeRangeRuleTooSmall()
{
$rule = new lmbI18NSizeRangeRule('testfield', 30, 100);
$data = new lmbSet(array('testfield' => 'тест'));
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must be greater than {min} and less than {max} characters.', 'validation'), array('Field' => 'testfield'), array('min' => 30, 'max' => 100)));
$rule->validate($data, $this->error_list);
}
示例4: _generateErrorMessage
protected function _generateErrorMessage()
{
for ($i = 0; $i < count($this->field_names); $i++) {
$fields[] = '{' . $i . '}';
}
return lmb_i18n('Atleast one field required among: {fields}', array('{fields}' => implode(', ', $fields)), 'validation');
}
示例5: testInvalidAndMoreFields
function testInvalidAndMoreFields()
{
$dataspace = new lmbSet();
$rule = new lmbAtleastOneFieldRequiredRule(array('field1', 'field2', 'field3'));
$this->error_list->expectOnce('addError', array(lmb_i18n('Atleast one field required among: {fields}', array('{fields}' => '{0}, {1}, {2}'), 'validation'), array('field1', 'field2', 'field3'), array()));
$rule->validate($dataspace, $this->error_list);
}
示例6: testNotValidWithClassRestriction
function testNotValidWithClassRestriction()
{
$rule = new lmbRequiredObjectRule('testfield', 'Foo');
$dataspace = new lmbSet();
$dataspace->set('testfield', new TestObjectForThisRule());
$this->error_list->expectOnce('addError', array(lmb_i18n('Object {Field} is required', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($dataspace, $this->error_list);
}
示例7: testEmailRuleInvalidDomain
function testEmailRuleInvalidDomain()
{
$rule = new lmbEmailRule('testfield');
$dataspace = new lmbSet();
$dataspace->set('testfield', 'billgates@micro$oft.com');
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must contain only letters, numbers, hyphens, and periods.', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($dataspace, $this->error_list);
}
示例8: testInArrayError
function testInArrayError()
{
$rule = new lmbNotInArrayRule('testfield', array('www', 'ftp', 'smtp', 'mail'));
$data = new lmbSet();
$data->set('testfield', 'www');
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} has not allowed value.', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($data, $this->error_list);
}
示例9: _doValidate
/**
* @see lmbBaseValidationRule :: _doValidate()
*/
protected function _doValidate($datasource)
{
$value = $datasource->get($this->field_name);
if (is_null($value) || is_string($value) && trim($value) === '') {
$error = $this->custom_error ? $this->custom_error : lmb_i18n('{Field} is required', 'validation');
$this->error($error, array('Field' => $this->field_name));
}
}
示例10: testSizeRangeRuleTooSmall
function testSizeRangeRuleTooSmall()
{
$rule = new lmbSizeRangeRule('testfield', 30, 100);
$dataspace = new lmbSet();
$dataspace->set('testfield', '12345678901234567890');
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must be greater than {min} characters.', 'validation'), array('Field' => 'testfield'), array('min' => 30, 'max' => 100)));
$rule->validate($dataspace, $this->error_list);
}
示例11: testUrlRuleDomain
function testUrlRuleDomain()
{
$rule = new lmbUrlRule('testfield');
$dataspace = new lmbSet();
$dataspace->set('testfield', 'http://www.source--forge.net/');
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} may not contain double hyphens (--).', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($dataspace, $this->error_list);
}
示例12: testFieldNotValid2
function testFieldNotValid2()
{
$rule = new lmbUniqueTableFieldRule('test', 'test_table', 'field1');
$data = new lmbSet();
$data->set('test', "001");
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must have other value since {Value} already exists', 'web_app'), array('Field' => 'test'), array('Value' => '001')));
$rule->validate($data, $this->error_list);
}
示例13: testValidValueRule_Error_Int
function testValidValueRule_Error_Int()
{
$rule = new lmbValidValueRule('testfield', 1);
$data = new lmbSet();
$data->set('testfield', 0);
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} value is wrong', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($data, $this->error_list);
}
示例14: testNotValidContainsSlash
function testNotValidContainsSlash()
{
$rule = new lmbIdentifierRule('test');
$data = new lmbSet();
$data->set('test', 'test/test');
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must contain only letters and numbers', 'validation'), array('Field' => 'test'), array()));
$rule->validate($data, $this->error_list);
}
示例15: testPatternRuleFailed
function testPatternRuleFailed()
{
$rule = new lmbPatternRule('testfield', '/^\\w+$/');
$data = new lmbSet();
$data->set('testfield', 'Simpletest is Cool!');
$this->error_list->expectOnce('addError', array(lmb_i18n('{Field} value is wrong', 'validation'), array('Field' => 'testfield'), array()));
$rule->validate($data, $this->error_list);
}