Skip to content

Commit

Permalink
MDL-53937 core_competency: False negative with duedate on plan reopen
Browse files Browse the repository at this point in the history
  • Loading branch information
FMCorz authored and danpoltawski committed Apr 29, 2016
1 parent f6ab2b8 commit 42c28b0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions competency/tests/plan_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,16 +429,17 @@ public function test_validate_duedate() {
// Reopening plan: with due date in the future => duedate unchanged.
$record = $plan->to_record();
$record->status = plan::STATUS_COMPLETE;
$record->duedate = time() + plan::DUEDATE_THRESHOLD + 10;
$duedate = time() + plan::DUEDATE_THRESHOLD + 10;
$record->duedate = $duedate;
$DB->update_record(plan::TABLE, $record);

$success = core_competency\api::reopen_plan($plan->get_id());
$this->assertTrue($success);
$plan->read();

// Check that the due date has not changed, but allow for PHP Unit latency.
$this->assertTrue($plan->get_duedate() >= time() + plan::DUEDATE_THRESHOLD + 10);
$this->assertTrue($plan->get_duedate() <= time() + plan::DUEDATE_THRESHOLD + 15);
// Check that the due date has not changed.
$this->assertNotEquals(0, $plan->get_duedate());
$this->assertEquals($duedate, $plan->get_duedate());
}

public function test_get_by_user_and_competency() {
Expand Down

0 comments on commit 42c28b0

Please sign in to comment.