mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-13 17:56:59 +00:00
MathCoverageTest: encode test file using JSON instead of PHP serialize.
This ensures that changes to the test inputs or outputs yield readable diffs when reviewing. Change-Id: I7b4ef8102ad7fbf7c289a27db60f304a140b93a5
This commit is contained in:
parent
296c79e070
commit
7914fbea61
|
@ -89,7 +89,7 @@ class MathGenerateTests extends Maintenance
|
||||||
echo '.';
|
echo '.';
|
||||||
}
|
}
|
||||||
echo "Generated $i tests\n";
|
echo "Generated $i tests\n";
|
||||||
file_put_contents( dirname( __FILE__ ) . '/../tests/ParserTest.data', serialize( $parserTests ) );
|
file_put_contents( dirname( __FILE__ ) . '/../tests/ParserTest.json', json_encode( $parserTests, JSON_PRETTY_PRINT ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,12 +76,12 @@ class MathCoverageTest extends MediaWikiTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the test-data from the file ParserTest.data
|
* Gets the test-data from the file ParserTest.json
|
||||||
* @return array($input, $output) where $input is the test input string and $output is the rendered html5-output string
|
* @return array($input, $output) where $input is the test input string and $output is the rendered html5-output string
|
||||||
*/
|
*/
|
||||||
public function testProvider()
|
public function testProvider()
|
||||||
{
|
{
|
||||||
return unserialize( file_get_contents( dirname( __FILE__ ) . '/ParserTest.data' ) );
|
return json_decode( file_get_contents( dirname( __FILE__ ) . '/ParserTest.json' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
private function normalize( $input ) {
|
private function normalize( $input ) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
1798
tests/ParserTest.json
Normal file
1798
tests/ParserTest.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue