protected function TokenReplaceTest::setUp in Zircon Profile 8
Same name in this branch
- 8 core/modules/views/src/Tests/TokenReplaceTest.php \Drupal\views\Tests\TokenReplaceTest::setUp()
- 8 core/modules/taxonomy/src/Tests/TokenReplaceTest.php \Drupal\taxonomy\Tests\TokenReplaceTest::setUp()
Same name and namespace in other branches
- 8.0 core/modules/taxonomy/src/Tests/TokenReplaceTest.php \Drupal\taxonomy\Tests\TokenReplaceTest::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/ TokenReplaceTest.php, line 35 - Contains \Drupal\taxonomy\Tests\TokenReplaceTest.
Class
- TokenReplaceTest
- Generates text using placeholders for dummy content to check taxonomy token replacement.
Namespace
Drupal\taxonomy\TestsCode
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'administer taxonomy',
'bypass node access',
]));
$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();
}