MDL-76557 enrol_lti: Fix unit test docs and convert to provider

This commit is contained in:
Andrew Nicols 2023-08-16 22:52:48 +08:00
parent 0608452503
commit b2780aa6f6
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14

View File

@ -144,49 +144,29 @@ class sync_grades_test extends \lti_advantage_testcase {
}
}
/**
* Test the sync grades task works correct when platform responses with 200 status code.
*
* @covers ::execute
*/
public function test_grade_sync_positive_case_200() {
$this->test_grade_sync_positive_case('200');
}
/**
* Test the sync grades task works correct when platform responses with 201 status code.
* Data provider for test_grade_sync_positive_case.
*
* @covers ::execute
* @return array
*/
public function test_grade_sync_positive_case_201() {
$this->test_grade_sync_positive_case('201');
}
/**
* Test the sync grades task works correct when platform responses with 202 status code.
*
* @covers ::execute
*/
public function test_grade_sync_positive_case_202() {
$this->test_grade_sync_positive_case('202');
}
/**
* Test the sync grades task works correct when platform responses with 204 status code.
*
* @covers ::execute
*/
public function test_grade_sync_positive_case_204() {
$this->test_grade_sync_positive_case('204');
public static function grade_sync_positive_cases(): array {
return [
[200],
[201],
[202],
[204],
];
}
/**
* Test the sync grades task works correct when platform responses with given status code.
*
* @covers ::execute
* @param string $statuscode the response status code with which the job should work correct
* @param string $statuscode the response status code with which the job should work correctly
* @dataProvider grade_sync_positive_cases
*/
protected function test_grade_sync_positive_case($statuscode) {
public function test_grade_sync_positive_case($statuscode): void {
$this->resetAfterTest();
[$course, $resource] = $this->create_test_environment();