diff --git a/question/tests/privacy_provider_test.php b/question/tests/privacy_provider_test.php index 6760e7d8bc8..7b6ffca9cc2 100644 --- a/question/tests/privacy_provider_test.php +++ b/question/tests/privacy_provider_test.php @@ -261,15 +261,18 @@ class core_question_privacy_provider_testcase extends \core_privacy\tests\provid // Run the delete functions as default user. $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. - $this->assertCount(6, $DB->get_records('question')); + $this->assertEquals($questioncount, $DB->count_records('question')); // Delete for all users in context. 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); - $this->assertCount(6, $DB->get_records('question')); + $this->assertEquals($questioncount, $DB->count_records('question')); } /** @@ -321,11 +324,14 @@ class core_question_privacy_provider_testcase extends \core_privacy\tests\provid [$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. $this->setUser(); 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]); $this->assertEquals(0, $qrecord->createdby); @@ -391,11 +397,14 @@ class core_question_privacy_provider_testcase extends \core_privacy\tests\provid $questiongenerator->update_question($q3); $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. $this->setUser(); 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]); $this->assertEquals(0, $qrecord->createdby);