function BatchExampleTestCase::testBatchExampleBasic

Login user, create 30 nodes and test both batch examples.

File

batch_example/batch_example.test, line 41

Class

BatchExampleTestCase
Functional tests for the Batch Example module.

Code

public function testBatchExampleBasic() {
  // Login the admin user.
  $this->drupalLogin($this->webUser);
  // Create 30 nodes.
  for ($count = 0; $count < 30; $count++) {
    $node = $this->drupalCreateNode();
  }
  // Launch Batch 1
  $result = $this->drupalPost('examples/batch_example', array(
    'batch' => 'batch_1',
  ), t('Go'));
  // Check that 1000 operations were performed.
  $this->assertText('1000 results processed');
  // Launch Batch 2
  $result = $this->drupalPost('examples/batch_example', array(
    'batch' => 'batch_2',
  ), t('Go'));
  // Check that 600 operations were performed.
  $this->assertText('600 results processed');
}