Go to the documentation of this file.
8 protected function setUp() {
27 'allowedHtmlElements' =>
null,
28 'tidyCompat' => $useTidy,
29 'allowComments' =>
true,
36 $this->assertEquals( $expected,
$output, $description );
41 $json = json_decode( file_get_contents(
42 __DIR__ .
'/html5lib-tests.json'
49 (?i:<!DOCTYPE\ html>)?
50 <html><head></head><body>
54 foreach ( $json
as $filename => $cases ) {
55 foreach ( $cases
as $case ) {
56 $html = $case[
'document'][
'html'];
57 if ( !preg_match( $okre,
$html ) ) {
68 $html = $case[
'document'][
'noQuirksBodyHtml'];
70 $html = str_replace(
'foreignObject',
'foreignobject',
$html );
72 $html = str_replace(
'definitionURL',
'definitionurl',
$html );
75 isset( $case[
'document'][
'props'][
'comment'] ) &&
76 preg_match(
',<!--[^>]*<,',
$html )
82 if ( strpos( $case[
'data'],
'<![CDATA[' ) !==
false ) {
87 stripos( $case[
'data'],
'<!DOCTYPE' ) !==
false &&
88 stripos( $case[
'data'],
'<!DOCTYPE html>' ) ===
false
93 $literalre =
"~ <rdar: | < /? (
94 html | head | body | frame | frameset | plaintext
96 if ( preg_match( $literalre, $case[
'data'] ) ) {
102 isset( $case[
'document'][
'props'][
'tags'][
'iframe'] ) ||
103 isset( $case[
'document'][
'props'][
'tags'][
'noembed'] ) ||
104 isset( $case[
'document'][
'props'][
'tags'][
'noscript'] ) ||
105 isset( $case[
'document'][
'props'][
'tags'][
'script'] ) ||
106 isset( $case[
'document'][
'props'][
'tags'][
'svg script'] ) ||
107 isset( $case[
'document'][
'props'][
'tags'][
'svg title'] ) ||
108 isset( $case[
'document'][
'props'][
'tags'][
'title'] ) ||
109 isset( $case[
'document'][
'props'][
'tags'][
'xmp'] )
116 $filename ===
'entities01.dat' ||
117 $filename ===
'entities02.dat' ||
118 preg_match(
'/&([a-z]+|#x[0-9A-F]+);/i', $case[
'data'] ) ||
119 preg_match(
'/^(&|&#|&#X|&#x|-|&x-test|&)$/', $case[
'data'] )
125 isset( $case[
'document'][
'props'][
'tagWithLt'] ) ||
126 isset( $case[
'document'][
'props'][
'attrWithFunnyChar'] ) ||
127 preg_match(
':^(</b test|<di|<foo bar=qux/>)$:', $case[
'data'] ) ||
128 preg_match(
':</p<p>:', $case[
'data'] ) ||
129 preg_match(
':<b &=&>|<p/x/y/z>:', $case[
'data'] )
137 preg_match(
':encoding=" text/html "|type=" hidden":', $case[
'data'] )
143 if ( $filename ===
'plain-text-unsafe.dat' ) {
147 $data = preg_replace(
148 '~<!DOCTYPE html>~i',
'', $case[
'data']
151 $filename, #
use better description?
154 false # strict HTML5 compat
mode, no tidy
159 # Some additional tests for mediawiki-specific features
161 'Round-trip serialization for <pre>/<listing>/<textarea>',
162 "<pre>\n\na</pre><listing>\n\nb</listing><textarea>\n\nc</textarea>",
163 "<pre>\n\na</pre><listing>\n\nb</listing><textarea>\n\nc</textarea>",
164 true #
use the tidy-compatible
mode
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
setUp()
Anything that needs to happen before your tests should go here.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place $output
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
if(is_array( $mode)) switch( $mode) $input
if write to the Free Software Franklin Fifth MA USA Also add information on how to contact you by electronic and paper mail If the program is make it output a short notice like this when it starts in an interactive mode
testBalancer( $description, $input, $expected, $useTidy)
MediaWiki\Tidy\Balancer MediaWiki\Tidy\BalanceSets MediaWiki\Tidy\BalanceElement MediaWiki\Tidy\Balan...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static provideBalancerTests()