PHP code example of drupaltest / queue-runner-trait

1. Go to this page and download the library: Download drupaltest/queue-runner-trait library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drupaltest / queue-runner-trait example snippets


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');
    }
}