BatchExampleWebTest.php in Examples for Developers 8
File
batch_example/tests/src/Functional/BatchExampleWebTest.php
View source
<?php
namespace Drupal\Tests\batch_example\Functional;
use Drupal\Tests\BrowserTestBase;
class BatchExampleWebTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
public static $modules = [
'node',
'batch_example',
];
public function testBatchExampleBasic() {
$web_user = $this
->drupalCreateUser([
'access content',
]);
$this
->drupalLogin($web_user);
$this
->drupalPostForm('examples/batch_example', [
'batch' => 'batch_1',
], 'Go');
$this
->assertText('1000 results processed');
$this
->drupalPostForm('examples/batch_example', [
'batch' => 'batch_2',
], 'Go');
$this
->assertText('600 results processed');
}
}