X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fparser%2FParserOptionsTest.php;h=e2ed1d57e07c905c2eb42911a41b25deae7059c6;hb=c1c0d243522d477799bb5ca325a100fa6a86a7fd;hp=ad899bd7a9c6b869926a519a667ea9931646c972;hpb=64b83bdb3afd0ee4f8fc1893a865409c198e601e;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/parser/ParserOptionsTest.php b/tests/phpunit/includes/parser/ParserOptionsTest.php index ad899bd7a9..e2ed1d57e0 100644 --- a/tests/phpunit/includes/parser/ParserOptionsTest.php +++ b/tests/phpunit/includes/parser/ParserOptionsTest.php @@ -3,6 +3,9 @@ use Wikimedia\TestingAccessWrapper; use Wikimedia\ScopedCallback; +/** + * @covers ParserOptions + */ class ParserOptionsTest extends MediaWikiTestCase { private static function clearCache() { @@ -18,7 +21,6 @@ class ParserOptionsTest extends MediaWikiTestCase { 'stubthreshold' => true, 'printable' => true, 'userlang' => true, - 'wrapclass' => true, ]; } @@ -59,11 +61,14 @@ class ParserOptionsTest extends MediaWikiTestCase { 'No overrides' => [ true, [] ], 'In-key options are ok' => [ true, [ 'thumbsize' => 1e100, - 'wrapclass' => false, + 'printable' => false, ] ], 'Non-in-key options are not ok' => [ false, [ 'removeComments' => false, ] ], + 'Non-in-key options are not ok (2)' => [ false, [ + 'wrapclass' => 'foobar', + ] ], 'Canonical override, not default (1)' => [ true, [ 'tidy' => true, ] ], @@ -99,7 +104,7 @@ class ParserOptionsTest extends MediaWikiTestCase { } public static function provideOptionsHash() { - $used = [ 'wrapclass', 'printable' ]; + $used = [ 'thumbsize', 'printable' ]; $classWrapper = TestingAccessWrapper::newFromClass( ParserOptions::class ); $classWrapper->getDefaults(); @@ -113,9 +118,9 @@ class ParserOptionsTest extends MediaWikiTestCase { 'Canonical options, used some options' => [ $used, 'canonical', [] ], 'Used some options, non-default values' => [ $used, - 'printable=1!wrapclass=foobar', + 'printable=1!thumbsize=200', [ - 'wrapclass' => 'foobar', + 'thumbsize' => 200, 'printable' => true, ] ], @@ -136,23 +141,6 @@ class ParserOptionsTest extends MediaWikiTestCase { $confstr .= '!onPageRenderingHash'; } - // Test weird historical behavior is still weird - public function testOptionsHashEditSection() { - $popt = ParserOptions::newCanonical(); - $popt->registerWatcher( function ( $name ) { - $this->assertNotEquals( 'editsection', $name ); - } ); - - $this->assertTrue( $popt->getEditSection() ); - $this->assertSame( 'canonical', $popt->optionsHash( [] ) ); - $this->assertSame( 'canonical', $popt->optionsHash( [ 'editsection' ] ) ); - - $popt->setEditSection( false ); - $this->assertFalse( $popt->getEditSection() ); - $this->assertSame( 'canonical', $popt->optionsHash( [] ) ); - $this->assertSame( 'editsection=0', $popt->optionsHash( [ 'editsection' ] ) ); - } - /** * @expectedException InvalidArgumentException * @expectedExceptionMessage Unknown parser option bogus @@ -210,7 +198,7 @@ class ParserOptionsTest extends MediaWikiTestCase { $wgHooks['ParserOptionsRegister'] = []; $this->assertSame( [ 'dateformat', 'numberheadings', 'printable', 'stubthreshold', - 'thumbsize', 'userlang', 'wrapclass', + 'thumbsize', 'userlang' ], ParserOptions::allCacheVaryingOptions() ); self::clearCache(); @@ -228,7 +216,7 @@ class ParserOptionsTest extends MediaWikiTestCase { }; $this->assertSame( [ 'dateformat', 'foo', 'numberheadings', 'printable', 'stubthreshold', - 'thumbsize', 'userlang', 'wrapclass', + 'thumbsize', 'userlang' ], ParserOptions::allCacheVaryingOptions() ); }