You are here

protected function AjaxFormTestBase::assertAjaxCommandsTotal in Purge 8.3

Assert that a \Drupal\Core\Ajax\CloseModalDialogCommand is issued.

Parameters

\Drupal\Core\Ajax\AjaxResponse $ajax: The undecoded AjaxResponse object returned by the http_kernel.

int $expected: The total number of expected commands.

24 calls to AjaxFormTestBase::assertAjaxCommandsTotal()
PluginConfigFormTestBase::testCancelSubmit in modules/purge_ui/tests/src/Functional/Form/Config/PluginConfigFormTestBase.php
Tests cancel button form submit.
ProcessorAddFormTest::testAddSubmit in modules/purge_ui/tests/src/Functional/Form/ProcessorAddFormTest.php
Tests form submission results in the redirect command.
ProcessorAddFormTest::testCancelSubmit in modules/purge_ui/tests/src/Functional/Form/ProcessorAddFormTest.php
Tests that the cancel button closes the dialog.
ProcessorDeleteFormTest::testDeleteProcessor in modules/purge_ui/tests/src/Functional/Form/ProcessorDeleteFormTest.php
Tests that 'Yes, delete..', deletes the processor and closes the window.
ProcessorDeleteFormTest::testNoSubmit in modules/purge_ui/tests/src/Functional/Form/ProcessorDeleteFormTest.php
Tests "No" cancel button form submit.

... See full list

File

modules/purge_ui/tests/src/Functional/Form/AjaxFormTestBase.php, line 58

Class

AjaxFormTestBase
Testbase for Ajax-based purge_ui forms.

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

protected function assertAjaxCommandsTotal(AjaxResponse $ajax, int $expected) : void {
  $commands = $ajax
    ->getCommands();
  $this
    ->assertSame($expected, count($commands), var_export($commands, TRUE));
}