protected function TaxonomyTermViewTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php \Drupal\taxonomy\Tests\Views\TaxonomyTermViewTest::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/ Views/ TaxonomyTermViewTest.php, line 48 - Contains \Drupal\taxonomy\Tests\Views\TaxonomyTermViewTest.
Class
- TaxonomyTermViewTest
- Tests the taxonomy term view page and its translation.
Namespace
Drupal\taxonomy\Tests\ViewsCode
protected function setUp() {
parent::setUp();
// Create an administrative user.
$this->adminUser = $this
->drupalCreateUser([
'administer taxonomy',
'bypass node access',
]);
$this
->drupalLogin($this->adminUser);
// Create a vocabulary and add two term reference fields to article nodes.
$this->fieldName1 = Unicode::strtolower($this
->randomMachineName());
$handler_settings = array(
'target_bundles' => array(
$this->vocabulary
->id() => $this->vocabulary
->id(),
),
'auto_create' => TRUE,
);
$this
->createEntityReferenceField('node', 'article', $this->fieldName1, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
entity_get_form_display('node', 'article', 'default')
->setComponent($this->fieldName1, array(
'type' => 'options_select',
))
->save();
entity_get_display('node', 'article', 'default')
->setComponent($this->fieldName1, array(
'type' => 'entity_reference_label',
))
->save();
}