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:
C. Scott Ananian 2014-07-29 11:56:26 -04:00 committed by Physikerwelt
parent 296c79e070
commit 7914fbea61
4 changed files with 1801 additions and 76 deletions

View file

@ -89,7 +89,7 @@ class MathGenerateTests extends Maintenance
echo '.';
}
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 ) );
}
}

View file

@ -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
*/
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 ) {

File diff suppressed because one or more lines are too long

1798
tests/ParserTest.json Normal file

File diff suppressed because it is too large Load diff