Merge branch 'master_MDL-41806' of git://github.com/totara/moodle
[moodle.git] / lib / tests / weblib_test.php
CommitLineData
a3d5830a
PS
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 * These tests rely on the rsstest.xml file on download.moodle.org,
19 * from eloys listing:
20 * rsstest.xml: One valid rss feed.
21 * md5: 8fd047914863bf9b3a4b1514ec51c32c
22 * size: 32188
23 *
24 * If networking/proxy configuration is wrong these tests will fail..
25 *
26 * @package core
27 * @category phpunit
28 * @copyright &copy; 2006 The Open University
29 * @author T.J.Hunt@open.ac.uk
30 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
31 */
32
33defined('MOODLE_INTERNAL') || die();
34
35
b33bf039 36class core_weblib_testcase extends advanced_testcase {
a3d5830a 37
b33bf039 38 public function test_format_string() {
a3d5830a
PS
39 global $CFG;
40
b33bf039
PS
41 // Ampersands.
42 $this->assertSame("&amp; &amp;&amp;&amp;&amp;&amp; &amp;&amp;", format_string("& &&&&& &&"));
43 $this->assertSame("ANother &amp; &amp;&amp;&amp;&amp;&amp; Category", format_string("ANother & &&&&& Category"));
44 $this->assertSame("ANother &amp; &amp;&amp;&amp;&amp;&amp; Category", format_string("ANother & &&&&& Category", true));
45 $this->assertSame("Nick's Test Site &amp; Other things", format_string("Nick's Test Site & Other things", true));
a3d5830a 46
b33bf039
PS
47 // String entities.
48 $this->assertSame("&quot;", format_string("&quot;"));
a3d5830a 49
b33bf039
PS
50 // Digital entities.
51 $this->assertSame("&11234;", format_string("&11234;"));
a3d5830a 52
b33bf039
PS
53 // Unicode entities.
54 $this->assertSame("&#4475;", format_string("&#4475;"));
a3d5830a 55
b33bf039 56 // < and > signs.
a3d5830a
PS
57 $originalformatstringstriptags = $CFG->formatstringstriptags;
58
59 $CFG->formatstringstriptags = false;
b33bf039
PS
60 $this->assertSame('x &lt; 1', format_string('x < 1'));
61 $this->assertSame('x &gt; 1', format_string('x > 1'));
62 $this->assertSame('x &lt; 1 and x &gt; 0', format_string('x < 1 and x > 0'));
a3d5830a
PS
63
64 $CFG->formatstringstriptags = true;
b33bf039
PS
65 $this->assertSame('x &lt; 1', format_string('x < 1'));
66 $this->assertSame('x &gt; 1', format_string('x > 1'));
67 $this->assertSame('x &lt; 1 and x &gt; 0', format_string('x < 1 and x > 0'));
a3d5830a
PS
68
69 $CFG->formatstringstriptags = $originalformatstringstriptags;
70 }
71
b33bf039 72 public function test_s() {
328ac306
TH
73 // Special cases.
74 $this->assertSame('0', s(0));
75 $this->assertSame('0', s('0'));
76 $this->assertSame('0', s(false));
77 $this->assertSame('', s(null));
78
79 // Normal cases.
b33bf039
PS
80 $this->assertSame('This Breaks &quot; Strict', s('This Breaks " Strict'));
81 $this->assertSame('This Breaks &lt;a&gt;&quot; Strict&lt;/a&gt;', s('This Breaks <a>" Strict</a>'));
328ac306
TH
82
83 // Unicode characters.
b33bf039
PS
84 $this->assertSame('Café', s('Café'));
85 $this->assertSame('一, 二, 三', s('一, 二, 三'));
328ac306
TH
86
87 // Don't escape already-escaped numeric entities. (Note, this behaviour
88 // may not be desirable. Perhaps we should remove these tests and that
89 // functionality, but we can only do that if we understand why it was added.)
b33bf039
PS
90 $this->assertSame('An entity: &#x09ff;.', s('An entity: &#x09ff;.'));
91 $this->assertSame('An entity: &#1073;.', s('An entity: &#1073;.'));
92 $this->assertSame('An entity: &amp;amp;.', s('An entity: &amp;.'));
93 $this->assertSame('Not an entity: &amp;amp;#x09ff;.', s('Not an entity: &amp;#x09ff;.'));
a3d5830a
PS
94 }
95
b33bf039
PS
96 public function test_format_text_email() {
97 $this->assertSame("This is a TEST",
98 format_text_email('<p>This is a <strong>test</strong></p>', FORMAT_HTML));
99 $this->assertSame("This is a TEST",
100 format_text_email('<p class="frogs">This is a <strong class=\'fishes\'>test</strong></p>', FORMAT_HTML));
101 $this->assertSame('& so is this',
102 format_text_email('&amp; so is this', FORMAT_HTML));
103 $this->assertSame('Two bullets: '.core_text::code2utf8(8226).' *',
104 format_text_email('Two bullets: &#x2022; &#8226;', FORMAT_HTML));
105 $this->assertSame(core_text::code2utf8(0x7fd2).core_text::code2utf8(0x7fd2),
106 format_text_email('&#x7fd2;&#x7FD2;', FORMAT_HTML));
a3d5830a
PS
107 }
108
b33bf039 109 public function test_obfuscate_email() {
66056f99
PS
110 $email = 'some.user@example.com';
111 $obfuscated = obfuscate_email($email);
112 $this->assertNotSame($email, $obfuscated);
b33bf039 113 $back = core_text::entities_to_utf8(urldecode($email), true);
66056f99
PS
114 $this->assertSame($email, $back);
115 }
116
b33bf039 117 public function test_obfuscate_text() {
66056f99
PS
118 $text = 'Žluťoučký koníček 32131';
119 $obfuscated = obfuscate_text($text);
120 $this->assertNotSame($text, $obfuscated);
b33bf039 121 $back = core_text::entities_to_utf8($obfuscated, true);
66056f99
PS
122 $this->assertSame($text, $back);
123 }
124
b33bf039
PS
125 public function test_highlight() {
126 $this->assertSame('This is <span class="highlight">good</span>', highlight('good', 'This is good'));
127 $this->assertSame('<span class="highlight">span</span>', highlight('SpaN', 'span'));
128 $this->assertSame('<span class="highlight">SpaN</span>', highlight('span', 'SpaN'));
129 $this->assertSame('<span><span class="highlight">span</span></span>', highlight('span', '<span>span</span>'));
130 $this->assertSame('He <span class="highlight">is</span> <span class="highlight">good</span>', highlight('good is', 'He is good'));
131 $this->assertSame('This is <span class="highlight">good</span>', highlight('+good', 'This is good'));
132 $this->assertSame('This is good', highlight('-good', 'This is good'));
133 $this->assertSame('This is goodness', highlight('+good', 'This is goodness'));
134 $this->assertSame('This is <span class="highlight">good</span>ness', highlight('good', 'This is goodness'));
a3d5830a
PS
135 }
136
b33bf039
PS
137 public function test_replace_ampersands() {
138 $this->assertSame("This &amp; that &nbsp;", replace_ampersands_not_followed_by_entity("This & that &nbsp;"));
139 $this->assertSame("This &amp;nbsp that &nbsp;", replace_ampersands_not_followed_by_entity("This &nbsp that &nbsp;"));
a3d5830a
PS
140 }
141
b33bf039
PS
142 public function test_strip_links() {
143 $this->assertSame('this is a link', strip_links('this is a <a href="http://someaddress.com/query">link</a>'));
a3d5830a
PS
144 }
145
b33bf039
PS
146 public function test_wikify_links() {
147 $this->assertSame('this is a link [ http://someaddress.com/query ]', wikify_links('this is a <a href="http://someaddress.com/query">link</a>'));
a3d5830a
PS
148 }
149
61b223a6
SH
150 /**
151 * Test basic moodle_url construction.
152 */
b33bf039 153 public function test_moodle_url_constructor() {
61b223a6
SH
154 global $CFG;
155
156 $url = new moodle_url('/index.php');
b33bf039 157 $this->assertSame($CFG->wwwroot.'/index.php', $url->out());
61b223a6
SH
158
159 $url = new moodle_url('/index.php', array());
b33bf039 160 $this->assertSame($CFG->wwwroot.'/index.php', $url->out());
61b223a6
SH
161
162 $url = new moodle_url('/index.php', array('id' => 2));
b33bf039 163 $this->assertSame($CFG->wwwroot.'/index.php?id=2', $url->out());
61b223a6
SH
164
165 $url = new moodle_url('/index.php', array('id' => 'two'));
b33bf039 166 $this->assertSame($CFG->wwwroot.'/index.php?id=two', $url->out());
61b223a6
SH
167
168 $url = new moodle_url('/index.php', array('id' => 1, 'cid' => '2'));
b33bf039
PS
169 $this->assertSame($CFG->wwwroot.'/index.php?id=1&amp;cid=2', $url->out());
170 $this->assertSame($CFG->wwwroot.'/index.php?id=1&cid=2', $url->out(false));
61b223a6
SH
171
172 $url = new moodle_url('/index.php', null, 'test');
b33bf039 173 $this->assertSame($CFG->wwwroot.'/index.php#test', $url->out());
61b223a6
SH
174
175 $url = new moodle_url('/index.php', array('id' => 2), 'test');
b33bf039 176 $this->assertSame($CFG->wwwroot.'/index.php?id=2#test', $url->out());
61b223a6
SH
177 }
178
ffe4de97 179 /**
180 * Tests moodle_url::get_path().
181 */
182 public function test_moodle_url_get_path() {
183 $url = new moodle_url('http://www.example.org:447/my/file/is/here.txt?really=1');
b33bf039 184 $this->assertSame('/my/file/is/here.txt', $url->get_path());
ffe4de97 185
186 $url = new moodle_url('http://www.example.org/');
b33bf039 187 $this->assertSame('/', $url->get_path());
ffe4de97 188
189 $url = new moodle_url('http://www.example.org/pluginfile.php/slash/arguments');
b33bf039
PS
190 $this->assertSame('/pluginfile.php/slash/arguments', $url->get_path());
191 $this->assertSame('/pluginfile.php', $url->get_path(false));
ffe4de97 192 }
193
b33bf039 194 public function test_moodle_url_round_trip() {
a3d5830a
PS
195 $strurl = 'http://moodle.org/course/view.php?id=5';
196 $url = new moodle_url($strurl);
b33bf039 197 $this->assertSame($strurl, $url->out(false));
a3d5830a
PS
198
199 $strurl = 'http://moodle.org/user/index.php?contextid=53&sifirst=M&silast=D';
200 $url = new moodle_url($strurl);
b33bf039 201 $this->assertSame($strurl, $url->out(false));
a3d5830a
PS
202 }
203
616396a6
SH
204 /**
205 * Test Moodle URL objects created with a param with empty value.
206 */
b33bf039 207 public function test_moodle_url_empty_param_values() {
616396a6
SH
208 $strurl = 'http://moodle.org/course/view.php?id=0';
209 $url = new moodle_url($strurl, array('id' => 0));
b33bf039 210 $this->assertSame($strurl, $url->out(false));
616396a6 211
45d97522 212 $strurl = 'http://moodle.org/course/view.php?id';
616396a6 213 $url = new moodle_url($strurl, array('id' => false));
b33bf039 214 $this->assertSame($strurl, $url->out(false));
616396a6 215
45d97522 216 $strurl = 'http://moodle.org/course/view.php?id';
616396a6 217 $url = new moodle_url($strurl, array('id' => null));
b33bf039 218 $this->assertSame($strurl, $url->out(false));
616396a6 219
a697000b
SH
220 $strurl = 'http://moodle.org/course/view.php?id';
221 $url = new moodle_url($strurl, array('id' => ''));
b33bf039 222 $this->assertSame($strurl, $url->out(false));
a697000b 223
45d97522 224 $strurl = 'http://moodle.org/course/view.php?id';
616396a6 225 $url = new moodle_url($strurl);
b33bf039 226 $this->assertSame($strurl, $url->out(false));
616396a6
SH
227 }
228
b33bf039 229 public function test_moodle_url_round_trip_array_params() {
a3d5830a
PS
230 $strurl = 'http://example.com/?a%5B1%5D=1&a%5B2%5D=2';
231 $url = new moodle_url($strurl);
b33bf039 232 $this->assertSame($strurl, $url->out(false));
a3d5830a
PS
233
234 $url = new moodle_url('http://example.com/?a[1]=1&a[2]=2');
b33bf039 235 $this->assertSame($strurl, $url->out(false));
a3d5830a 236
b33bf039 237 // For un-keyed array params, we expect 0..n keys to be returned.
a3d5830a
PS
238 $strurl = 'http://example.com/?a%5B0%5D=0&a%5B1%5D=1';
239 $url = new moodle_url('http://example.com/?a[]=0&a[]=1');
b33bf039 240 $this->assertSame($strurl, $url->out(false));
a3d5830a
PS
241 }
242
b33bf039 243 public function test_compare_url() {
a3d5830a
PS
244 $url1 = new moodle_url('index.php', array('var1' => 1, 'var2' => 2));
245 $url2 = new moodle_url('index2.php', array('var1' => 1, 'var2' => 2, 'var3' => 3));
246
247 $this->assertFalse($url1->compare($url2, URL_MATCH_BASE));
248 $this->assertFalse($url1->compare($url2, URL_MATCH_PARAMS));
249 $this->assertFalse($url1->compare($url2, URL_MATCH_EXACT));
250
251 $url2 = new moodle_url('index.php', array('var1' => 1, 'var3' => 3));
252
253 $this->assertTrue($url1->compare($url2, URL_MATCH_BASE));
254 $this->assertFalse($url1->compare($url2, URL_MATCH_PARAMS));
255 $this->assertFalse($url1->compare($url2, URL_MATCH_EXACT));
256
257 $url2 = new moodle_url('index.php', array('var1' => 1, 'var2' => 2, 'var3' => 3));
258
259 $this->assertTrue($url1->compare($url2, URL_MATCH_BASE));
260 $this->assertTrue($url1->compare($url2, URL_MATCH_PARAMS));
261 $this->assertFalse($url1->compare($url2, URL_MATCH_EXACT));
262
263 $url2 = new moodle_url('index.php', array('var2' => 2, 'var1' => 1));
264
265 $this->assertTrue($url1->compare($url2, URL_MATCH_BASE));
266 $this->assertTrue($url1->compare($url2, URL_MATCH_PARAMS));
267 $this->assertTrue($url1->compare($url2, URL_MATCH_EXACT));
268 }
269
b33bf039 270 public function test_out_as_local_url() {
72b181ba
RT
271 global $CFG;
272 // Test http url.
a3d5830a 273 $url1 = new moodle_url('/lib/tests/weblib_test.php');
b33bf039 274 $this->assertSame('/lib/tests/weblib_test.php', $url1->out_as_local_url());
72b181ba
RT
275
276 // Test https url.
277 $httpswwwroot = str_replace("http://", "https://", $CFG->wwwroot);
278 $url2 = new moodle_url($httpswwwroot.'/login/profile.php');
b33bf039 279 $this->assertSame('/login/profile.php', $url2->out_as_local_url());
72b181ba
RT
280
281 // Test http url matching wwwroot.
282 $url3 = new moodle_url($CFG->wwwroot);
b33bf039 283 $this->assertSame('', $url3->out_as_local_url());
72b181ba
RT
284
285 // Test http url matching wwwroot ending with slash (/).
286 $url3 = new moodle_url($CFG->wwwroot.'/');
b33bf039 287 $this->assertSame('/', $url3->out_as_local_url());
a3d5830a
PS
288 }
289
290 /**
291 * @expectedException coding_exception
292 * @return void
293 */
b33bf039 294 public function test_out_as_local_url_error() {
4ca04fb5 295 $url2 = new moodle_url('http://www.google.com/lib/tests/weblib_test.php');
a3d5830a
PS
296 $url2->out_as_local_url();
297 }
298
72b181ba
RT
299 /**
300 * You should get error with modified url
301 *
302 * @expectedException coding_exception
303 * @return void
304 */
305 public function test_modified_url_out_as_local_url_error() {
306 global $CFG;
307
308 $modifiedurl = $CFG->wwwroot.'1';
309 $url3 = new moodle_url($modifiedurl.'/login/profile.php');
310 $url3->out_as_local_url();
311 }
312
313 /**
314 * Try get local url from external https url and you should get error
315 *
316 * @expectedException coding_exception
72b181ba
RT
317 */
318 public function test_https_out_as_local_url_error() {
319 $url4 = new moodle_url('https://www.google.com/lib/tests/weblib_test.php');
320 $url4->out_as_local_url();
321 }
322
d06ffbdf
SC
323 public function test_moodle_url_get_scheme() {
324 // Should return the scheme only.
325 $url = new moodle_url('http://www.example.org:447/my/file/is/here.txt?really=1');
326 $this->assertSame('http', $url->get_scheme());
327
328 // Should work for secure URLs.
329 $url = new moodle_url('https://www.example.org:447/my/file/is/here.txt?really=1');
330 $this->assertSame('https', $url->get_scheme());
331
332 // Should return an empty string if no scheme is specified.
333 $url = new moodle_url('www.example.org:447/my/file/is/here.txt?really=1');
334 $this->assertSame('', $url->get_scheme());
335 }
336
337 public function test_moodle_url_get_host() {
338 // Should return the host part only.
339 $url = new moodle_url('http://www.example.org:447/my/file/is/here.txt?really=1');
340 $this->assertSame('www.example.org', $url->get_host());
341 }
342
343 public function test_moodle_url_get_port() {
344 // Should return the port if one provided.
345 $url = new moodle_url('http://www.example.org:447/my/file/is/here.txt?really=1');
346 $this->assertSame(447, $url->get_port());
347
348 // Should return an empty string if port not specified.
349 $url = new moodle_url('http://www.example.org/some/path/here.php');
350 $this->assertSame('', $url->get_port());
351 }
352
a3d5830a
PS
353 public function test_clean_text() {
354 $text = "lala <applet>xx</applet>";
b33bf039
PS
355 $this->assertSame($text, clean_text($text, FORMAT_PLAIN));
356 $this->assertSame('lala xx', clean_text($text, FORMAT_MARKDOWN));
357 $this->assertSame('lala xx', clean_text($text, FORMAT_MOODLE));
358 $this->assertSame('lala xx', clean_text($text, FORMAT_HTML));
a3d5830a 359 }
f0202ae9 360
bd319d12 361 public function test_qualified_me() {
f0202ae9
PS
362 global $PAGE, $FULLME, $CFG;
363 $this->resetAfterTest();
364
365 $PAGE = new moodle_page();
366
367 $FULLME = $CFG->wwwroot.'/course/view.php?id=1&xx=yy';
b33bf039 368 $this->assertSame($FULLME, qualified_me());
f0202ae9
PS
369
370 $PAGE->set_url('/course/view.php', array('id'=>1));
b33bf039 371 $this->assertSame($CFG->wwwroot.'/course/view.php?id=1', qualified_me());
f0202ae9 372 }
837e3042
PS
373
374 public function test_null_progres_trace() {
375 $this->resetAfterTest(false);
376
377 $trace = new null_progress_trace();
837e3042
PS
378 $trace->output('do');
379 $trace->output('re', 1);
380 $trace->output('mi', 2);
381 $trace->finished();
382 $output = ob_get_contents();
837e3042 383 $this->assertSame('', $output);
4fa7fdea 384 $this->expectOutputString('');
837e3042
PS
385 }
386
387 public function test_text_progres_trace() {
388 $this->resetAfterTest(false);
389
390 $trace = new text_progress_trace();
837e3042
PS
391 $trace->output('do');
392 $trace->output('re', 1);
393 $trace->output('mi', 2);
394 $trace->finished();
4fa7fdea 395 $this->expectOutputString("do\n re\n mi\n");
837e3042
PS
396 }
397
398 public function test_html_progres_trace() {
399 $this->resetAfterTest(false);
400
401 $trace = new html_progress_trace();
837e3042
PS
402 $trace->output('do');
403 $trace->output('re', 1);
404 $trace->output('mi', 2);
405 $trace->finished();
4fa7fdea 406 $this->expectOutputString("<p>do</p>\n<p>&#160;&#160;re</p>\n<p>&#160;&#160;&#160;&#160;mi</p>\n");
837e3042
PS
407 }
408
409 public function test_html_list_progress_trace() {
410 $this->resetAfterTest(false);
411
412 $trace = new html_list_progress_trace();
837e3042
PS
413 $trace->output('do');
414 $trace->output('re', 1);
415 $trace->output('mi', 2);
416 $trace->finished();
4fa7fdea 417 $this->expectOutputString("<ul>\n<li>do<ul>\n<li>re<ul>\n<li>mi</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n");
837e3042
PS
418 }
419
420 public function test_progres_trace_buffer() {
421 $this->resetAfterTest(false);
422
423 $trace = new progress_trace_buffer(new html_progress_trace());
424 ob_start();
425 $trace->output('do');
426 $trace->output('re', 1);
427 $trace->output('mi', 2);
428 $trace->finished();
429 $output = ob_get_contents();
430 ob_end_clean();
431 $this->assertSame("<p>do</p>\n<p>&#160;&#160;re</p>\n<p>&#160;&#160;&#160;&#160;mi</p>\n", $output);
432 $this->assertSame($output, $trace->get_buffer());
433
434 $trace = new progress_trace_buffer(new html_progress_trace(), false);
837e3042
PS
435 $trace->output('do');
436 $trace->output('re', 1);
437 $trace->output('mi', 2);
438 $trace->finished();
837e3042
PS
439 $this->assertSame("<p>do</p>\n<p>&#160;&#160;re</p>\n<p>&#160;&#160;&#160;&#160;mi</p>\n", $trace->get_buffer());
440 $this->assertSame("<p>do</p>\n<p>&#160;&#160;re</p>\n<p>&#160;&#160;&#160;&#160;mi</p>\n", $trace->get_buffer());
441 $trace->reset_buffer();
442 $this->assertSame('', $trace->get_buffer());
4fa7fdea 443 $this->expectOutputString('');
837e3042 444 }
e7259ec9
PS
445
446 public function test_combined_progres_trace() {
447 $this->resetAfterTest(false);
448
449 $trace1 = new progress_trace_buffer(new html_progress_trace(), false);
450 $trace2 = new progress_trace_buffer(new text_progress_trace(), false);
451
452 $trace = new combined_progress_trace(array($trace1, $trace2));
e7259ec9
PS
453 $trace->output('do');
454 $trace->output('re', 1);
455 $trace->output('mi', 2);
456 $trace->finished();
e7259ec9
PS
457 $this->assertSame("<p>do</p>\n<p>&#160;&#160;re</p>\n<p>&#160;&#160;&#160;&#160;mi</p>\n", $trace1->get_buffer());
458 $this->assertSame("do\n re\n mi\n", $trace2->get_buffer());
4fa7fdea 459 $this->expectOutputString('');
e7259ec9 460 }
037d673e
PS
461
462 public function test_set_debugging() {
463 global $CFG;
464
465 $this->resetAfterTest();
466
467 $this->assertEquals(DEBUG_DEVELOPER, $CFG->debug);
468 $this->assertTrue($CFG->debugdeveloper);
469 $this->assertNotEmpty($CFG->debugdisplay);
470
471 set_debugging(DEBUG_DEVELOPER, true);
472 $this->assertEquals(DEBUG_DEVELOPER, $CFG->debug);
473 $this->assertTrue($CFG->debugdeveloper);
474 $this->assertNotEmpty($CFG->debugdisplay);
475
476 set_debugging(DEBUG_DEVELOPER, false);
477 $this->assertEquals(DEBUG_DEVELOPER, $CFG->debug);
478 $this->assertTrue($CFG->debugdeveloper);
479 $this->assertEmpty($CFG->debugdisplay);
480
481 set_debugging(-1);
482 $this->assertEquals(-1, $CFG->debug);
483 $this->assertTrue($CFG->debugdeveloper);
484
485 set_debugging(DEBUG_ALL);
486 $this->assertEquals(DEBUG_ALL, $CFG->debug);
487 $this->assertFalse($CFG->debugdeveloper);
488
489 set_debugging(DEBUG_NORMAL);
490 $this->assertEquals(DEBUG_NORMAL, $CFG->debug);
491 $this->assertFalse($CFG->debugdeveloper);
492
493 set_debugging(DEBUG_MINIMAL);
494 $this->assertEquals(DEBUG_MINIMAL, $CFG->debug);
495 $this->assertFalse($CFG->debugdeveloper);
496
497 set_debugging(DEBUG_NONE);
498 $this->assertEquals(DEBUG_NONE, $CFG->debug);
499 $this->assertFalse($CFG->debugdeveloper);
500 }
a3d5830a 501}