protected function FastTestBase::setUp in Display Suite 8.2
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 WebTestBase::setUp
3 calls to FastTestBase::setUp()
- BlockFieldPluginTest::setUp in src/
Tests/ BlockFieldPluginTest.php - Sets up a Drupal site for running functional and integration tests.
- BlockTest::setUp in src/
Tests/ BlockTest.php - Sets up a Drupal site for running functional and integration tests.
- ViewsTest::setUp in src/
Tests/ ViewsTest.php - Sets up a Drupal site for running functional and integration tests.
3 methods override FastTestBase::setUp()
- BlockFieldPluginTest::setUp in src/
Tests/ BlockFieldPluginTest.php - Sets up a Drupal site for running functional and integration tests.
- BlockTest::setUp in src/
Tests/ BlockTest.php - Sets up a Drupal site for running functional and integration tests.
- ViewsTest::setUp in src/
Tests/ ViewsTest.php - Sets up a Drupal site for running functional and integration tests.
File
- src/
Tests/ FastTestBase.php, line 84
Class
- FastTestBase
- Base test for Display Suite.
Namespace
Drupal\ds\TestsCode
protected function setUp() {
parent::setUp();
$this
->drupalPlaceBlock('system_breadcrumb_block');
$this
->drupalPlaceBlock('local_tasks_block');
// Create a test user.
$this->adminUser = $this
->drupalCreateUser(array(
'access content',
'access in-place editing',
'admin classes',
'admin display suite',
'admin fields',
'administer nodes',
'view all revisions',
'administer content types',
'administer node fields',
'administer node form display',
'administer node display',
'administer taxonomy',
'administer taxonomy_term fields',
'administer taxonomy_term display',
'administer users',
'administer permissions',
'administer account settings',
'administer user display',
'administer software updates',
'access site in maintenance mode',
'administer site configuration',
'bypass node access',
'ds switch view mode',
));
$this
->drupalLogin($this->adminUser);
// Create random field name.
$this->fieldLabel = $this
->randomMachineName(8);
$this->fieldNameInput = strtolower($this
->randomMachineName(8));
$this->fieldName = 'field_' . $this->fieldNameInput;
// Create Article node type.
$this
->drupalCreateContentType(array(
'type' => 'article',
'name' => 'Article',
'revision' => TRUE,
));
$this
->drupalCreateContentType(array(
'type' => 'page',
'name' => 'Page',
'revision' => TRUE,
));
// Create a vocabulary named "Tags".
$this->vocabulary = Vocabulary::create(array(
'name' => 'Tags',
'vid' => 'tags',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
));
$this->vocabulary
->save();
$term1 = Term::create(array(
'name' => 'Tag 1',
'vid' => 'tags',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
));
$term1
->save();
$term2 = Term::create(array(
'name' => 'Tag 2',
'vid' => 'tags',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
));
$term2
->save();
$handler_settings = array(
'target_bundles' => array(
$this->vocabulary
->id() => $this->vocabulary
->id(),
),
// Enable auto-create.
'auto_create' => TRUE,
);
$this
->createEntityReferenceField('node', 'article', 'field_' . $this->vocabulary
->id(), 'Tags', 'taxonomy_term', 'default', $handler_settings, 10);
entity_get_form_display('node', 'article', 'default')
->setComponent('field_' . $this->vocabulary
->id())
->save();
}