mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +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
|
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()
|
public function testGetSetDefaultDriver()
|
||||||
{
|
{
|
||||||
$driver = Rhymix\Framework\Mail::getDefaultDriver();
|
$driver = Rhymix\Framework\Mail::getDefaultDriver();
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,22 @@
|
||||||
|
|
||||||
class QueueTest extends \Codeception\Test\Unit
|
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()
|
public function testDummyQueue()
|
||||||
{
|
{
|
||||||
config('queue.driver', 'dummy');
|
|
||||||
|
|
||||||
$handler = 'myfunc';
|
$handler = 'myfunc';
|
||||||
$args = (object)['foo' => 'bar'];
|
$args = (object)['foo' => 'bar'];
|
||||||
$options = (object)['key' => 'val'];
|
$options = (object)['key' => 'val'];
|
||||||
|
|
@ -23,9 +35,6 @@ class QueueTest extends \Codeception\Test\Unit
|
||||||
|
|
||||||
public function testScheduledTaskAt()
|
public function testScheduledTaskAt()
|
||||||
{
|
{
|
||||||
config('queue.enabled', true);
|
|
||||||
config('queue.driver', 'dummy');
|
|
||||||
|
|
||||||
$timestamp = time() + 43200;
|
$timestamp = time() + 43200;
|
||||||
$handler = 'MyClass::myFunc';
|
$handler = 'MyClass::myFunc';
|
||||||
$args = (object)['foo' => 'bar'];
|
$args = (object)['foo' => 'bar'];
|
||||||
|
|
@ -48,9 +57,6 @@ class QueueTest extends \Codeception\Test\Unit
|
||||||
|
|
||||||
public function testScheduledTaskAtInterval()
|
public function testScheduledTaskAtInterval()
|
||||||
{
|
{
|
||||||
config('queue.enabled', true);
|
|
||||||
config('queue.driver', 'db');
|
|
||||||
|
|
||||||
$interval = '30 9 1-15 */2 *';
|
$interval = '30 9 1-15 */2 *';
|
||||||
$handler = 'MyClass::getInstance()->myMethod';
|
$handler = 'MyClass::getInstance()->myMethod';
|
||||||
$args = (object)['foo' => 'bar'];
|
$args = (object)['foo' => 'bar'];
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,19 @@
|
||||||
|
|
||||||
class SMSTest extends \Codeception\Test\Unit
|
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()
|
public function testGetSetDefaultDriver()
|
||||||
{
|
{
|
||||||
$driver = Rhymix\Framework\SMS::getDefaultDriver();
|
$driver = Rhymix\Framework\SMS::getDefaultDriver();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue