function LinkFormatterTest::setUp
Same name and namespace in other branches
- 11.x core/modules/link/tests/src/Kernel/LinkFormatterTest.php \Drupal\Tests\link\Kernel\LinkFormatterTest::setUp()
Overrides EntityKernelTestBase::setUp
File
-
core/
modules/ link/ tests/ src/ Kernel/ LinkFormatterTest.php, line 61
Class
- LinkFormatterTest
- Tests the Field Formatter for the link field type.
Namespace
Drupal\Tests\link\KernelCode
protected function setUp() : void {
parent::setUp();
// Use Stark theme for testing markup output.
\Drupal::service('theme_installer')->install([
'stark',
]);
$this->config('system.theme')
->set('default', 'stark')
->save();
$this->installEntitySchema('entity_test');
// Grant the 'view test entity' permission.
$this->installConfig([
'user',
]);
Role::load(RoleInterface::ANONYMOUS_ID)->grantPermission('view test entity')
->save();
FieldStorageConfig::create([
'field_name' => $this->fieldName,
'type' => 'link',
'entity_type' => $this->entityType,
'cardinality' => 1,
])
->save();
FieldConfig::create([
'field_name' => $this->fieldName,
'entity_type' => $this->entityType,
'bundle' => $this->bundle,
'label' => 'Field test',
])
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.