Test case for Testing the batch example module.
This file contains the test cases to check if module is performing as expected.
<?php /** * @file * Test case for Testing the batch example module. * * This file contains the test cases to check if module is performing as * expected. */ /** * Functional tests for the Batch Example module. * * @ingroup batch_example */ class BatchExampleTestCase extends BackdropWebTestCase { protected $webUser; /** * Enable modules and create user with specific permissions. */ public function setUp() { parent::setUp('batch_example'); // Create user. $this->webUser = $this->backdropCreateUser(); // Delete the existing default content. node_delete_multiple(array(1, 2)); } /** * Login user, create 30 nodes and test both batch examples. */ public function testBatchExampleBasic() { // Login the admin user. $this->backdropLogin($this->webUser); // Create 30 nodes. for ($count = 0; $count < 30; $count++) { $node = $this->backdropCreateNode(); } // Launch Batch 1 $result = $this->backdropPost('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->backdropPost('examples/batch_example', array('batch' => 'batch_2'), t('Go')); // Check that 600 operations were performed. $this->assertText('600 results processed'); } }