You are here

protected function MicrodataCoreFieldsTestCase::getFields in Microdata 7

Implements MicrodataFieldTestCase::getFields().

Overrides MicrodataFieldTestCase::getFields

File

./microdata.test, line 167
Tests for microdata.module.

Class

MicrodataCoreFieldsTestCase

Code

protected function getFields() {
  $vocabulary = (object) array(
    'name' => st('Keywords'),
    'description' => 'description',
    'machine_name' => 'keywords',
  );
  taxonomy_vocabulary_save($vocabulary);
  $fields = array(
    // Text field.
    array(
      'field_name' => $this->textFieldName,
      'type' => 'text',
    ),
    // List field.
    array(
      'field_name' => $this->listFieldName,
      'type' => 'list_text',
      'cardinality' => 3,
      'settings' => array(
        'allowed_values' => array(
          1 => 'One',
          2 => 'Two',
          3 => 'Three',
        ),
      ),
    ),
    // Number field.
    array(
      'field_name' => $this->numberFieldName,
      'type' => 'number_integer',
    ),
    // Second taxonomy field.
    array(
      'field_name' => $this->keywordsFieldName,
      'type' => 'taxonomy_term_reference',
      // Set cardinality to unlimited for tagging.
      'cardinality' => FIELD_CARDINALITY_UNLIMITED,
      'settings' => array(
        'allowed_values' => array(
          array(
            'vocabulary' => $vocabulary->machine_name,
            'parent' => 0,
          ),
        ),
      ),
    ),
  );
  return $fields;
}