diff options
Diffstat (limited to 'tests/phpunit/unit/includes/GlobalFunctions/WfEscapeWikiTextTest.php')
-rw-r--r-- | tests/phpunit/unit/includes/GlobalFunctions/WfEscapeWikiTextTest.php | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/phpunit/unit/includes/GlobalFunctions/WfEscapeWikiTextTest.php b/tests/phpunit/unit/includes/GlobalFunctions/WfEscapeWikiTextTest.php index ed3b37fcf4ed..c9de634b8fe4 100644 --- a/tests/phpunit/unit/includes/GlobalFunctions/WfEscapeWikiTextTest.php +++ b/tests/phpunit/unit/includes/GlobalFunctions/WfEscapeWikiTextTest.php @@ -14,16 +14,18 @@ class WfEscapeWikiTextTest extends MediaWikiUnitTestCase { $old = $wgEnableMagicLinks; $wgEnableMagicLinks = []; - $actual = wfEscapeWikiText( $input ); - // Sanity check that the output can be decoded back to the input - // input as well. - $decoded = html_entity_decode( $actual, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5 ); - $this->assertEquals( $decoded, (string)$input ); - // And that the output was what we expected - $this->assertEquals( $expected, $actual ); - - // restore global - $wgEnableMagicLinks = $old; + try { + $actual = wfEscapeWikiText( $input ); + // Sanity check that the output can be decoded back to the input + // input as well. + $decoded = html_entity_decode( $actual, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5 ); + $this->assertEquals( $decoded, (string)$input ); + // And that the output was what we expected + $this->assertEquals( $expected, $actual ); + } finally { + // restore global + $wgEnableMagicLinks = $old; + } } public function provideEscape() { |