function ProcessingTest::testBatchUrls

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/FunctionalJavascript/Batch/ProcessingTest.php \Drupal\Tests\system\FunctionalJavascript\Batch\ProcessingTest::testBatchUrls()

Tests that JS batches replace the op in the URL and do not add to it.

File

core/modules/system/tests/src/FunctionalJavascript/Batch/ProcessingTest.php, line 45

Class

ProcessingTest
Tests Processing.

Namespace

Drupal\Tests\system\FunctionalJavascript\Batch

Code

public function testBatchUrls() : void {
  $edit = [
    'batch' => 'batch9',
  ];
  $this->drupalGet('batch-test');
  $this->submitForm($edit, 'Submit');
  $this->assertSession()
    ->waitForElementVisible('css', '.batch-urls');
  $batch_url_list = $this->assertSession()
    ->elementExists('css', '.batch-urls');
  $batch_url_list_items = $batch_url_list->findAll('css', 'li');
  $this->assertCount(5, $batch_url_list_items);
  foreach ($batch_url_list_items as $batch_url_list_item) {
    $this->assertStringEndsWith('/batch?_format=json&id=1&op=do', $batch_url_list_item->getText());
  }
  $batch_finished_url = $this->assertSession()
    ->elementExists('css', '.batch-finished-url');
  $this->assertStringEndsWith('/batch?id=1&op=finished', $batch_finished_url->getText());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.