3 class HtmlTest
extends MediaWikiTestCase
{
4 private $restoreWarnings;
6 protected function setUp() {
10 'wgUseMediaWikiUIEverywhere' => false,
13 $contLangObj = Language
::factory( 'en' );
15 // Hardcode namespaces during test runs,
16 // so that html output based on existing namespaces
17 // can be properly evaluated.
18 $contLangObj->setNamespaces( [
30 9 => 'MediaWiki_talk',
32 11 => 'Template_talk',
34 15 => 'Category_talk',
38 $this->setContentLang( $contLangObj );
40 $userLangObj = Language
::factory( 'es' );
41 $userLangObj->setNamespaces( [
47 3 => "Usuario discusión",
49 5 => "Wiki discusión",
51 7 => "Archivo discusión",
53 9 => "MediaWiki discusión",
55 11 => "Plantilla discusión",
57 13 => "Ayuda discusión",
59 15 => "Categoría discusión",
60 100 => "Personalizado",
61 101 => "Personalizado discusión",
63 $this->setUserLang( $userLangObj );
65 $this->restoreWarnings
= false;
68 protected function tearDown() {
69 if ( $this->restoreWarnings
) {
70 $this->restoreWarnings
= false;
71 Wikimedia\restoreWarnings
();
77 * @covers Html::element
78 * @covers Html::rawElement
79 * @covers Html::openElement
80 * @covers Html::closeElement
82 public function testElementBasics() {
85 Html
::element( 'img', null, '' ),
86 'Self-closing tag for short-tag elements'
90 '<element></element>',
91 Html
::element( 'element', null, null ),
92 'Close tag for empty element (null, null)'
96 '<element></element>',
97 Html
::element( 'element', [], '' ),
98 'Close tag for empty element (array, string)'
102 public function dataXmlMimeType() {
104 // ( $mimetype, $isXmlMimeType )
105 # HTML is not an XML MimeType
106 [ 'text/html', false ],
107 # XML is an XML MimeType
108 [ 'text/xml', true ],
109 [ 'application/xml', true ],
110 # XHTML is an XML MimeType
111 [ 'application/xhtml+xml', true ],
112 # Make sure other +xml MimeTypes are supported
113 # SVG is another random MimeType even though we don't use it
114 [ 'image/svg+xml', true ],
115 # Complete random other MimeTypes are not XML
116 [ 'text/plain', false ],
121 * @dataProvider dataXmlMimeType
122 * @covers Html::isXmlMimeType
124 public function testXmlMimeType( $mimetype, $isXmlMimeType ) {
125 $this->assertEquals( $isXmlMimeType, Html
::isXmlMimeType( $mimetype ) );
129 * @covers Html::expandAttributes
131 public function testExpandAttributesSkipsNullAndFalse() {
134 Html
::expandAttributes( [ 'foo' => null ] ),
135 'skip keys with null value'
138 Html
::expandAttributes( [ 'foo' => false ] ),
139 'skip keys with false value'
143 Html
::expandAttributes( [ 'foo' => '' ] ),
144 'keep keys with an empty string'
149 * @covers Html::expandAttributes
151 public function testExpandAttributesForBooleans() {
154 Html
::expandAttributes( [ 'selected' => false ] ),
155 'Boolean attributes do not generates output when value is false'
159 Html
::expandAttributes( [ 'selected' => null ] ),
160 'Boolean attributes do not generates output when value is null'
165 Html
::expandAttributes( [ 'selected' => true ] ),
166 'Boolean attributes have no value when value is true'
170 Html
::expandAttributes( [ 'selected' ] ),
171 'Boolean attributes have no value when value is true (passed as numerical array)'
176 * @covers Html::expandAttributes
178 public function testExpandAttributesForNumbers() {
181 Html
::expandAttributes( [ 'value' => 1 ] ),
182 'Integer value is cast to a string'
186 Html
::expandAttributes( [ 'value' => 1.1 ] ),
187 'Float value is cast to a string'
192 * @covers Html::expandAttributes
194 public function testExpandAttributesForObjects() {
196 ' value="stringValue"',
197 Html
::expandAttributes( [ 'value' => new HtmlTestValue() ] ),
198 'Object value is converted to a string'
203 * Test for Html::expandAttributes()
204 * Please note it output a string prefixed with a space!
205 * @covers Html::expandAttributes
207 public function testExpandAttributesVariousExpansions() {
211 Html
::expandAttributes( [ 'empty_string' => '' ] ),
212 'Empty string is always quoted'
216 Html
::expandAttributes( [ 'key' => 'value' ] ),
217 'Simple string value needs no quotes'
221 Html
::expandAttributes( [ 'one' => 1 ] ),
222 'Number 1 value needs no quotes'
226 Html
::expandAttributes( [ 'zero' => 0 ] ),
227 'Number 0 value needs no quotes'
232 * Html::expandAttributes has special features for HTML
233 * attributes that use space separated lists and also
234 * allows arrays to be used as values.
235 * @covers Html::expandAttributes
237 public function testExpandAttributesListValueAttributes() {
240 ' class="redundant spaces here"',
241 Html
::expandAttributes( [ 'class' => ' redundant spaces here ' ] ),
242 'Normalization should strip redundant spaces'
246 Html
::expandAttributes( [ 'class' => 'foo bar foo bar bar' ] ),
247 'Normalization should remove duplicates in string-lists'
249 # ## "EMPTY" ARRAY VALUES
252 Html
::expandAttributes( [ 'class' => [] ] ),
253 'Value with an empty array'
257 Html
::expandAttributes( [ 'class' => [ null, '', ' ', ' ' ] ] ),
258 'Array with null, empty string and spaces'
260 # ## NON-EMPTY ARRAY VALUES
263 Html
::expandAttributes( [ 'class' => [
270 'Normalization should remove duplicates in the array'
274 Html
::expandAttributes( [ 'class' => [
280 'Normalization should remove duplicates in string-lists in the array'
285 * Test feature added by r96188, let pass attributes values as
286 * a PHP array. Restricted to class,rel, accesskey.
287 * @covers Html::expandAttributes
289 public function testExpandAttributesSpaceSeparatedAttributesWithBoolean() {
291 ' class="booltrue one"',
292 Html
::expandAttributes( [ 'class' => [
296 # Method use isset() internally, make sure we do discard
297 # attributes values which have been assigned well known values
299 'boolfalse' => false,
307 * How do we handle duplicate keys in HTML attributes expansion?
308 * We could pass a "class" the values: 'GREEN' and array( 'GREEN' => false )
309 * The latter will take precedence.
311 * Feature added by r96188
312 * @covers Html::expandAttributes
314 public function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() {
317 Html
::expandAttributes( [ 'class' => [
326 * @covers Html::expandAttributes
327 * @expectedException MWException
329 public function testExpandAttributes_ArrayOnNonListValueAttribute_ThrowsException() {
330 // Real-life test case found in the Popups extension (see Gerrit cf0fd64),
331 // when used with an outdated BetaFeatures extension (see Gerrit deda1e7)
332 Html
::expandAttributes( [
341 * @covers Html::namespaceSelector
342 * @covers Html::namespaceSelectorOptions
344 public function testNamespaceSelector() {
346 '<select id="namespace" name="namespace">' . "\n" .
347 '<option value="0">(Principal)</option>' . "\n" .
348 '<option value="1">Talk</option>' . "\n" .
349 '<option value="2">User</option>' . "\n" .
350 '<option value="3">User talk</option>' . "\n" .
351 '<option value="4">MyWiki</option>' . "\n" .
352 '<option value="5">MyWiki Talk</option>' . "\n" .
353 '<option value="6">File</option>' . "\n" .
354 '<option value="7">File talk</option>' . "\n" .
355 '<option value="8">MediaWiki</option>' . "\n" .
356 '<option value="9">MediaWiki talk</option>' . "\n" .
357 '<option value="10">Template</option>' . "\n" .
358 '<option value="11">Template talk</option>' . "\n" .
359 '<option value="14">Category</option>' . "\n" .
360 '<option value="15">Category talk</option>' . "\n" .
361 '<option value="100">Custom</option>' . "\n" .
362 '<option value="101">Custom talk</option>' . "\n" .
364 Html
::namespaceSelector(),
365 'Basic namespace selector without custom options'
369 '<label for="mw-test-namespace">Select a namespace:</label>' . "\u{00A0}" .
370 '<select id="mw-test-namespace" name="wpNamespace">' . "\n" .
371 '<option value="all">todos</option>' . "\n" .
372 '<option value="0">(Principal)</option>' . "\n" .
373 '<option value="1">Talk</option>' . "\n" .
374 '<option value="2" selected="">User</option>' . "\n" .
375 '<option value="3">User talk</option>' . "\n" .
376 '<option value="4">MyWiki</option>' . "\n" .
377 '<option value="5">MyWiki Talk</option>' . "\n" .
378 '<option value="6">File</option>' . "\n" .
379 '<option value="7">File talk</option>' . "\n" .
380 '<option value="8">MediaWiki</option>' . "\n" .
381 '<option value="9">MediaWiki talk</option>' . "\n" .
382 '<option value="10">Template</option>' . "\n" .
383 '<option value="11">Template talk</option>' . "\n" .
384 '<option value="14">Category</option>' . "\n" .
385 '<option value="15">Category talk</option>' . "\n" .
386 '<option value="100">Custom</option>' . "\n" .
387 '<option value="101">Custom talk</option>' . "\n" .
389 Html
::namespaceSelector(
390 [ 'selected' => '2', 'all' => 'all', 'label' => 'Select a namespace:' ],
391 [ 'name' => 'wpNamespace', 'id' => 'mw-test-namespace' ]
393 'Basic namespace selector with custom values'
397 '<label for="namespace">Select a namespace:</label>' . "\u{00A0}" .
398 '<select id="namespace" name="namespace">' . "\n" .
399 '<option value="0">(Principal)</option>' . "\n" .
400 '<option value="1">Talk</option>' . "\n" .
401 '<option value="2">User</option>' . "\n" .
402 '<option value="3">User talk</option>' . "\n" .
403 '<option value="4">MyWiki</option>' . "\n" .
404 '<option value="5">MyWiki Talk</option>' . "\n" .
405 '<option value="6">File</option>' . "\n" .
406 '<option value="7">File talk</option>' . "\n" .
407 '<option value="8">MediaWiki</option>' . "\n" .
408 '<option value="9">MediaWiki talk</option>' . "\n" .
409 '<option value="10">Template</option>' . "\n" .
410 '<option value="11">Template talk</option>' . "\n" .
411 '<option value="14">Category</option>' . "\n" .
412 '<option value="15">Category talk</option>' . "\n" .
413 '<option value="100">Custom</option>' . "\n" .
414 '<option value="101">Custom talk</option>' . "\n" .
416 Html
::namespaceSelector(
417 [ 'label' => 'Select a namespace:' ]
419 'Basic namespace selector with a custom label but no id attribtue for the <select>'
423 '<select id="namespace" name="namespace">' . "\n" .
424 '<option value="0">(Principal)</option>' . "\n" .
425 '<option value="1">Discusión</option>' . "\n" .
426 '<option value="2">Usuario</option>' . "\n" .
427 '<option value="3">Usuario discusión</option>' . "\n" .
428 '<option value="4">Wiki</option>' . "\n" .
429 '<option value="5">Wiki discusión</option>' . "\n" .
430 '<option value="6">Archivo</option>' . "\n" .
431 '<option value="7">Archivo discusión</option>' . "\n" .
432 '<option value="8">MediaWiki</option>' . "\n" .
433 '<option value="9">MediaWiki discusión</option>' . "\n" .
434 '<option value="10">Plantilla</option>' . "\n" .
435 '<option value="11">Plantilla discusión</option>' . "\n" .
436 '<option value="12">Ayuda</option>' . "\n" .
437 '<option value="13">Ayuda discusión</option>' . "\n" .
438 '<option value="14">Categoría</option>' . "\n" .
439 '<option value="15">Categoría discusión</option>' . "\n" .
440 '<option value="100">Personalizado</option>' . "\n" .
441 '<option value="101">Personalizado discusión</option>' . "\n" .
443 Html
::namespaceSelector(
444 [ 'in-user-lang' => true ]
446 'Basic namespace selector in user language'
451 * @covers Html::namespaceSelector
453 public function testCanFilterOutNamespaces() {
455 '<select id="namespace" name="namespace">' . "\n" .
456 '<option value="2">User</option>' . "\n" .
457 '<option value="4">MyWiki</option>' . "\n" .
458 '<option value="5">MyWiki Talk</option>' . "\n" .
459 '<option value="6">File</option>' . "\n" .
460 '<option value="7">File talk</option>' . "\n" .
461 '<option value="8">MediaWiki</option>' . "\n" .
462 '<option value="9">MediaWiki talk</option>' . "\n" .
463 '<option value="10">Template</option>' . "\n" .
464 '<option value="11">Template talk</option>' . "\n" .
465 '<option value="14">Category</option>' . "\n" .
466 '<option value="15">Category talk</option>' . "\n" .
468 Html
::namespaceSelector(
469 [ 'exclude' => [ 0, 1, 3, 100, 101 ] ]
471 'Namespace selector namespace filtering.'
476 * @covers Html::namespaceSelector
478 public function testCanDisableANamespaces() {
480 '<select id="namespace" name="namespace">' . "\n" .
481 '<option disabled="" value="0">(Principal)</option>' . "\n" .
482 '<option disabled="" value="1">Talk</option>' . "\n" .
483 '<option disabled="" value="2">User</option>' . "\n" .
484 '<option disabled="" value="3">User talk</option>' . "\n" .
485 '<option disabled="" value="4">MyWiki</option>' . "\n" .
486 '<option value="5">MyWiki Talk</option>' . "\n" .
487 '<option value="6">File</option>' . "\n" .
488 '<option value="7">File talk</option>' . "\n" .
489 '<option value="8">MediaWiki</option>' . "\n" .
490 '<option value="9">MediaWiki talk</option>' . "\n" .
491 '<option value="10">Template</option>' . "\n" .
492 '<option value="11">Template talk</option>' . "\n" .
493 '<option value="14">Category</option>' . "\n" .
494 '<option value="15">Category talk</option>' . "\n" .
495 '<option value="100">Custom</option>' . "\n" .
496 '<option value="101">Custom talk</option>' . "\n" .
498 Html
::namespaceSelector( [
499 'disable' => [ 0, 1, 2, 3, 4 ]
501 'Namespace selector namespace disabling'
506 * @dataProvider provideHtml5InputTypes
507 * @covers Html::element
509 public function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
511 '<input type="' . $HTML5InputType . '"/>',
512 Html
::element( 'input', [ 'type' => $HTML5InputType ] ),
513 'In HTML5, Html::element() should accept type="' . $HTML5InputType . '"'
518 * @covers Html::warningBox
519 * @covers Html::messageBox
521 public function testWarningBox() {
523 Html
::warningBox( 'warn' ),
524 '<div class="warningbox">warn</div>'
529 * @covers Html::errorBox
530 * @covers Html::messageBox
532 public function testErrorBox() {
534 Html
::errorBox( 'err' ),
535 '<div class="errorbox">err</div>'
538 Html
::errorBox( 'err', 'heading' ),
539 '<div class="errorbox"><h2>heading</h2>err</div>'
542 Html
::errorBox( 'err', '0' ),
543 '<div class="errorbox"><h2>0</h2>err</div>'
548 * @covers Html::successBox
549 * @covers Html::messageBox
551 public function testSuccessBox() {
553 Html
::successBox( 'great' ),
554 '<div class="successbox">great</div>'
557 Html
::successBox( '<script>beware no escaping!</script>' ),
558 '<div class="successbox"><script>beware no escaping!</script></div>'
563 * List of input element types values introduced by HTML5
564 * Full list at https://www.w3.org/TR/html-markup/input.html
566 public static function provideHtml5InputTypes() {
583 foreach ( $types as $type ) {
584 $cases[] = [ $type ];
591 * Test out Html::element drops or enforces default value
592 * @covers Html::dropDefaults
593 * @dataProvider provideElementsWithAttributesHavingDefaultValues
595 public function testDropDefaults( $expected, $element, $attribs, $message = '' ) {
596 $this->assertEquals( $expected, Html
::element( $element, $attribs ), $message );
599 public static function provideElementsWithAttributesHavingDefaultValues() {
600 # Use cases in a concise format:
601 # <expected>, <element name>, <array of attributes> [, <message>]
602 # Will be mapped to Html::element()
605 # ## Generic cases, match $attribDefault static array
606 $cases[] = [ '<area/>',
607 'area', [ 'shape' => 'rect' ]
610 $cases[] = [ '<button type="submit"></button>',
611 'button', [ 'formaction' => 'GET' ]
613 $cases[] = [ '<button type="submit"></button>',
614 'button', [ 'formenctype' => 'application/x-www-form-urlencoded' ]
617 $cases[] = [ '<canvas></canvas>',
618 'canvas', [ 'height' => '150' ]
620 $cases[] = [ '<canvas></canvas>',
621 'canvas', [ 'width' => '300' ]
623 # Also check with numeric values
624 $cases[] = [ '<canvas></canvas>',
625 'canvas', [ 'height' => 150 ]
627 $cases[] = [ '<canvas></canvas>',
628 'canvas', [ 'width' => 300 ]
631 $cases[] = [ '<form></form>',
632 'form', [ 'action' => 'GET' ]
634 $cases[] = [ '<form></form>',
635 'form', [ 'autocomplete' => 'on' ]
637 $cases[] = [ '<form></form>',
638 'form', [ 'enctype' => 'application/x-www-form-urlencoded' ]
641 $cases[] = [ '<input/>',
642 'input', [ 'formaction' => 'GET' ]
644 $cases[] = [ '<input/>',
645 'input', [ 'type' => 'text' ]
648 $cases[] = [ '<keygen/>',
649 'keygen', [ 'keytype' => 'rsa' ]
652 $cases[] = [ '<link/>',
653 'link', [ 'media' => 'all' ]
656 $cases[] = [ '<menu></menu>',
657 'menu', [ 'type' => 'list' ]
660 $cases[] = [ '<script></script>',
661 'script', [ 'type' => 'text/javascript' ]
664 $cases[] = [ '<style></style>',
665 'style', [ 'media' => 'all' ]
667 $cases[] = [ '<style></style>',
668 'style', [ 'type' => 'text/css' ]
671 $cases[] = [ '<textarea></textarea>',
672 'textarea', [ 'wrap' => 'soft' ]
677 # <link type="text/css">
678 $cases[] = [ '<link/>',
679 'link', [ 'type' => 'text/css' ]
682 # <input> specific handling
683 $cases[] = [ '<input type="checkbox"/>',
684 'input', [ 'type' => 'checkbox', 'value' => 'on' ],
685 'Default value "on" is stripped of checkboxes',
687 $cases[] = [ '<input type="radio"/>',
688 'input', [ 'type' => 'radio', 'value' => 'on' ],
689 'Default value "on" is stripped of radio buttons',
691 $cases[] = [ '<input type="submit" value="Submit"/>',
692 'input', [ 'type' => 'submit', 'value' => 'Submit' ],
693 'Default value "Submit" is kept on submit buttons (for possible l10n issues)',
695 $cases[] = [ '<input type="color"/>',
696 'input', [ 'type' => 'color', 'value' => '' ],
698 $cases[] = [ '<input type="range"/>',
699 'input', [ 'type' => 'range', 'value' => '' ],
702 # <button> specific handling
703 # see remarks on https://msdn.microsoft.com/library/ms535211(v=vs.85).aspx
704 $cases[] = [ '<button type="submit"></button>',
705 'button', [ 'type' => 'submit' ],
706 'According to standard the default type is "submit". '
707 . 'Depending on compatibility mode IE might use "button", instead.',
710 # <select> specific handling
711 $cases[] = [ '<select multiple=""></select>',
712 'select', [ 'size' => '4', 'multiple' => true ],
714 # .. with numeric value
715 $cases[] = [ '<select multiple=""></select>',
716 'select', [ 'size' => 4, 'multiple' => true ],
718 $cases[] = [ '<select></select>',
719 'select', [ 'size' => '1', 'multiple' => false ],
721 # .. with numeric value
722 $cases[] = [ '<select></select>',
723 'select', [ 'size' => 1, 'multiple' => false ],
726 # Passing an array as value
727 $cases[] = [ '<a class="css-class-one css-class-two"></a>',
728 'a', [ 'class' => [ 'css-class-one', 'css-class-two' ] ],
729 "dropDefaults accepts values given as an array"
732 # FIXME: doDropDefault should remove defaults given in an array
733 # Expected should be '<a></a>'
734 $cases[] = [ '<a class=""></a>',
735 'a', [ 'class' => [ '', '' ] ],
736 "dropDefaults accepts values given as an array"
739 # Craft the Html elements
741 foreach ( $cases as $case ) {
753 * @covers Html::input
755 public function testWrapperInput() {
757 '<input type="radio" value="testval" name="testname"/>',
758 Html
::input( 'testname', 'testval', 'radio' ),
759 'Input wrapper with type and value.'
762 '<input name="testname"/>',
763 Html
::input( 'testname' ),
764 'Input wrapper with all default values.'
769 * @covers Html::check
771 public function testWrapperCheck() {
773 '<input type="checkbox" value="1" name="testname"/>',
774 Html
::check( 'testname' ),
775 'Checkbox wrapper unchecked.'
778 '<input checked="" type="checkbox" value="1" name="testname"/>',
779 Html
::check( 'testname', true ),
780 'Checkbox wrapper checked.'
783 '<input type="checkbox" value="testval" name="testname"/>',
784 Html
::check( 'testname', false, [ 'value' => 'testval' ] ),
785 'Checkbox wrapper with a value override.'
790 * @covers Html::radio
792 public function testWrapperRadio() {
794 '<input type="radio" value="1" name="testname"/>',
795 Html
::radio( 'testname' ),
796 'Radio wrapper unchecked.'
799 '<input checked="" type="radio" value="1" name="testname"/>',
800 Html
::radio( 'testname', true ),
801 'Radio wrapper checked.'
804 '<input type="radio" value="testval" name="testname"/>',
805 Html
::radio( 'testname', false, [ 'value' => 'testval' ] ),
806 'Radio wrapper with a value override.'
811 * @covers Html::label
813 public function testWrapperLabel() {
815 '<label for="testid">testlabel</label>',
816 Html
::label( 'testlabel', 'testid' ),
821 public static function provideSrcSetImages() {
823 [ [], '', 'when there are no images, return empty string' ],
825 [ '1x' => '1x.png', '1.5x' => '1_5x.png', '2x' => '2x.png' ],
826 '1x.png 1x, 1_5x.png 1.5x, 2x.png 2x',
827 'pixel depth keys may include a trailing "x"'
830 [ '1' => '1x.png', '1.5' => '1_5x.png', '2' => '2x.png' ],
831 '1x.png 1x, 1_5x.png 1.5x, 2x.png 2x',
832 'pixel depth keys may omit a trailing "x"'
835 [ '1' => 'small.png', '1.5' => 'large.png', '2' => 'large.png' ],
836 'small.png 1x, large.png 1.5x',
837 'omit larger duplicates'
840 [ '1' => 'small.png', '2' => 'large.png', '1.5' => 'large.png' ],
841 'small.png 1x, large.png 1.5x',
842 'omit larger duplicates in irregular order'
848 * @dataProvider provideSrcSetImages
849 * @covers Html::srcSet
851 public function testSrcSet( $images, $expected, $message ) {
852 $this->assertEquals( Html
::srcSet( $images ), $expected, $message );
855 public static function provideInlineScript() {
862 'EXAMPLE.label("foo");',
863 '<script>EXAMPLE.label("foo");</script>'
866 'EXAMPLE.is(a && b);',
867 '<script>EXAMPLE.is(a && b);</script>'
870 'EXAMPLE.label("<a>");',
871 '<script>EXAMPLE.label("<a>");</script>'
873 'Script closing string (lower)' => [
874 'EXAMPLE.label("</script>");',
875 '<script>/* ERROR: Invalid script */</script>',
878 'Script closing with non-standard attributes (mixed)' => [
879 'EXAMPLE.label("</SCriPT and STyLE>");',
880 '<script>/* ERROR: Invalid script */</script>',
883 'HTML-comment-open and script-open' => [
884 // In HTML, <script> contents aren't just plain CDATA until </script>,
885 // there are levels of escaping modes, and the below sequence puts an
886 // HTML parser in a state where </script> would *not* close the script.
887 // https://html.spec.whatwg.org/multipage/parsing.html#script-data-double-escape-end-state
888 'var a = "<!--<script>";',
889 '<script>/* ERROR: Invalid script */</script>',
896 * @dataProvider provideInlineScript
897 * @covers Html::inlineScript
899 public function testInlineScript( $code, $expected, $error = false ) {
901 Wikimedia\
suppressWarnings();
902 $this->restoreWarnings
= true;
904 $this->assertSame( Html
::inlineScript( $code ), $expected );
908 class HtmlTestValue
{
909 function __toString() {
910 return 'stringValue';