本文整理汇总了PHP中NumericField::Value方法的典型用法代码示例。如果您正苦于以下问题:PHP NumericField::Value方法的具体用法?PHP NumericField::Value怎么用?PHP NumericField::Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NumericField
的用法示例。
在下文中一共展示了NumericField::Value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkDataFormatting
/**
* Test that data loaded in via Form::loadDataFrom(DataObject) will populate the field correctly,
* and can format the database value appropriately for the frontend
*
* @param string $locale
* @param array $tests
*/
public function checkDataFormatting($locale, $tests)
{
i18n::set_locale($locale);
$field = new NumericField('Number');
$form = new Form(new Controller(), 'Form', new FieldList($field), new FieldList());
$dataObject = new NumericFieldTest_Object();
foreach ($tests as $input => $output) {
// Given a dataobject as a context, the field should assume the field value is not localised
$dataObject->Number = (string) $input;
$form->loadDataFrom($dataObject, Form::MERGE_CLEAR_MISSING);
// Test value
$this->assertEquals($input, $field->dataValue(), "Expected {$input} loaded via dataobject to be left intact in locale {$locale}");
// Test expected formatted value (Substitute nbsp for spaces)
$this->assertEquals($this->clean($output), $field->Value(), "Expected {$input} to be formatted as {$output} in locale {$locale}");
}
}
示例2: Value
/**
* Get the value of the stock level
*
* (non-PHPdoc)
* @see FormField::Value()
* @return Int
*/
function Value()
{
return $this->value;
return $this->stockLevelField->Value();
}