Skip to content

Commit

Permalink
MDL-50664 mod_data: Fix for unit test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Sep 23, 2015
1 parent 201a26b commit be09ca8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mod/data/tests/lib_test.php
Expand Up @@ -270,18 +270,20 @@ public function test_data_user_can_manage_entry_return_false_readonly() {
$roleid = $testdata['roleid'];
$context = $testdata['context'];
$record = $testdata['record'];
$data = new stdClass();
// Causes readonly mode to be enable.
$now = time();
$data->timeviewfrom = $now;
$data->timeviewto = $now;

$this->setUser($user);

// Need to make sure they don't have this capability in order to fall back to
// the other checks.
assign_capability('mod/data:manageentries', CAP_PROHIBIT, $roleid, $context);

// Causes readonly mode to be enabled.
$data = new stdClass();
$now = time();
// Add a small margin around the periods to prevent errors with slow tests.
$data->timeviewfrom = $now - 1;
$data->timeviewto = $now + 5;

$this->assertFalse(data_user_can_manage_entry($record, $data, $context),
'data_user_can_manage_entry() returns false if the data is read only');
}
Expand Down

0 comments on commit be09ca8

Please sign in to comment.