You are here

protected function TaxonomyTestBase::mockStandardInstall in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php \Drupal\taxonomy\Tests\Views\TaxonomyTestBase::mockStandardInstall()

Provides a workaround for the inability to use the standard profile.

See also

https://www.drupal.org/node/1708692

1 call to TaxonomyTestBase::mockStandardInstall()
TaxonomyTestBase::setUp in core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php
Sets up a Drupal site for running functional and integration tests.

File

core/modules/taxonomy/src/Tests/Views/TaxonomyTestBase.php, line 80
Contains \Drupal\taxonomy\Tests\Views\TaxonomyTestBase.

Class

TaxonomyTestBase
Base class for all taxonomy tests.

Namespace

Drupal\taxonomy\Tests\Views

Code

protected function mockStandardInstall() {
  $this
    ->drupalCreateContentType(array(
    'type' => 'article',
  ));

  // 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_name = 'field_' . $this->vocabulary
    ->id();
  $handler_settings = array(
    'target_bundles' => array(
      $this->vocabulary
        ->id() => $this->vocabulary
        ->id(),
    ),
    'auto_create' => TRUE,
  );
  $this
    ->createEntityReferenceField('node', 'article', $field_name, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
  entity_get_form_display('node', 'article', 'default')
    ->setComponent($field_name, array(
    'type' => 'entity_reference_autocomplete_tags',
    'weight' => -4,
  ))
    ->save();
  entity_get_display('node', 'article', 'default')
    ->setComponent($field_name, array(
    'type' => 'entity_reference_label',
    'weight' => 10,
  ))
    ->save();
  entity_get_display('node', 'article', 'teaser')
    ->setComponent($field_name, array(
    'type' => 'entity_reference_label',
    'weight' => 10,
  ))
    ->save();
}