mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merge branch 'MDL-62781-master' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
76ca5c61d0
1 changed files with 13 additions and 5 deletions
|
@ -261,15 +261,17 @@ class core_question_privacy_provider_testcase extends \core_privacy\tests\provid
|
||||||
// Run the delete functions as default user.
|
// Run the delete functions as default user.
|
||||||
$this->setUser();
|
$this->setUser();
|
||||||
|
|
||||||
|
// Find out how many questions are in the question bank to start with.
|
||||||
|
$questioncount = $DB->count_records('question');
|
||||||
|
|
||||||
// The delete functions should do nothing here.
|
// The delete functions should do nothing here.
|
||||||
$this->assertCount(6, $DB->get_records('question'));
|
|
||||||
|
|
||||||
// Delete for all users in context.
|
// Delete for all users in context.
|
||||||
provider::delete_data_for_all_users_in_context($expectedcontext);
|
provider::delete_data_for_all_users_in_context($expectedcontext);
|
||||||
$this->assertCount(6, $DB->get_records('question'));
|
$this->assertEquals($questioncount, $DB->count_records('question'));
|
||||||
|
|
||||||
provider::delete_data_for_user($approvedcontextlist);
|
provider::delete_data_for_user($approvedcontextlist);
|
||||||
$this->assertCount(6, $DB->get_records('question'));
|
$this->assertEquals($questioncount, $DB->count_records('question'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -321,11 +323,14 @@ class core_question_privacy_provider_testcase extends \core_privacy\tests\provid
|
||||||
[$context->id]
|
[$context->id]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Find out how many questions are in the question bank to start with.
|
||||||
|
$questioncount = $DB->count_records('question');
|
||||||
|
|
||||||
// Delete the data and check it is removed.
|
// Delete the data and check it is removed.
|
||||||
$this->setUser();
|
$this->setUser();
|
||||||
provider::delete_data_for_user($approvedcontextlist);
|
provider::delete_data_for_user($approvedcontextlist);
|
||||||
|
|
||||||
$this->assertCount(5, $DB->get_records('question'));
|
$this->assertEquals($questioncount, $DB->count_records('question'));
|
||||||
|
|
||||||
$qrecord = $DB->get_record('question', ['id' => $q1->id]);
|
$qrecord = $DB->get_record('question', ['id' => $q1->id]);
|
||||||
$this->assertEquals(0, $qrecord->createdby);
|
$this->assertEquals(0, $qrecord->createdby);
|
||||||
|
@ -391,11 +396,14 @@ class core_question_privacy_provider_testcase extends \core_privacy\tests\provid
|
||||||
$questiongenerator->update_question($q3);
|
$questiongenerator->update_question($q3);
|
||||||
$q5 = $questiongenerator->create_question('shortanswer', null, array('category' => $othercat->id));
|
$q5 = $questiongenerator->create_question('shortanswer', null, array('category' => $othercat->id));
|
||||||
|
|
||||||
|
// Find out how many questions are in the question bank to start with.
|
||||||
|
$questioncount = $DB->count_records('question');
|
||||||
|
|
||||||
// Delete the data and check it is removed.
|
// Delete the data and check it is removed.
|
||||||
$this->setUser();
|
$this->setUser();
|
||||||
provider::delete_data_for_all_users_in_context($context);
|
provider::delete_data_for_all_users_in_context($context);
|
||||||
|
|
||||||
$this->assertCount(5, $DB->get_records('question'));
|
$this->assertEquals($questioncount, $DB->count_records('question'));
|
||||||
|
|
||||||
$qrecord = $DB->get_record('question', ['id' => $q1->id]);
|
$qrecord = $DB->get_record('question', ['id' => $q1->id]);
|
||||||
$this->assertEquals(0, $qrecord->createdby);
|
$this->assertEquals(0, $qrecord->createdby);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue