mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 08:41:39 +09:00
Fix queue config interfering with unit tests
This commit is contained in:
parent
eebd9a0005
commit
746afdacb3
3 changed files with 40 additions and 8 deletions
|
|
@ -2,6 +2,19 @@
|
|||
|
||||
class MailTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected $_prev_queue_config;
|
||||
|
||||
public function _before()
|
||||
{
|
||||
$this->_prev_queue_config = config('queue');
|
||||
config('queue.enabled', false);
|
||||
}
|
||||
|
||||
public function _after()
|
||||
{
|
||||
config('queue', $this->_prev_queue_config);
|
||||
}
|
||||
|
||||
public function testGetSetDefaultDriver()
|
||||
{
|
||||
$driver = Rhymix\Framework\Mail::getDefaultDriver();
|
||||
|
|
|
|||
|
|
@ -2,10 +2,22 @@
|
|||
|
||||
class QueueTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected $_prev_queue_config;
|
||||
|
||||
public function _before()
|
||||
{
|
||||
$this->_prev_queue_config = config('queue');
|
||||
config('queue.enabled', true);
|
||||
config('queue.driver', 'dummy');
|
||||
}
|
||||
|
||||
public function _after()
|
||||
{
|
||||
config('queue', $this->_prev_queue_config);
|
||||
}
|
||||
|
||||
public function testDummyQueue()
|
||||
{
|
||||
config('queue.driver', 'dummy');
|
||||
|
||||
$handler = 'myfunc';
|
||||
$args = (object)['foo' => 'bar'];
|
||||
$options = (object)['key' => 'val'];
|
||||
|
|
@ -23,9 +35,6 @@ class QueueTest extends \Codeception\Test\Unit
|
|||
|
||||
public function testScheduledTaskAt()
|
||||
{
|
||||
config('queue.enabled', true);
|
||||
config('queue.driver', 'dummy');
|
||||
|
||||
$timestamp = time() + 43200;
|
||||
$handler = 'MyClass::myFunc';
|
||||
$args = (object)['foo' => 'bar'];
|
||||
|
|
@ -48,9 +57,6 @@ class QueueTest extends \Codeception\Test\Unit
|
|||
|
||||
public function testScheduledTaskAtInterval()
|
||||
{
|
||||
config('queue.enabled', true);
|
||||
config('queue.driver', 'db');
|
||||
|
||||
$interval = '30 9 1-15 */2 *';
|
||||
$handler = 'MyClass::getInstance()->myMethod';
|
||||
$args = (object)['foo' => 'bar'];
|
||||
|
|
|
|||
|
|
@ -2,6 +2,19 @@
|
|||
|
||||
class SMSTest extends \Codeception\Test\Unit
|
||||
{
|
||||
protected $_prev_queue_config;
|
||||
|
||||
public function _before()
|
||||
{
|
||||
$this->_prev_queue_config = config('queue');
|
||||
config('queue.enabled', false);
|
||||
}
|
||||
|
||||
public function _after()
|
||||
{
|
||||
config('queue', $this->_prev_queue_config);
|
||||
}
|
||||
|
||||
public function testGetSetDefaultDriver()
|
||||
{
|
||||
$driver = Rhymix\Framework\SMS::getDefaultDriver();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue