protected function TaxonomyTestBase::mockStandardInstall

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 drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php
Sets up a Drupal site for running functional and integration tests.

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php, line 69
Contains \Drupal\taxonomy\Tests\Views\TaxonomyTestBase.

Class

TaxonomyTestBase
Base class for all taxonomy tests.

Namespace

Drupal\taxonomy\Tests\Views

Code

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',
    'vid' => 'views_testing_tags',
  ));
  $this->vocabulary
    ->save();
  $field = array(
    'field_name' => 'field_' . $this->vocabulary
      ->id(),
    'type' => 'taxonomy_term_reference',
    // Set cardinality to unlimited for tagging.
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    'settings' => array(
      'allowed_values' => array(
        array(
          'vocabulary' => $this->vocabulary
            ->id(),
          'parent' => 0,
        ),
      ),
    ),
  );
  field_create_field($field);
  $instance = array(
    'field_name' => 'field_' . $this->vocabulary
      ->id(),
    'entity_type' => 'node',
    'label' => 'Tags',
    'bundle' => 'article',
  );
  field_create_instance($instance);
  entity_get_form_display('node', 'article', 'default')
    ->setComponent($instance['field_name'], array(
    'type' => 'taxonomy_autocomplete',
    'weight' => -4,
  ))
    ->save();
  entity_get_display('node', 'article', 'default')
    ->setComponent($instance['field_name'], array(
    'type' => 'taxonomy_term_reference_link',
    'weight' => 10,
  ))
    ->save();
  entity_get_display('node', 'article', 'teaser')
    ->setComponent($instance['field_name'], array(
    'type' => 'taxonomy_term_reference_link',
    'weight' => 10,
  ))
    ->save();
}