MDL-63167 grade: Test functions update

This commit is contained in:
Peter Dias 2020-06-17 14:12:08 +08:00
parent c771b25c0f
commit d49d4ee47b

View File

@ -69,56 +69,6 @@ class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
test_legacy_polyfill_gradingform_provider::$mock = $mock;
test_legacy_polyfill_gradingform_provider::delete_gradingform_for_instances([3, 17]);
}
/**
* Test the __get_gradingform_export_data shim.
*/
public function test_get_gradingform_export_data() {
$userid = 476;
$context = context_system::instance();
$mock = $this->createMock(test_gradingform_legacy_polyfill_mock_wrapper::class);
$mock->expects($this->once())
->method('get_return_value')
->with('_get_gradingform_export_data', [$context, (object)[], $userid]);
test_legacy_polyfill_gradingform_provider::$mock = $mock;
test_legacy_polyfill_gradingform_provider::get_gradingform_export_data($context, (object)[], $userid);
$this->assertDebuggingCalled();
}
/**
* Test the _delete_gradingform_for_context shim.
*/
public function test_delete_gradingform_for_context() {
$context = context_system::instance();
$mock = $this->createMock(test_gradingform_legacy_polyfill_mock_wrapper::class);
$mock->expects($this->once())
->method('get_return_value')
->with('_delete_gradingform_for_context', [$context]);
test_legacy_polyfill_gradingform_provider::$mock = $mock;
test_legacy_polyfill_gradingform_provider::delete_gradingform_for_context($context);
$this->assertDebuggingCalled();
}
/**
* Test the _delete_gradingform_for_userid shim.
*/
public function test_delete_gradingform_for_user() {
$userid = 696;
$context = \context_system::instance();
$mock = $this->createMock(test_gradingform_legacy_polyfill_mock_wrapper::class);
$mock->expects($this->once())
->method('get_return_value')
->with('_delete_gradingform_for_userid', [$userid, $context]);
test_legacy_polyfill_gradingform_provider::$mock = $mock;
test_legacy_polyfill_gradingform_provider::delete_gradingform_for_userid($userid, $context);
$this->assertDebuggingCalled();
}
}
/**
@ -129,7 +79,6 @@ class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
*/
class test_legacy_polyfill_gradingform_provider implements
\core_privacy\local\metadata\provider,
\core_grading\privacy\gradingform_provider,
\core_grading\privacy\gradingform_provider_v2 {
use \core_grading\privacy\gradingform_legacy_polyfill;
@ -169,47 +118,6 @@ class test_legacy_polyfill_gradingform_provider implements
protected static function _get_metadata(\core_privacy\local\metadata\collection $collection) {
return $collection;
}
/**
* This method is used to export any user data this sub-plugin has using the object to get the context and userid.
*
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
* @todo MDL-63167 remove this method.
*
* @param context $context Context owner of the data.
* @param stdClass $definition Grading definition entry to export.
* @param int $userid The user whose information is to be exported.
*
* @return stdClass The data to export.
*/
protected static function _get_gradingform_export_data(\context $context, $definition, int $userid) {
static::$mock->get_return_value(__FUNCTION__, func_get_args());
}
/**
* Any call to this method should delete all user data for the context defined.
*
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
* @todo MDL-63167 remove this method.
*
* @param context $context Context owner of the data.
*/
protected static function _delete_gradingform_for_context(\context $context) {
static::$mock->get_return_value(__FUNCTION__, func_get_args());
}
/**
* A call to this method should delete user data (where practicle) from the userid and context.
*
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
* @todo MDL-63167 remove this method.
*
* @param int $userid The user whose information is to be deleted.
* @param context $context Context owner of the data.
*/
protected static function _delete_gradingform_for_userid(int $userid, \context $context) {
static::$mock->get_return_value(__FUNCTION__, func_get_args());
}
}
/**