芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/cepali/mod/workshop/allocation/manual/tests/privacy_provider_test.php
. /** * Provides the {@link workshopallocation_manual_privacy_provider_testcase} class. * * @package workshopallocation_manual * @category test * @copyright 2018 David Mudrák
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use core_privacy\local\request\writer; defined('MOODLE_INTERNAL') || die(); /** * Unit tests for the privacy API implementation. * * @copyright 2018 David Mudrák
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class workshopallocation_manual_privacy_provider_testcase extends \core_privacy\tests\provider_testcase { /** * When no preference exists, there should be no export. */ public function test_no_preference() { global $USER; $this->resetAfterTest(); $this->setAdminUser(); \workshopallocation_manual\privacy\provider::export_user_preferences($USER->id); $this->assertFalse(writer::with_context(\context_system::instance())->has_any_data()); } /** * Test that the recently selected perpage is exported. */ public function test_export_preferences() { global $USER; $this->resetAfterTest(); $this->setAdminUser(); set_user_preference('workshopallocation_manual_perpage', 81); \workshopallocation_manual\privacy\provider::export_user_preferences($USER->id); $this->assertTrue(writer::with_context(\context_system::instance())->has_any_data()); $prefs = writer::with_context(\context_system::instance())->get_user_preferences('workshopallocation_manual'); $this->assertNotEmpty($prefs->workshopallocation_manual_perpage); $this->assertEquals(81, $prefs->workshopallocation_manual_perpage->value); $this->assertContains(get_string('privacy:metadata:preference:perpage', 'workshopallocation_manual'), $prefs->workshopallocation_manual_perpage->description); } }