public function IntegrationTest::setUp in Acquia Content Hub 8
Overrides ContentHubTestBase::setUp
File
- tests/
src/ Functional/ IntegrationTest.php, line 91
Class
- IntegrationTest
- Tests the overall functionality of the Acquia Content Hub module.
Namespace
Drupal\Tests\acquia_contenthub\FunctionalCode
public function setUp() : void {
parent::setUp();
$this->adminRole = $this
->createAdminRole();
$this->limitedRole = $this
->createRole([
'access content',
]);
// Create a field to test access.
$this->fieldStorage = FieldStorageConfig::create([
'field_name' => 'test_field_01',
'entity_type' => 'node',
'type' => 'boolean',
]);
$this->fieldStorage
->save();
$this->field = FieldConfig::create([
'field_name' => 'test_field_01',
'entity_type' => 'node',
'bundle' => 'article',
'label' => 'Test',
'required' => TRUE,
'settings' => [
'on_label' => 'field_test_01_on',
'off_label' => 'field_test_01_off',
],
]);
$this->field
->save();
// Create a display for the full view mode.
\Drupal::service('entity_display.repository')
->getViewDisplay('node', 'article', 'full')
->setComponent('test_field_01', [
'type' => 'boolean',
])
->save();
// Create a display for the teaser view mode.
\Drupal::service('entity_display.repository')
->getViewDisplay('node', 'article', 'teaser')
->setComponent('test_field_01', [
'type' => 'boolean',
])
->save();
}