- <?php
- * @file
- * Test case for testing the cron example module.
- */
-
- * cron_example test class
- *
- * @ingroup cron_example
- */
- class CronExampleTestCase extends BackdropWebTestCase {
- protected $webUser;
-
-
- * Enable modules and create user with specific permissions.
- */
- public function setUp() {
- parent::setUp('cron_example');
-
-
- $this->webUser = $this->backdropCreateUser(array('administer site configuration'));
- $this->backdropLogin($this->webUser);
- }
-
-
- * Test running cron through the user interface.
- */
- public function testCronExampleBasic() {
-
-
- config_set('cron_example.settings', 'cron_example_next_execution', 0);
- $this->backdropGet('examples/cron_example');
-
-
- $post = array();
- $this->backdropPost('examples/cron_example', $post, t('Run cron now'));
- $this->assertText(t('cron_example executed at'));
-
-
- $post['cron_reset'] = TRUE;
- $this->backdropPost(NULL, $post, t('Run cron now'));
- $this->assertText(t('cron_example executed at'));
-
-
- $post['cron_reset'] = FALSE;
- $this->backdropPost(NULL, $post, t('Run cron now'));
- $this->assertNoText(t('cron_example executed at'));
-
- $this->assertText(t('There are currently 0 items in queue 1 and 0 items in queue 2'));
- $post = array(
- 'num_items' => 5,
- 'queue' => 'cron_example_queue_1',
- );
- $this->backdropPost(NULL, $post, t('Add jobs to queue'));
- $this->assertText('There are currently 5 items in queue 1 and 0 items in queue 2');
- $post = array(
- 'num_items' => 100,
- 'queue' => 'cron_example_queue_2',
- );
- $this->backdropPost(NULL, $post, t('Add jobs to queue'));
- $this->assertText('There are currently 5 items in queue 1 and 100 items in queue 2');
-
- $post = array();
- $this->backdropPost('examples/cron_example', $post, t('Run cron now'));
- $this->assertPattern('/Queue 1 worker processed item with sequence 5 /');
- $this->assertPattern('/Queue 2 worker processed item with sequence 100 /');
- }
- }
-
- * @} End of "addtogroup cron_example".
- */