protected function ToggleEditableFieldsUiTest::setUp in Toggle Editable fields 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ ToggleEditableFieldsUiTest.php, line 66
Class
- ToggleEditableFieldsUiTest
- Tests the Form mode manager user interfaces.
Namespace
Drupal\Tests\toggle_editable_fields\FunctionalCode
protected function setUp() {
parent::setUp();
// Add a content type.
$this->nodeType1 = $this
->drupalCreateContentType();
$this->adminUser = $this
->drupalCreateUser([
'administer content types',
'administer node fields',
'administer node display',
]);
$this
->drupalLogin($this->adminUser);
$this
->drupalPlaceBlock('system_breadcrumb_block');
// Add a boolean field to the newly-created type.
$label = $this
->randomMachineName();
$field_name = Unicode::strtolower($label);
$this
->createBooleanField($label, $field_name, $this->nodeType1
->id(), 'toggle_editable_formatter', [], [], [
'label' => 'hidden',
'region' => 'content',
]);
$this
->drupalGet("admin/structure/types/manage/{$this->nodeType1->id()}/display");
$edit = [
"display_modes_custom[full]" => TRUE,
];
$this
->drupalPostForm("admin/structure/types/manage/{$this->nodeType1->id()}/display", $edit, t('Save'));
// Generate contents to this tests.
for ($i = 0; $i < 50; $i++) {
$this->nodes[] = $this
->createNode([
'type' => $this->nodeType1
->id(),
]);
}
}