PMCORE-2188 Migrate to queue job - Cron File: cron.php - Activity: report_by_user

This commit is contained in:
Roly Rudy Gutierrez Pinto
2020-09-24 20:11:36 -04:00
committed by Julio Cesar Laura Avendaño
parent ebfd16fea1
commit 76f678ce80
3 changed files with 73 additions and 31 deletions

View File

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