mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 11:11:39 +09:00
Add basic unit tests for Queue class using Dummy driver
This commit is contained in:
parent
b4e7d4aaad
commit
4b0b485a13
2 changed files with 36 additions and 1 deletions
|
|
@ -9,6 +9,11 @@ use Rhymix\Framework\Drivers\QueueInterface;
|
|||
*/
|
||||
class Dummy implements QueueInterface
|
||||
{
|
||||
/**
|
||||
* Dummy queue for testing.
|
||||
*/
|
||||
protected $_dummy_queue;
|
||||
|
||||
/**
|
||||
* Create a new instance of the current Queue driver, using the given settings.
|
||||
*
|
||||
|
|
@ -80,6 +85,11 @@ class Dummy implements QueueInterface
|
|||
*/
|
||||
public function addTask(string $handler, ?object $args = null, ?object $options = null): int
|
||||
{
|
||||
$this->_dummy_queue = (object)[
|
||||
'handler' => $handler,
|
||||
'args' => $args,
|
||||
'options' => $options,
|
||||
];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -91,6 +101,8 @@ class Dummy implements QueueInterface
|
|||
*/
|
||||
public function getTask(int $blocking = 0): ?object
|
||||
{
|
||||
return null;
|
||||
$result = $this->_dummy_queue;
|
||||
$this->_dummy_queue = null;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue