public function QueueChangeFormTest::testChangeFormSubmit in Purge 8.3
Tests that changing the form works as expected.
File
- modules/
purge_ui/ tests/ src/ Functional/ Form/ QueueChangeFormTest.php, line 57
Class
Namespace
Drupal\Tests\purge_ui\Functional\FormCode
public function testChangeFormSubmit() : void {
$this
->drupalLogin($this->adminUser);
// We're avoiding the use of postAjaxForm() in this instance, as else we're
// mysteriously logged out of Drupal.
$form = $this
->formInstance()
->buildForm([], $this
->getFormStateInstance());
$submitted = $this
->getFormStateInstance();
$submitted
->setValue('plugin_id', 'b');
$ajax = $this
->formInstance()
->changeQueue($form, $submitted);
$this
->assertAjaxCommandReloadConfigForm($ajax);
$this
->assertAjaxCommandCloseModalDialog($ajax);
$this
->assertAjaxCommandsTotal($ajax, 2);
$this
->drupalGet($this
->getPath());
$this
->assertSession()
->responseContains('Change queue engine');
$this
->assertSession()
->checkboxChecked('edit-plugin-id-b');
// Here we can use postAjaxForm: assert that cancellation works.
$ajax = $this
->postAjaxForm([], 'Cancel');
$this
->assertAjaxCommandCloseModalDialog($ajax);
$this
->assertAjaxCommandsTotal($ajax, 1);
}