function viewsHandlerFieldFieldTest::setUp

Overrides ViewsSqlTest::setUp

File

tests/field/views_fieldapi.test, line 306

Class

viewsHandlerFieldFieldTest
Tests the field_field handler.

Code

public function setUp(array $modules = array()) {
    parent::setUp($modules);
    // Setup basic fields.
    $this->setUpFields(3);
    // Setup a field with cardinality > 1.
    $this->fields[3] = $field = field_create_field(array(
        'field_name' => 'field_name_3',
        'type' => 'text',
        'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    ));
    // Setup a field that will have no value.
    $this->fields[4] = $field = field_create_field(array(
        'field_name' => 'field_name_4',
        'type' => 'text',
        'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    ));
    $this->setUpInstances();
    $this->clearViewsCaches();
    // Create some nodes.
    $this->nodes = array();
    for ($i = 0; $i < 3; $i++) {
        $edit = array(
            'type' => 'page',
        );
        for ($key = 0; $key < 3; $key++) {
            $field = $this->fields[$key];
            $edit[$field['field_name']][LANGUAGE_NONE][0]['value'] = $this->randomName(8);
        }
        for ($j = 0; $j < 5; $j++) {
            $edit[$this->fields[3]['field_name']][LANGUAGE_NONE][$j]['value'] = $this->randomName(8);
        }
        // Set this field to be empty.
        $edit[$this->fields[4]['field_name']] = array();
        $this->nodes[$i] = $this->drupalCreateNode($edit);
    }
}