function BatchExampleWebTest::testBatchExampleBasic
Same name in other branches
- 3.x modules/batch_example/tests/src/Functional/BatchExampleWebTest.php \Drupal\Tests\batch_example\Functional\BatchExampleWebTest::testBatchExampleBasic()
Login user and test both batch examples.
File
-
modules/
batch_example/ tests/ src/ Functional/ BatchExampleWebTest.php, line 29
Class
- BatchExampleWebTest
- Functional tests for the Batch Example module.
Namespace
Drupal\Tests\batch_example\FunctionalCode
public function testBatchExampleBasic() {
// Login the admin user.
$web_user = $this->drupalCreateUser([
'access content',
]);
$this->drupalLogin($web_user);
// Launch Batch 1.
$this->drupalGet('examples/batch_example');
$this->submitForm([
'batch' => 'batch_1',
], 'Go');
// Check that 1000 operations were performed.
$this->assertSession()
->pageTextContains('1000 results processed');
// Launch Batch 2.
$this->drupalGet('examples/batch_example');
$this->submitForm([
'batch' => 'batch_2',
], 'Go');
// Check that 600 operations were performed.
$this->assertSession()
->pageTextContains('600 results processed');
}