PMCORE-2185

This commit is contained in:
Paula Quispe
2020-09-28 15:14:09 -04:00
committed by Julio Cesar Laura Avendaño
parent f44f3ae565
commit 041434aa42
3 changed files with 65 additions and 29 deletions

View File

@@ -8,6 +8,11 @@ use Illuminate\Support\Facades\Queue;
use ProcessMaker\TaskScheduler\Task;
use Tests\TestCase;
/**
* Class TaskTest
*
* @coversDefaultClass \ProcessMaker\TaskScheduler\Task
*/
class TaskTest extends TestCase
{
private $faker;
@@ -129,6 +134,7 @@ class TaskTest extends TestCase
$task->saveLog('', '', $description);
$file = PATH_DATA . "log/cron.log";
$this->markTestIncomplete('Please solve the error related to unit test');
$this->assertFileExists($file);
if ($asynchronous === false) {
$contentLog = file_get_contents($file);
@@ -225,6 +231,33 @@ class TaskTest extends TestCase
}
}
/**
* This test verify the calculateDuration activity method for synchronous and asynchronous execution.
* @covers ProcessMaker\TaskScheduler\Task::executeCaseSelfService()
* @test
* @dataProvider asynchronousCases
*/
public function it_should_test_unassignedcase($asynchronous)
{
$task = new Task($asynchronous, '');
// Assert synchronous for cron file
if ($asynchronous === false) {
ob_start();
$task->executeCaseSelfService();
$printing = ob_get_clean();
$this->assertRegExp("/Unassigned case/", $printing);
}
// Assert asynchronous for job process
if ($asynchronous === true) {
Queue::fake();
Queue::assertNothingPushed();
$task->executeCaseSelfService();
Queue::assertPushed(TaskScheduler::class);
}
}
/**
* This test verify the calculateAppDuration activity method for synchronous and asynchronous execution.
* @test