class BatchExampleWebTest

Same name in other branches
  1. 3.x modules/batch_example/tests/src/Functional/BatchExampleWebTest.php \Drupal\Tests\batch_example\Functional\BatchExampleWebTest
  2. 4.0.x modules/batch_example/tests/src/Functional/BatchExampleWebTest.php \Drupal\Tests\batch_example\Functional\BatchExampleWebTest

Functional tests for the Batch Example module.

@group batch_example

Hierarchy

  • class \Drupal\Tests\batch_example\Functional\BatchExampleWebTest extends \Drupal\Tests\BrowserTestBase

Expanded class hierarchy of BatchExampleWebTest

Related topics

File

batch_example/tests/src/Functional/BatchExampleWebTest.php, line 14

Namespace

Drupal\Tests\batch_example\Functional
View source
class BatchExampleWebTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    public static $modules = [
        'node',
        'batch_example',
    ];
    
    /**
     * Login user and test both batch examples.
     */
    public function testBatchExampleBasic() {
        // Login the admin user.
        $web_user = $this->drupalCreateUser([
            'access content',
        ]);
        $this->drupalLogin($web_user);
        // Launch Batch 1.
        $this->drupalPostForm('examples/batch_example', [
            'batch' => 'batch_1',
        ], 'Go');
        // Check that 1000 operations were performed.
        $this->assertText('1000 results processed');
        // Launch Batch 2.
        $this->drupalPostForm('examples/batch_example', [
            'batch' => 'batch_2',
        ], 'Go');
        // Check that 600 operations were performed.
        $this->assertText('600 results processed');
    }

}

Members

Title Sort descending Modifiers Object type Summary
BatchExampleWebTest::$defaultTheme protected property
BatchExampleWebTest::$modules public static property
BatchExampleWebTest::testBatchExampleBasic public function Login user and test both batch examples.