function ViewsUIWizardTaggedWithTestCase::setUp
Overrides ViewsUIWizardHelper::setUp
File
-
tests/
views_ui.test, line 320
Class
- ViewsUIWizardTaggedWithTestCase
- Tests the ability of the views wizard to create views filtered by taxonomy.
Code
public function setUp(array $modules = array()) {
parent::setUp($modules);
// Create two content types. One will have an autocomplete tagging field,
// and one won't.
$this->node_type_with_tags = $this->drupalCreateContentType();
$this->node_type_without_tags = $this->drupalCreateContentType();
// Create the vocabulary for the tag field.
$this->tag_vocabulary = new stdClass();
$this->tag_vocabulary->name = 'Views testing tags';
$this->tag_vocabulary->machine_name = 'views_testing_tags';
taxonomy_vocabulary_save($this->tag_vocabulary);
// Create the tag field itself.
$this->tag_field = array(
'field_name' => 'field_views_testing_tags',
'type' => 'taxonomy_term_reference',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $this->tag_vocabulary->machine_name,
'parent' => 0,
),
),
),
);
field_create_field($this->tag_field);
// Create an instance of the tag field on one of the content types, and
// configure it to display an autocomplete widget.
$this->tag_instance = array(
'field_name' => 'field_views_testing_tags',
'entity_type' => 'node',
'bundle' => $this->node_type_with_tags->type,
'widget' => array(
'type' => 'taxonomy_autocomplete',
),
'display' => array(
'default' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
'teaser' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
),
);
field_create_instance($this->tag_instance);
}