MDL-81520 mod_assign: Update tests to not extend assign_provider test

This commit is contained in:
Andrew Nicols 2024-10-17 10:32:26 +08:00
parent 55126be4ad
commit 5b03e6e38c
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
9 changed files with 47 additions and 82 deletions

View File

@ -21,8 +21,10 @@ use mod_assign\tests\provider_testcase;
/**
* Unit tests for mod/assign/feedback/comments/classes/privacy/
*
* @package assignfeedback_comments
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \assignfeedback_comments\privacy\provider
*/
final class provider_test extends provider_testcase {
/**

View File

@ -14,32 +14,29 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for assignfeedback_editpdf.
*
* @package assignfeedback_editpdf
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignfeedback_editpdf\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
require_once($CFG->dirroot . '/mod/assign/tests/privacy/provider_test.php');
use assignfeedback_editpdf\page_editor;
use mod_assign\privacy\assign_plugin_request_data;
/**
* Unit tests for mod/assign/feedback/editpdf/classes/privacy/
* Unit tests for mod/assign/feedback/editpdf/classes/privacy/provider.
*
* @package assignfeedback_editpdf
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \assignfeedback_editpdf\privacy\provider
*/
final class provider_test extends \mod_assign\privacy\provider_test {
final class provider_test extends \mod_assign\tests\provider_testcase {
#[\Override]
public static function setUpBeforeClass(): void {
global $CFG;
parent::setUpBeforeClass();
require_once($CFG->dirroot . '/mod/assign/locallib.php');
}
#[\Override]
public function setUp(): void {
// Skip this test if ghostscript is not supported.
$result = \assignfeedback_editpdf\pdf::test_gs_path(false);

View File

@ -14,30 +14,26 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for assignfeedback_file.
*
* @package assignfeedback_file
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignfeedback_file\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
require_once($CFG->dirroot . '/mod/assign/tests/privacy/provider_test.php');
use mod_assign\privacy\assign_plugin_request_data;
/**
* Unit tests for mod/assign/feedback/file/classes/privacy/
* Unit tests for mod/assign/feedback/file/classes/privacy/provider.
*
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package assignfeedback_file
* @covers \assignfeedback_file\privacy\provider
*/
final class provider_test extends \mod_assign\privacy\provider_test {
final class provider_test extends \mod_assign\tests\provider_testcase {
#[\Override]
public static function setUpBeforeClass(): void {
global $CFG;
parent::setUpBeforeClass();
require_once($CFG->dirroot . '/mod/assign/locallib.php');
}
/**
* Convenience function for creating feedback data.

View File

@ -14,29 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for assignsubmission_comments.
*
* @package assignsubmission_comments
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignsubmission_comments\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/assign/tests/privacy/provider_test.php');
use mod_assign\privacy\useridlist;
/**
* Unit tests for mod/assign/submission/comments/classes/privacy/
*
* @package assignsubmission_comments
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \assignsubmission_comments\privacy\provider
*/
final class provider_test extends \mod_assign\privacy\provider_test {
final class provider_test extends \mod_assign\tests\provider_testcase {
/**
* Convenience function for creating feedback data.

View File

@ -14,28 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for assignsubmission_file.
*
* @package assignsubmission_file
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignsubmission_file\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/assign/tests/privacy/provider_test.php');
/**
* Unit tests for mod/assign/submission/file/classes/privacy/
*
* @package assignsubmission_file
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \assignsubmission_file\privacy\provider
*/
final class provider_test extends \mod_assign\privacy\provider_test {
final class provider_test extends \mod_assign\tests\provider_testcase {
/**
* Convenience function for creating feedback data.
*

View File

@ -14,27 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for assignsubmission_onlinetext.
*
* @package assignsubmission_onlinetext
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignsubmission_onlinetext\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/mod/assign/tests/privacy/provider_test.php');
/**
* Unit tests for mod/assign/submission/onlinetext/classes/privacy/
* Unit tests for mod/assign/submission/onlinetext/classes/privacy/provider.
*
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package assignsubmission_onlinetext
* @covers \assignsubmission_onlinetext\privacy\provider
*/
final class provider_test extends \mod_assign\privacy\provider_test {
final class provider_test extends \mod_assign\tests\provider_testcase {
/**
* Convenience function for creating feedback data.

View File

@ -40,8 +40,7 @@ require_once($CFG->dirroot . '/mod/assign/tests/generator.php');
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class locallib_test extends \advanced_testcase {
final class locallib_test extends \advanced_testcase {
// Use the generator helper.
use mod_assign_test_generator;

View File

@ -14,14 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Base class for unit tests for mod_assign.
*
* @package mod_assign
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_assign\privacy;
use core_privacy\local\request\writer;
@ -32,10 +24,12 @@ use mod_assign\tests\provider_testcase;
/**
* Unit tests for mod/assign/classes/privacy/
*
* @package mod_assign
* @copyright 2018 Adrian Greeve <adrian@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @covers \mod_assign\privacy\provider
*/
class provider_test extends provider_testcase {
final class provider_test extends provider_testcase {
/**
* Test that getting the contexts for a user works.
*/

View File

@ -1,5 +1,13 @@
This files describes API changes in the assign code.
=== 4.4.5 ===
* The unit test for the privacy provider has been marked as final.
A number of core tests had been incorrectly configured to extend this test
but should instead be extending `\mod_assign\tests\provider_testcase`.
Any community plugins extending the `\mod_assign\privacy\provider_test` test
class should be updated to extend `\mod_assign\tests\provider_testcase` instead.
See MDL-81520 for further information.
=== 4.3 ===
* The following deprecated methods have been removed and should not be used any more:
- `assign::add_to_log`