You are here

protected function RssTest::setUp in Zircon Profile 8

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

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides TaxonomyTestBase::setUp

File

core/modules/taxonomy/src/Tests/RssTest.php, line 42
Contains \Drupal\taxonomy\Tests\RssTest.

Class

RssTest
Ensure that data added as terms appears in RSS feeds if "RSS Category" format is selected.

Namespace

Drupal\taxonomy\Tests

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this
    ->drupalCreateUser([
    'administer taxonomy',
    'bypass node access',
    'administer content types',
    'administer node display',
  ]));
  $this->vocabulary = $this
    ->createVocabulary();
  $this->fieldName = 'taxonomy_' . $this->vocabulary
    ->id();
  $handler_settings = array(
    'target_bundles' => array(
      $this->vocabulary
        ->id() => $this->vocabulary
        ->id(),
    ),
    'auto_create' => TRUE,
  );
  $this
    ->createEntityReferenceField('node', 'article', $this->fieldName, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
  entity_get_form_display('node', 'article', 'default')
    ->setComponent($this->fieldName, array(
    'type' => 'options_select',
  ))
    ->save();
  entity_get_display('node', 'article', 'default')
    ->setComponent($this->fieldName, array(
    'type' => 'entity_reference_label',
  ))
    ->save();
}