You are here

public function PurgerMoveFormUpTest::testMoveUp in Purge 8.3

Tests that 'Yes!', moves the purger in order 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/PurgerMoveFormUpTest.php, line 83

Class

PurgerMoveFormUpTest
Tests \Drupal\purge_ui\Form\PurgerMoveForm.

Namespace

Drupal\Tests\purge_ui\Functional

Code

public function testMoveUp() : void {
  $this
    ->drupalLogin($this->adminUser);

  // Test that the initial order of the purgers is exactly as configured.
  $this
    ->assertEquals([
    'a',
    'b',
    'c',
  ], array_values($this->purgePurgers
    ->getPluginsEnabled()));

  // Test the form submission and redirect/close commands.
  $this
    ->drupalGet($this
    ->getPath());
  $this
    ->assertSession()
    ->responseContains($this->routeTitle);
  $ajax = $this
    ->postAjaxForm([], 'Yes!');
  $this
    ->assertAjaxCommandCloseModalDialog($ajax);
  $this
    ->assertAjaxCommandReloadConfigForm($ajax);
  $this->purgePurgers
    ->reload();
  $this
    ->assertEquals([
    'a',
    'c',
    'b',
  ], array_values($this->purgePurgers
    ->getPluginsEnabled()));
}