PMCORE-2195 Migrate to queue job - Cron File: sendnotificationscron.php

This commit is contained in:
Roly Rudy Gutierrez Pinto
2020-09-28 11:06:26 -04:00
committed by Julio Cesar Laura Avendaño
parent 0020d75ca3
commit 5bee4352b5
3 changed files with 87 additions and 50 deletions

View File

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