protected function TaxonomyTestBase::mockStandardInstall in Views (for Drupal 7) 8.3
Provides a workaround for the inability to use the standard profile.
See also
http://drupal.org/node/1708692
1 call to TaxonomyTestBase::mockStandardInstall()
- TaxonomyTestBase::setUp in lib/
Drupal/ views/ Tests/ Taxonomy/ TaxonomyTestBase.php - Sets up a Drupal site for running functional and integration tests.
File
- lib/
Drupal/ views/ Tests/ Taxonomy/ TaxonomyTestBase.php, line 65 - Definition of Drupal\views\Tests\Taxonomy\TaxonomyTestBase.
Class
- TaxonomyTestBase
- Base class for all taxonomy tests.
Namespace
Drupal\views\Tests\TaxonomyCode
protected function mockStandardInstall() {
$type = array(
'type' => 'article',
);
$type = node_type_set_defaults($type);
node_type_save($type);
node_add_body_field($type);
// Create the vocabulary for the tag field.
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
'name' => 'Views testing tags',
'machine_name' => 'views_testing_tags',
));
$this->vocabulary
->save();
$field = array(
'field_name' => 'field_' . $this->vocabulary->machine_name,
'type' => 'taxonomy_term_reference',
// Set cardinality to unlimited for tagging.
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => $this->vocabulary->machine_name,
'parent' => 0,
),
),
),
);
field_create_field($field);
$instance = array(
'field_name' => 'field_' . $this->vocabulary->machine_name,
'entity_type' => 'node',
'label' => 'Tags',
'bundle' => 'article',
'widget' => array(
'type' => 'taxonomy_autocomplete',
'weight' => -4,
),
'display' => array(
'default' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
'teaser' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
),
);
field_create_instance($instance);
}