See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 310]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Provides the {@link workshopallocation_manual_privacy_provider_testcase} class. 19 * 20 * @package workshopallocation_manual 21 * @category test 22 * @copyright 2018 David Mudrák <david@moodle.com> 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 use core_privacy\local\request\writer; 27 28 defined('MOODLE_INTERNAL') || die(); 29 30 /** 31 * Unit tests for the privacy API implementation. 32 * 33 * @copyright 2018 David Mudrák <david@moodle.com> 34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 */ 36 class workshopallocation_manual_privacy_provider_testcase extends \core_privacy\tests\provider_testcase { 37 38 /** 39 * When no preference exists, there should be no export. 40 */ 41 public function test_no_preference() { 42 global $USER; 43 $this->resetAfterTest(); 44 $this->setAdminUser(); 45 46 \workshopallocation_manual\privacy\provider::export_user_preferences($USER->id); 47 $this->assertFalse(writer::with_context(\context_system::instance())->has_any_data()); 48 } 49 50 /** 51 * Test that the recently selected perpage is exported. 52 */ 53 public function test_export_preferences() { 54 global $USER; 55 $this->resetAfterTest(); 56 $this->setAdminUser(); 57 58 set_user_preference('workshopallocation_manual_perpage', 81); 59 60 \workshopallocation_manual\privacy\provider::export_user_preferences($USER->id); 61 $this->assertTrue(writer::with_context(\context_system::instance())->has_any_data()); 62 63 $prefs = writer::with_context(\context_system::instance())->get_user_preferences('workshopallocation_manual'); 64 $this->assertNotEmpty($prefs->workshopallocation_manual_perpage); 65 $this->assertEquals(81, $prefs->workshopallocation_manual_perpage->value); 66 $this->assertContains(get_string('privacy:metadata:preference:perpage', 'workshopallocation_manual'), 67 $prefs->workshopallocation_manual_perpage->description); 68 } 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body