42 foreach ( $reader->requirements as
$type => $reqsOfType ) {
43 foreach ( $reqsOfType as $name => $unused ) {
53 'tests' => $reader->tests,
54 'articles' => $reader->articles
60 $this->fh =
fopen( $this->file,
"rt" );
63 throw new MWException(
"Couldn't open file '$file'\n" );
67 'runDisabled' =>
false,
70 $this->runDisabled =
$options[
'runDisabled'];
79 [
'html/php',
'html/*',
'html',
'result' ],
false );
81 $tidySection = $this->
checkSection( [
'html/php+tidy',
'html+tidy' ],
false );
84 $data =
array_map(
'ParserTestRunner::chomp', $this->sectionData );
93 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
94 "lacks input section" );
97 if (
preg_match(
'/\\bdisabled\\b/i',
$data[
'options'] ) && !$this->runDisabled ) {
102 if ( $tidySection ===
false && $nonTidySection ===
false ) {
107 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
108 "lacks result section" );
118 'test' =>
$data[
'test'],
119 'desc' =>
$data[
'test'],
121 'options' =>
$data[
'options'],
122 'config' =>
$data[
'config'],
123 'line' => $this->sectionLineNum[
'test'],
127 if ( $nonTidySection !==
false ) {
134 if ( $tidySection !==
false ) {
137 'desc' =>
$data[
'test'] .
' (with tidy)',
140 'options' =>
$data[
'options'] .
' tidy',
144 }
elseif ( $tidySection !==
false ) {
149 'options' =>
$data[
'options'] .
' tidy'
152 throw new MWException(
"Test at {$this->file}:{$this->sectionLineNum['test']} " .
153 "lacks result section" );
158 while ( (
$line =
fgets( $this->fh ) ) !==
false ) {
165 if ( $this->section ==
'endarticle' ) {
171 $this->sectionData[
'text'], $this->lineNum );
178 if ( $this->section ==
'endhooks' ) {
181 foreach ( explode(
"\n", $this->sectionData[
'hooks'] ) as
$line ) {
194 if ( $this->section ==
'endfunctionhooks' ) {
197 foreach ( explode(
"\n", $this->sectionData[
'functionhooks'] ) as
$line ) {
210 if ( $this->section ==
'endtransparenthooks' ) {
213 foreach ( explode(
"\n", $this->sectionData[
'transparenthooks'] ) as
$line ) {
226 if ( $this->section ==
'end' ) {
233 if (
isset( $this->sectionData[$this->section] ) ) {
234 throw new MWException(
"duplicate section '$this->section' "
235 .
"at line {$this->lineNum} of $this->file\n" );
244 if ( $this->section ) {
254 $this->sectionLineNum = [];
255 $this->sectionData = [];
256 $this->section =
null;
273 if (
is_null( $this->section ) ) {
274 throw new MWException( __METHOD__ .
" can not verify a null section!\n" );
280 throw new MWException( __METHOD__ .
" can not verify zero sections!\n" );
293 "'%s' without '%s' at line %s of %s\n",
302 "'%s' with unexpected tokens '%s' at line %s of %s\n",
314 $this->articles[] = [
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
static chomp( $s)
Remove last character if it is a newline.
addArticle( $name, $text, $line)
clearSection()
Clear section name and its data.
__construct( $file, $options)
$sectionData
String|null: current test section being analyzed.
checkSection( $tokens, $fatal=true)
Verify the current section data has some value for the given token name(s) (first parameter).
addRequirement( $type, $name)
static read( $file, array $options=[])
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 & $options
Allows to change the fields on the form that will be generated $name
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
if(is_array($mode)) switch( $mode) $input