function TaxonomyRSSTestCase::setUp

Overrides DrupalWebTestCase::setUp

File

modules/taxonomy/taxonomy.test, line 1090

Class

TaxonomyRSSTestCase
Tests the rendering of term reference fields in RSS feeds.

Code

function setUp() {
    parent::setUp('taxonomy');
    $this->admin_user = $this->drupalCreateUser(array(
        'administer taxonomy',
        'bypass node access',
        'administer content types',
        'administer fields',
    ));
    $this->drupalLogin($this->admin_user);
    $this->vocabulary = $this->createVocabulary();
    $field = array(
        'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
        'type' => 'taxonomy_term_reference',
        'cardinality' => FIELD_CARDINALITY_UNLIMITED,
        'settings' => array(
            'allowed_values' => array(
                array(
                    'vocabulary' => $this->vocabulary->machine_name,
                    'parent' => 0,
                ),
            ),
        ),
    );
    field_create_field($field);
    $this->instance = array(
        'field_name' => 'taxonomy_' . $this->vocabulary->machine_name,
        'bundle' => 'article',
        'entity_type' => 'node',
        'widget' => array(
            'type' => 'options_select',
        ),
        'display' => array(
            'default' => array(
                'type' => 'taxonomy_term_reference_link',
            ),
        ),
    );
    field_create_instance($this->instance);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.