Commit 57e6fb7a authored by Eloy Lafuente's avatar Eloy Lafuente
Browse files

MDL-73348 phpunit: privacy and privacy_provider testcase names

All privacy_test and privacy_provider_test classes:

- Namespaced with component\privacy.
- Fixed incorrect use statements with leading backslash.
- Changed code to point to global scope when needed.
- Renamed a few files to make all be privacy_test or privacy_provider_test.php
- All them passing individually.
- Complete runs passing too.
parent 58a729f0
......@@ -22,16 +22,17 @@
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_role\privacy;
defined('MOODLE_INTERNAL') || die();
use \core_role\privacy\provider;
use \core_privacy\local\request\approved_contextlist;
use \core_privacy\local\request\writer;
use \core_privacy\tests\provider_testcase;
use \core_privacy\local\request\transform;
use \tool_cohortroles\api;
use \core_privacy\local\request\approved_userlist;
use core_role\privacy\provider;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\writer;
use core_privacy\tests\provider_testcase;
use core_privacy\local\request\transform;
use tool_cohortroles\api;
use core_privacy\local\request\approved_userlist;
/**
* Privacy test for core_role
......@@ -39,7 +40,7 @@ use \core_privacy\local\request\approved_userlist;
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_role_privacy_testcase extends provider_testcase {
class privacy_test extends provider_testcase {
/**
* Test to check export_user_preferences.
* returns user preferences data.
......
......@@ -22,14 +22,15 @@
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_cohortroles\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
use \core_privacy\local\request\writer;
use \core_privacy\local\request\approved_contextlist;
use \tool_cohortroles\api;
use \tool_cohortroles\privacy\provider;
use core_privacy\local\request\writer;
use core_privacy\local\request\approved_contextlist;
use tool_cohortroles\api;
use tool_cohortroles\privacy\provider;
use core_privacy\local\request\approved_userlist;
/**
......@@ -38,7 +39,7 @@ use core_privacy\local\request\approved_userlist;
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_testcase {
class privacy_test extends \core_privacy\tests\provider_testcase {
/**
* Overriding setUp() function to always reset after tests.
......@@ -61,7 +62,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
// Create course category.
$coursecategory = $this->getDataGenerator()->create_category();
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
$systemctx = context_system::instance();
$systemctx = \context_system::instance();
// Create course.
$course = $this->getDataGenerator()->create_course();
$coursectx = \context_course::instance($course->id);
......@@ -102,7 +103,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
// Create course category.
$coursecategory = $this->getDataGenerator()->create_category();
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
$systemctx = context_system::instance();
$systemctx = \context_system::instance();
// Create course.
$course = $this->getDataGenerator()->create_course();
$coursectx = \context_course::instance($course->id);
......@@ -154,7 +155,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
// Create course category.
$coursecategory = $this->getDataGenerator()->create_category();
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
$systemctx = context_system::instance();
$systemctx = \context_system::instance();
$this->setup_test_scenario_data($user->id, $systemctx, 1);
$this->setup_test_scenario_data($user->id, $coursecategoryctx, 1, 'Sausage roll 2',
......@@ -170,7 +171,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
$this->assertCount(2, $contexts);
// Make sure the user data is only being deleted in within the system and course category context.
$usercontext = context_user::instance($user->id);
$usercontext = \context_user::instance($user->id);
// Delete all the User's records in mdl_tool_cohortroles table by the user context.
provider::delete_data_for_all_users_in_context($usercontext);
......@@ -213,7 +214,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
// Create course category.
$coursecategory = $this->getDataGenerator()->create_category();
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
$systemctx = context_system::instance();
$systemctx = \context_system::instance();
$this->setup_test_scenario_data($user->id, $systemctx, 1);
$this->setup_test_scenario_data($user->id, $coursecategoryctx, 1, 'Sausage roll 2',
......@@ -229,7 +230,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
$this->assertCount(2, $contexts);
// Make sure the user data is only being deleted in within the system and the course category contexts.
$usercontext = context_user::instance($user->id);
$usercontext = \context_user::instance($user->id);
// Delete all the User's records in mdl_tool_cohortroles table by the specified approved context list.
$approvedcontextlist = new approved_contextlist($user, 'tool_cohortroles', [$usercontext->id]);
provider::delete_data_for_user($approvedcontextlist);
......@@ -255,12 +256,12 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
// Create a user.
$user = $this->getDataGenerator()->create_user();
$usercontext = context_user::instance($user->id);
$usercontext = \context_user::instance($user->id);
// Create course category.
$coursecategory = $this->getDataGenerator()->create_category();
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
$systemctx = context_system::instance();
$systemctx = \context_system::instance();
$this->setAdminUser();
......@@ -301,12 +302,12 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
$user2 = $this->getDataGenerator()->create_user();
// Create user3.
$user3 = $this->getDataGenerator()->create_user();
$usercontext3 = context_user::instance($user3->id);
$usercontext3 = \context_user::instance($user3->id);
// Create course category.
$coursecategory = $this->getDataGenerator()->create_category();
$coursecategoryctx = \context_coursecat::instance($coursecategory->id);
$systemctx = context_system::instance();
$systemctx = \context_system::instance();
$this->setAdminUser();
......
......@@ -21,6 +21,7 @@
* @copyright 2020 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_dataprivacy\privacy;
defined('MOODLE_INTERNAL') || die();
......@@ -38,7 +39,7 @@ use tool_dataprivacy\privacy\provider;
* @copyright 2020 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
class privacy_provider_test extends provider_testcase {
/**
* Test provider get_contexts_for_userid method
......@@ -49,7 +50,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
$this->resetAfterTest();
$user = $this->getDataGenerator()->create_user();
$context = context_user::instance($user->id);
$context = \context_user::instance($user->id);
// Returned context list should contain a single item.
$contextlist = $this->get_contexts_for_userid($user->id, 'tool_dataprivacy');
......@@ -68,7 +69,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
$this->resetAfterTest();
$user = $this->getDataGenerator()->create_user();
$context = context_user::instance($user->id);
$context = \context_user::instance($user->id);
$userlist = new userlist($context, 'tool_dataprivacy');
provider::get_users_in_context($userlist);
......@@ -82,7 +83,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
* @return void
*/
public function test_get_users_in_context_non_user_context() {
$context = context_system::instance();
$context = \context_system::instance();
$userlist = new userlist($context, 'tool_dataprivacy');
provider::get_users_in_context($userlist);
......@@ -99,7 +100,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
$this->resetAfterTest();
$user = $this->getDataGenerator()->create_user();
$context = context_user::instance($user->id);
$context = \context_user::instance($user->id);
$this->setUser($user);
......@@ -170,7 +171,7 @@ class tool_dataprivacy_privacy_provider_testcase extends provider_testcase {
provider::export_user_preferences($user->id);
/** @var \core_privacy\tests\request\content_writer $writer */
$writer = writer::with_context(context_system::instance());
$writer = writer::with_context(\context_system::instance());
$this->assertTrue($writer->has_any_data());
/** @var stdClass[] $preferences */
......
......@@ -23,6 +23,7 @@
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace logstore_database\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
......@@ -48,7 +49,7 @@ require_once(__DIR__ . '/fixtures/event.php');
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class logstore_database_privacy_testcase extends provider_testcase {
class privacy_test extends provider_testcase {
public function setUp(): void {
global $CFG;
......@@ -105,11 +106,11 @@ class logstore_database_privacy_testcase extends provider_testcase {
$c2 = $this->getDataGenerator()->create_course();
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$cm2ctx = context_module::instance($cm2->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$cm2ctx = \context_module::instance($cm2->cmid);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -143,7 +144,7 @@ class logstore_database_privacy_testcase extends provider_testcase {
$this->assert_contextlist_equals($this->get_contextlist_for_user($u3), [$sysctx, $c1ctx]);
$this->assert_contextlist_equals($this->get_contextlist_for_user($admin), [$sysctx, $c1ctx]);
$this->setAdminUser();
\core\session\manager::loginas($u1->id, context_system::instance());
\core\session\manager::loginas($u1->id, \context_system::instance());
$e = \logstore_database\event\unittest_executed::create(['context' => $c2ctx, 'relateduserid' => $u3->id]);
$e->trigger();
$this->assert_contextlist_equals($this->get_contextlist_for_user($u1), [$sysctx, $cm1ctx, $c2ctx]);
......@@ -163,8 +164,8 @@ class logstore_database_privacy_testcase extends provider_testcase {
$c1 = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -185,7 +186,7 @@ class logstore_database_privacy_testcase extends provider_testcase {
$e->trigger();
// The admin user should be added (realuserid).
$this->setAdminUser();
\core\session\manager::loginas($u2->id, context_system::instance());
\core\session\manager::loginas($u2->id, \context_system::instance());
$e = \logstore_database\event\unittest_executed::create(['context' => $sysctx]);
$e->trigger();
// Set off an event in a different context. User 4 should not be returned below.
......@@ -206,9 +207,9 @@ class logstore_database_privacy_testcase extends provider_testcase {
$u2 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -247,9 +248,9 @@ class logstore_database_privacy_testcase extends provider_testcase {
$u2 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -294,8 +295,8 @@ class logstore_database_privacy_testcase extends provider_testcase {
$u4 = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($course->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($course->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -337,11 +338,11 @@ class logstore_database_privacy_testcase extends provider_testcase {
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
$c2 = $this->getDataGenerator()->create_course();
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$cm2ctx = context_module::instance($cm2->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$cm2ctx = \context_module::instance($cm2->cmid);
$path = [get_string('privacy:path:logs', 'tool_log'), get_string('pluginname', 'logstore_database')];
$this->enable_logging();
......
......@@ -23,6 +23,7 @@
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace logstore_legacy\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
......@@ -46,7 +47,7 @@ require_once(__DIR__ . '/fixtures/event.php');
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class logstore_legacy_privacy_testcase extends provider_testcase {
class privacy_test extends provider_testcase {
public function setUp(): void {
$this->resetAfterTest();
......@@ -58,9 +59,9 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
$u3 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$cm1ctx = context_module::instance($cm1->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -96,11 +97,11 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
$u3 = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$module = $this->getDataGenerator()->create_module('url', ['course' => $course]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($course->id);
$cm1ctx = context_module::instance($module->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($course->id);
$cm1ctx = \context_module::instance($module->cmid);
$userctx = context_user::instance($u1->id);
$userctx = \context_user::instance($u1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -161,10 +162,10 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -238,10 +239,10 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -317,11 +318,11 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
$u3 = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$module = $this->getDataGenerator()->create_module('url', ['course' => $course]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($course->id);
$cm1ctx = context_module::instance($module->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($course->id);
$cm1ctx = \context_module::instance($module->cmid);
$userctx = context_user::instance($u1->id);
$userctx = \context_user::instance($u1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -377,10 +378,10 @@ class logstore_legacy_privacy_testcase extends provider_testcase {
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$this->enable_logging();
$manager = get_log_manager(true);
......
......@@ -23,6 +23,7 @@
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace logstore_standard\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
......@@ -45,7 +46,7 @@ require_once(__DIR__ . '/fixtures/event.php');
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class logstore_standard_privacy_testcase extends provider_testcase {
class privacy_test extends provider_testcase {
public function setUp(): void {
$this->resetAfterTest();
......@@ -63,11 +64,11 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$c2 = $this->getDataGenerator()->create_course();
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$cm2ctx = context_module::instance($cm2->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$cm2ctx = \context_module::instance($cm2->cmid);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -101,7 +102,7 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$this->assert_contextlist_equals($this->get_contextlist_for_user($u3), [$sysctx, $c1ctx]);
$this->assert_contextlist_equals($this->get_contextlist_for_user($admin), [$sysctx, $c1ctx]);
$this->setAdminUser();
\core\session\manager::loginas($u1->id, context_system::instance());
\core\session\manager::loginas($u1->id, \context_system::instance());
$e = \logstore_standard\event\unittest_executed::create(['context' => $c2ctx, 'relateduserid' => $u3->id]);
$e->trigger();
$this->assert_contextlist_equals($this->get_contextlist_for_user($u1), [$sysctx, $cm1ctx, $c2ctx]);
......@@ -118,8 +119,8 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$c1 = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -140,7 +141,7 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$e->trigger();
// The admin user should be added (realuserid).
$this->setAdminUser();
\core\session\manager::loginas($u2->id, context_system::instance());
\core\session\manager::loginas($u2->id, \context_system::instance());
$e = \logstore_standard\event\unittest_executed::create(['context' => $sysctx]);
$e->trigger();
// Set off an event in a different context. User 4 should not be returned below.
......@@ -161,9 +162,9 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$u2 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -202,9 +203,9 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$u2 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c2 = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -246,8 +247,8 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$u4 = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$sysctx = context_system::instance();
$c1ctx = context_course::instance($course->id);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($course->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -289,11 +290,11 @@ class logstore_standard_privacy_testcase extends provider_testcase {
$cm1 = $this->getDataGenerator()->create_module('url', ['course' => $c1]);
$c2 = $this->getDataGenerator()->create_course();
$cm2 = $this->getDataGenerator()->create_module('url', ['course' => $c2]);
$sysctx = context_system::instance();
$c1ctx = context_course::instance($c1->id);
$c2ctx = context_course::instance($c2->id);
$cm1ctx = context_module::instance($cm1->cmid);
$cm2ctx = context_module::instance($cm2->cmid);
$sysctx = \context_system::instance();
$c1ctx = \context_course::instance($c1->id);
$c2ctx = \context_course::instance($c2->id);
$cm1ctx = \context_module::instance($cm1->cmid);
$cm2ctx = \context_module::instance($cm2->cmid);
$path = [get_string('privacy:path:logs', 'tool_log'), get_string('pluginname', 'logstore_standard')];
$this->enable_logging();
......
......@@ -23,6 +23,7 @@
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_log\privacy;
defined('MOODLE_INTERNAL') || die();
global $CFG;
......@@ -49,7 +50,7 @@ require_once($CFG->dirroot . '/admin/tool/log/store/standard/tests/fixtures/even
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_log_privacy_testcase extends provider_testcase {
class privacy_test extends provider_testcase {
public function setUp(): void {
$this->resetAfterTest();
......@@ -60,7 +61,7 @@ class tool_log_privacy_testcase extends provider_testcase {
$admin = \core_user::get_user(2);
$u1 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c1ctx = context_course::instance($c1->id);
$c1ctx = \context_course::instance($c1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -77,7 +78,7 @@ class tool_log_privacy_testcase extends provider_testcase {
$u1 = $this->getDataGenerator()->create_user();
$u2 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c1ctx = context_course::instance($c1->id);
$c1ctx = \context_course::instance($c1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -111,7 +112,7 @@ class tool_log_privacy_testcase extends provider_testcase {
$u1 = $this->getDataGenerator()->create_user();
$u2 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c1ctx = context_course::instance($c1->id);
$c1ctx = \context_course::instance($c1->id);
$this->enable_logging();
$manager = get_log_manager(true);
......@@ -144,7 +145,7 @@ class tool_log_privacy_testcase extends provider_testcase {
$admin = \core_user::get_user(2);
$u1 = $this->getDataGenerator()->create_user();
$c1 = $this->getDataGenerator()->create_course();
$c1ctx = context_course::instance($c1->id);
$c1ctx = \context_course::instance($c1->id);
$path = [get_string('privacy:path:logs', 'tool_log'), get_string('pluginname', 'logstore_standard')];
$this->enable_logging();
......
......@@ -23,6 +23,7 @@
* @author Frédéric Massart <fred@branchup.tech>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_messageinbound\privacy;
defined('MOODLE_INTERNAL') || die();