Skip to content

drupaltest/queue-runner-trait

Repository files navigation

Queue Runner Trait

Provides a trait for use with the Drupal Test Traits library.

Build Status

Installation

composer require --dev drupaltest/queue-runner-trait

Usage

class SampleTestWithQueueRunner extends ExistingSiteBase
{
    use QueueRunnerTrait;

    protected function tearDown()
    {
        // Empty a given queue after the test has finished.
        $this->clearQueue('my_queue_name');
    }

    public function testSomeQueue()
    {
        // Do something that adds an item to a queue.
        
        // Run the queue by name.
        $this->runQueue('my_queue_name');
    }
}

See the included test for a detailed example.