You are here

public function AdminUITest::doFlagDelete in Flag 8.4

Delete the flag.

1 call to AdminUITest::doFlagDelete()
AdminUITest::testFlagAdmin in tests/src/Functional/AdminUITest.php
Test basic flag admin.

File

tests/src/Functional/AdminUITest.php, line 241

Class

AdminUITest
Tests the Flag admin UI.

Namespace

Drupal\Tests\flag\Functional

Code

public function doFlagDelete() {

  // Flag node.
  $this
    ->drupalGet('node/' . $this->nodeId);
  $this
    ->assertLink($this->flagShortText);

  // Go to the delete form for the flag.
  $this
    ->drupalGet('admin/structure/flags/manage/' . $this->flag
    ->id() . '/delete');
  $this
    ->assertText($this
    ->t('Are you sure you want to delete the flag @this_label?', [
    '@this_label' => $this->label,
  ]));
  $this
    ->drupalPostForm(NULL, [], $this
    ->t('Delete'));

  // Check the flag has been deleted.
  $result = $this->flagService
    ->getFlagById($this->flagId);
  $this
    ->assertNull($result, 'The flag was deleted.');
  $this
    ->drupalGet('node/' . $this->nodeId);
  $this
    ->assertText($this->node
    ->label());
  $this
    ->assertNoLink($this->flagShortText);
}