MDL-50664 mod_data: Fix for unit test failure
This commit is contained in:
@@ -270,11 +270,6 @@ class mod_data_lib_testcase extends advanced_testcase {
|
||||
$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);
|
||||
|
||||
@@ -282,6 +277,13 @@ class mod_data_lib_testcase extends advanced_testcase {
|
||||
// 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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user