You are here

public function PurgerDeleteFormTest::testDeletePurger in Purge 8.3

Tests that 'Yes, delete..', deletes the purger and closes the window.

See also

\Drupal\purge_ui\Form\PurgerDeleteForm::buildForm

\Drupal\purge_ui\Form\CloseDialogTrait::deletePurger

File

modules/purge_ui/tests/src/Functional/Form/PurgerDeleteFormTest.php, line 77

Class

PurgerDeleteFormTest
Tests \Drupal\purge_ui\Form\PurgerDeleteForm.

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

public function testDeletePurger() : void {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet($this
    ->getPath());
  $this
    ->assertSession()
    ->responseContains('Yes, delete this purger!');
  $this
    ->assertSame([
    'id0' => 'a',
  ], $this->purgePurgers
    ->getPluginsEnabled());
  $ajax = $this
    ->postAjaxForm([], 'Yes, delete this purger!');
  $this
    ->assertAjaxCommandReloadConfigForm($ajax);
  $this
    ->assertAjaxCommandCloseModalDialog($ajax);
  $this
    ->assertAjaxCommandsTotal($ajax, 2);
  $this->purgePurgers
    ->reload();
  $this
    ->assertSame(TRUE, is_array($this->purgePurgers
    ->getPluginsEnabled()));
  $this
    ->assertEmpty($this->purgePurgers
    ->getPluginsEnabled());
}