public function QueueEmptyFormTest::testConfirm in Purge 8.3
Tests that the confirm button clears the queue.
See also
\Drupal\purge_ui\Form\QueuerDeleteForm::buildForm
\Drupal\purge_ui\Form\CloseDialogTrait::closeDialog
File
- modules/
purge_ui/ tests/ src/ Functional/ Form/ QueueEmptyFormTest.php, line 86
Class
Namespace
Drupal\Tests\purge_ui\Functional\FormCode
public function testConfirm() : void {
// Add seven objects to the queue and assert that these get deleted.
$this
->initializeQueueService('file');
$this->purgeQueue
->add($this->queuer, $this
->getInvalidations(7, 'tag', 'test'));
// Assert that - after reloading/committing the queue - we still have these.
$this->purgeQueue
->reload();
$this
->assertSame(7, $this->purgeQueue
->numberOfItems());
// Call the confirm form and assert the AJAX responses.
$this
->drupalLogin($this->adminUser);
$this
->drupalGet($this
->getPath());
$ajax = $this
->postAjaxForm([], 'Yes, throw everything away!');
$this
->assertAjaxCommandCloseModalDialog($ajax);
$this
->assertAjaxCommandsTotal($ajax, 1);
$this
->assertSame(0, $this->purgeQueue
->numberOfItems());
}