public function LinkTypeFieldEntryTest::doEditFlagField in Flag 8.4
Edit the field value of the existing flagging.
1 call to LinkTypeFieldEntryTest::doEditFlagField()
- LinkTypeFieldEntryTest::testCreateFieldEntryFlag in tests/
src/ Functional/ LinkTypeFieldEntryTest.php - Create a new flag with the Field Entry type, and add fields.
File
- tests/
src/ Functional/ LinkTypeFieldEntryTest.php, line 148
Class
- LinkTypeFieldEntryTest
- Test the Field Entry link type.
Namespace
Drupal\Tests\flag\FunctionalCode
public function doEditFlagField() {
$flag_id = $this->flag
->id();
$this
->drupalGet('node/' . $this->nodeId);
// Get the details form.
$this
->clickLink($this->flag
->getShortText('unflag'));
$node_url = Url::fromRoute('entity.node.canonical', [
'node' => $this->nodeId,
]);
$this
->assertUrl('flag/details/edit/' . $flag_id . '/' . $this->nodeId, [
'query' => [
'destination' => $node_url
->toString(),
],
]);
// See if the details message is displayed.
$this
->assertText($this->flagDetailsMessage);
// See if the field value was preserved.
$this
->assertFieldByName('field_' . $this->flagFieldId . '[0][value]', $this->flagFieldValue);
// Update the field value.
$this->flagFieldValue = $this
->randomString();
$edit = [
'field_' . $this->flagFieldId . '[0][value]' => $this->flagFieldValue,
];
$this
->drupalPostForm(NULL, $edit, $this->updateButtonText);
// Get the details form.
$this
->drupalGet('flag/details/edit/' . $flag_id . '/' . $this->nodeId);
// See if the field value was preserved.
$this
->assertFieldByName('field_' . $this->flagFieldId . '[0][value]', $this->flagFieldValue);
}