- <?php
-
- * @file
- * Test the queue example module.
- */
-
- * Functional tests for the Queue Example module.
- *
- * @ingroup queue_example
- */
- class QueueExampleTestCase extends BackdropWebTestCase {
-
-
- * Enable modules and create user with specific permissions.
- */
- public function setUp() {
- parent::setUp('queue_example');
- }
-
-
- * Test the queue behavior through user interaction.
- */
- public function testQueueExampleBasic() {
-
-
- for ($i = 1; $i <= 5; $i++) {
- $edit = array('queue_name' => 'queue_example_first_queue', 'string_to_add' => "boogie$i");
- $this->backdropPost('queue_example/insert_remove', $edit, t('Insert into queue'));
- $this->assertText(t('There are now @number items in the queue', array('@number' => $i)));
- }
-
- for ($i = 1; $i <= 5; $i++) {
- $edit = array('queue_name' => 'queue_example_first_queue', 'claim_time' => 0);
- $this->backdropPost(NULL, $edit, t('Claim the next item from the queue'));
- $this->assertPattern(t('%Claimed item id=.*string=@string for 0 seconds.%', array('@string' => "boogie$i")));
- }
- $edit = array('queue_name' => 'queue_example_first_queue', 'claim_time' => 0);
- $this->backdropPost(NULL, $edit, t('Claim the next item from the queue'));
- $this->assertText(t('There were no items in the queue available to claim'));
-
-
-
-
- sleep(1);
-
-
- $this->backdropPost(NULL, array(), t('Run cron manually to expire claims'));
-
- $queue_items = queue_example_retrieve_queue('queue_example_first_queue');
-
-
- for ($i = 1; $i <= 5; $i++) {
- $edit = array('queue_name' => 'queue_example_first_queue', 'claim_time' => 0);
- $this->backdropPost(NULL, $edit, t('Claim the next item and delete it'));
- $this->assertPattern(t('%Claimed and deleted item id=.*string=@string for 0 seconds.%', array('@string' => "boogie$i")));
- }
-
- $edit = array('queue_name' => 'queue_example_first_queue', 'claim_time' => 0);
- $this->backdropPost(NULL, $edit, t('Claim the next item from the queue'));
- $this->assertText(t('There were no items in the queue available to claim'));
- }
- }