PMCORE-2187 Migrate to queue job - Cron File: cron.php - Activity: plugins

This commit is contained in:
Roly Rudy Gutierrez Pinto
2020-09-24 19:49:32 -04:00
committed by Julio Cesar Laura Avendaño
parent a073b65e08
commit ebfd16fea1
3 changed files with 115 additions and 76 deletions

View File

@@ -280,4 +280,32 @@ class TaskTest extends TestCase
Queue::assertPushed(TaskScheduler::class);
}
}
/**
* This test verify the executePlugins activity method for synchronous and asynchronous execution.
* @test
* @covers ProcessMaker\TaskScheduler\Task::runTask()
* @covers ProcessMaker\TaskScheduler\Task::executePlugins()
* @dataProvider asynchronousCases
*/
public function it_should_test_executePlugins_method($asynchronous)
{
$task = new Task($asynchronous, '');
//assert synchronous for cron file
if ($asynchronous === false) {
ob_start();
$task->executePlugins();
$printing = ob_get_clean();
$this->assertRegExp("/plugins/", $printing);
}
//assert asynchronous for job process
if ($asynchronous === true) {
Queue::fake();
Queue::assertNothingPushed();
$task->executePlugins();
Queue::assertPushed(TaskScheduler::class);
}
}
}