public function AdminUITest::doFlagAdd in Flag 8.4
Flag creation.
1 call to AdminUITest::doFlagAdd()
- AdminUITest::testFlagAdmin in tests/
src/ Functional/ AdminUITest.php - Test basic flag admin.
File
- tests/
src/ Functional/ AdminUITest.php, line 104
Class
- AdminUITest
- Tests the Flag admin UI.
Namespace
Drupal\Tests\flag\FunctionalCode
public function doFlagAdd() {
// Test with minimal value requirement.
$this
->drupalPostForm('admin/structure/flags/add', [], $this
->t('Continue'));
// Check for fieldset titles.
$this
->assertText(t('Messages'));
$this
->assertText(t('Flag access'));
$this
->assertText(t('Display options'));
$edit = [
'label' => $this->label,
'id' => $this->flagId,
'bundles[' . $this->nodeType . ']' => $this->nodeType,
'flag_short' => $this->flagShortText,
'unflag_short' => $this->unflagShortText,
];
$this
->drupalPostForm(NULL, $edit, $this
->t('Create Flag'));
$this
->assertText(t('Flag @this_label has been added.', [
'@this_label' => $this->label,
]));
$this->flag = $this->flagService
->getFlagById($this->flagId);
$this
->assertNotNull($this->flag, 'The flag was created.');
$this
->grantFlagPermissions($this->flag);
}