Migrate method findCompletedByType() to Doctrine

[MAILPOET-2996]
This commit is contained in:
Rodrigo Primo
2021-09-28 15:26:40 -03:00
committed by Veljko V
parent 709b4d8fcd
commit e69a3f9a53
8 changed files with 20 additions and 54 deletions

View File

@@ -181,40 +181,6 @@ class ScheduledTaskTest extends \MailPoetTest {
expect($timeout)->equals(ScheduledTask::MAX_RESCHEDULE_TIMEOUT);
}
public function testItCanGetCompletedTasks() {
// completed (scheduled in past)
ScheduledTask::createOrUpdate([
'type' => 'test',
'status' => ScheduledTask::STATUS_COMPLETED,
'scheduled_at' => Carbon::now()->subDay(),
]);
// deleted (should not be fetched)
ScheduledTask::createOrUpdate([
'type' => 'test',
'status' => ScheduledTask::STATUS_COMPLETED,
'scheduled_at' => Carbon::now()->subDay(),
'deleted_at' => Carbon::now(),
]);
// scheduled in future (should not be fetched)
ScheduledTask::createOrUpdate([
'type' => 'test',
'status' => ScheduledTask::STATUS_COMPLETED,
'scheduled_at' => Carbon::now()->addDay(),
]);
// wrong status (should not be fetched)
ScheduledTask::createOrUpdate([
'type' => 'test',
'status' => ScheduledTask::STATUS_SCHEDULED,
'scheduled_at' => Carbon::now()->subDay(),
]);
$tasks = ScheduledTask::findCompletedByType('test', 10);
expect($tasks)->count(1);
}
public function testItCanGetFutureScheduledTasks() {
// scheduled (in future)
ScheduledTask::createOrUpdate([