Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
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/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea -...
16
 
-
 
17
/**
-
 
18
 * Privacy provider tests.
-
 
19
 *
-
 
20
 * @package    core_editor
-
 
21
 * @copyright  2018 Andrew Nicols <andrew@nicols.co.uk>
-
 
22
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
23
 */
16
 
Línea 24... Línea -...
24
namespace core_editor\privacy;
-
 
25
 
17
namespace core_editor\privacy;
26
use core_privacy\local\metadata\collection;
18
 
Línea 27... Línea -...
27
use core_privacy\local\request\writer;
-
 
28
use core_editor\privacy\provider;
-
 
29
 
19
use core_privacy\local\request\writer;
30
defined('MOODLE_INTERNAL') || die();
20
use core_editor\privacy\provider;
31
 
21
 
32
/**
22
/**
33
 * Privacy provider tests class.
23
 * Privacy provider tests class.
34
 *
24
 *
-
 
25
 * @package    core_editor
35
 * @package    core_editor
26
 * @copyright  2018 Andrew Nicols <andrew@nicols.co.uk>
36
 * @copyright  2018 Andrew Nicols <andrew@nicols.co.uk>
27
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
38
 */
28
 * @covers \core_editor\privacy\provider
39
class provider_test extends \core_privacy\tests\provider_testcase {
29
 */
40
 
30
final class provider_test extends \core_privacy\tests\provider_testcase {
41
    /**
31
    /**
42
     * When no preference exists, there should be no export.
32
     * When no preference exists, there should be no export.
Línea 75... Línea 65...
75
    }
65
    }
Línea 76... Línea 66...
76
 
66
 
77
    /**
67
    /**
78
     * When an editor is set, the name of that editor will be reported.
68
     * When an editor is set, the name of that editor will be reported.
79
     */
69
     */
80
    public function test_editor_atto(): void {
70
    public function test_editor_tiny(): void {
Línea 81... Línea 71...
81
        $this->resetAfterTest();
71
        $this->resetAfterTest();
82
 
72
 
83
        // Create test user, add some preferences.
73
        // Create test user, add some preferences.
Línea 84... Línea 74...
84
        $user = $this->getDataGenerator()->create_user();
74
        $user = $this->getDataGenerator()->create_user();
Línea 85... Línea 75...
85
        $this->setUser($user);
75
        $this->setUser($user);
86
 
76
 
Línea 87... Línea 77...
87
        set_user_preference('htmleditor', 'atto');
77
        set_user_preference('htmleditor', 'tiny');
Línea 97... Línea 87...
97
 
87
 
98
        $prefs = $writer->get_user_preferences('core_editor');
88
        $prefs = $writer->get_user_preferences('core_editor');
99
        $this->assertNotEmpty($prefs->htmleditor);
89
        $this->assertNotEmpty($prefs->htmleditor);
100
        $this->assertNotEmpty($prefs->htmleditor->value);
90
        $this->assertNotEmpty($prefs->htmleditor->value);
101
        $this->assertNotEmpty($prefs->htmleditor->description);
91
        $this->assertNotEmpty($prefs->htmleditor->description);
Línea 102... Línea 92...
102
        $this->assertEquals('atto', $prefs->htmleditor->value);
92
        $this->assertEquals('tiny', $prefs->htmleditor->value);
103
 
93
 
104
        $this->assertEquals(
94
        $this->assertEquals(
105
            get_string(
95
            get_string(
106
                'privacy:preference:htmleditor',
96
                'privacy:preference:htmleditor',
107
                'core_editor',
97
                'core_editor',
108
                get_string('pluginname', "editor_atto")
98
                get_string('pluginname', "editor_tiny")
109
            ),
99
            ),
110
            $prefs->htmleditor->description
100
            $prefs->htmleditor->description
111
        );
101
        );