PMCORE-2196 Migrate to queue job - Cron File: actionsByEmailEmailResponse.php
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
parent
5bee4352b5
commit
f44f3ae565
@@ -424,4 +424,32 @@ class TaskTest extends TestCase
|
||||
Queue::assertPushed(TaskScheduler::class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This test verify the actionsByEmailResponse activity method for synchronous and asynchronous execution.
|
||||
* @test
|
||||
* @covers ProcessMaker\TaskScheduler\Task::runTask()
|
||||
* @covers ProcessMaker\TaskScheduler\Task::actionsByEmailResponse()
|
||||
* @dataProvider asynchronousCases
|
||||
*/
|
||||
public function it_should_test_actionsByEmailResponse_method($asynchronous)
|
||||
{
|
||||
$task = new Task($asynchronous, '');
|
||||
|
||||
//assert synchronous for cron file
|
||||
if ($asynchronous === false) {
|
||||
ob_start();
|
||||
$task->actionsByEmailResponse();
|
||||
$printing = ob_get_clean();
|
||||
$this->assertEmpty($printing);
|
||||
}
|
||||
|
||||
//assert asynchronous for job process
|
||||
if ($asynchronous === true) {
|
||||
Queue::fake();
|
||||
Queue::assertNothingPushed();
|
||||
$task->actionsByEmailResponse();
|
||||
Queue::assertPushed(TaskScheduler::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
*/
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\BusinessModel\ActionsByEmail\ResponseReader;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
use ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
require_once __DIR__ . '/../../../gulliver/system/class.g.php';
|
||||
@@ -351,7 +348,8 @@ try {
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'actionsByEmailEmailResponse':
|
||||
(new ResponseReader)->actionsByEmailEmailResponse();
|
||||
$task = new Task($asynchronous, $sObject);
|
||||
$task->actionsByEmailResponse();
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class ResponseReader
|
||||
try {
|
||||
if (!extension_loaded('imap')) {
|
||||
G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", ['php_imap']) . "\n");
|
||||
exit;
|
||||
return;
|
||||
}
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
|
||||
@@ -17,6 +17,7 @@ use G;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ldapadvancedClassCron;
|
||||
use NotificationQueue;
|
||||
use ProcessMaker\BusinessModel\ActionsByEmail\ResponseReader;
|
||||
use ProcessMaker\BusinessModel\Light\PushMessageAndroid;
|
||||
use ProcessMaker\BusinessModel\Light\PushMessageIOS;
|
||||
use ProcessMaker\Core\JobsManager;
|
||||
@@ -543,4 +544,16 @@ class Task
|
||||
};
|
||||
$this->runTask($job);
|
||||
}
|
||||
|
||||
/**
|
||||
* This executes an actions by email responses.
|
||||
*/
|
||||
public function actionsByEmailResponse()
|
||||
{
|
||||
$job = function() {
|
||||
$responseReader = new ResponseReader();
|
||||
$responseReader->actionsByEmailEmailResponse();
|
||||
};
|
||||
$this->runTask($job);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user