From 14f74d141ab5580688bfd46d2f74c026e43ed967 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 1 Apr 2015 06:11:44 +0200 Subject: Update to MediaWiki 1.24.2 --- tests/phpunit/tests/MediaWikiTestCaseTest.php | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/phpunit/tests/MediaWikiTestCaseTest.php (limited to 'tests/phpunit/tests') diff --git a/tests/phpunit/tests/MediaWikiTestCaseTest.php b/tests/phpunit/tests/MediaWikiTestCaseTest.php new file mode 100644 index 00000000..2846fde0 --- /dev/null +++ b/tests/phpunit/tests/MediaWikiTestCaseTest.php @@ -0,0 +1,77 @@ +setMwGlobals( self::GLOBAL_KEY_EXISTING, 'bar' ); + $this->assertEquals( + 'bar', + $GLOBALS[self::GLOBAL_KEY_EXISTING], + 'Global failed to correctly set' + ); + + $this->tearDown(); + + $this->assertEquals( + 'foo', + $GLOBALS[self::GLOBAL_KEY_EXISTING], + 'Global failed to be restored on tearDown' + ); + } + + /** + * @covers MediaWikiTestCase::stashMwGlobals + * @covers MediaWikiTestCase::tearDown + */ + public function testStashedGlobalsAreRestoredOnTearDown() { + $this->stashMwGlobals( self::GLOBAL_KEY_EXISTING ); + $GLOBALS[self::GLOBAL_KEY_EXISTING] = 'bar'; + $this->assertEquals( + 'bar', + $GLOBALS[self::GLOBAL_KEY_EXISTING], + 'Global failed to correctly set' + ); + + $this->tearDown(); + + $this->assertEquals( + 'foo', + $GLOBALS[self::GLOBAL_KEY_EXISTING], + 'Global failed to be restored on tearDown' + ); + } + + /** + * @covers MediaWikiTestCase::stashMwGlobals + */ + public function testExceptionThrownWhenStashingNonExistentGlobals() { + $this->setExpectedException( + 'Exception', + 'Global with key ' . self::GLOBAL_KEY_NONEXISTING . ' doesn\'t exist and cant be stashed' + ); + + $this->stashMwGlobals( self::GLOBAL_KEY_NONEXISTING ); + } + +} -- cgit v1.2.2