function FieldTestCase::_generateTestFieldValues
Generate random values for a field_test field.
Parameters
$cardinality: Number of values to generate.
Return value
An array of random values, in the format expected for field values.
28 calls to FieldTestCase::_generateTestFieldValues()
- FieldAttachOtherTestCase::testFieldAttachCache in drupal-7.x/
modules/ field/ tests/ field.test - Test field cache.
- FieldAttachOtherTestCase::testFieldAttachCache in drupal-7.x/
modules/ field/ tests/ field.test - Test field cache.
- FieldAttachOtherTestCase::testFieldAttachPrepareViewMultiple in drupal-7.x/
modules/ field/ tests/ field.test - Tests the 'multiple entity' behavior of field_attach_prepare_view().
- FieldAttachOtherTestCase::testFieldAttachPrepareViewMultiple in drupal-7.x/
modules/ field/ tests/ field.test - Tests the 'multiple entity' behavior of field_attach_prepare_view().
- FieldAttachOtherTestCase::testFieldAttachValidate in drupal-7.x/
modules/ field/ tests/ field.test - Test field_attach_validate().
Archivo
- drupal-7.x/
modules/ field/ tests/ field.test, line 38 - Tests for field.module.
Class
- FieldTestCase
- Parent class for Field API tests.
Código
function _generateTestFieldValues($cardinality) {
$values = array();
for ($i = 0; $i < $cardinality; $i++) {
// field_test fields treat 0 as 'empty value'.
$values[$i]['value'] = mt_rand(1, 127);
}
return $values;
}