You are here

public function ProcessorDeleteFormTest::testDeleteProcessor in Purge 8.3

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

See also

\Drupal\purge_ui\Form\ProcessorDeleteForm::buildForm

\Drupal\purge_ui\Form\CloseDialogTrait::disableProcessor

File

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

Class

ProcessorDeleteFormTest
Tests \Drupal\purge_ui\Form\ProcessorDeleteForm.

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

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