aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/DeprecatedGlobalTest.php
diff options
context:
space:
mode:
authorDannyS712 <DannyS712.enwiki@gmail.com>2021-03-01 02:54:10 +0000
committerDannyS712 <DannyS712.enwiki@gmail.com>2021-03-01 02:54:27 +0000
commita4b7b9c59a2e3c3fe2c42f46bf49584ff80150fc (patch)
tree1e971f364f98eed75b1322887d770fa5edb2010b /tests/phpunit/includes/DeprecatedGlobalTest.php
parent720edebbbafdc79a4a62a6b49ec3773f02bbeb9c (diff)
downloadmediawikicore-a4b7b9c59a2e3c3fe2c42f46bf49584ff80150fc.tar.gz
mediawikicore-a4b7b9c59a2e3c3fe2c42f46bf49584ff80150fc.zip
Make DeprecatedGlobalTest a pure unit test
No integration needed Change-Id: Ifcb9eee5843b21ce12c1e9ef5d4f8020e6c8d11c
Diffstat (limited to 'tests/phpunit/includes/DeprecatedGlobalTest.php')
-rw-r--r--tests/phpunit/includes/DeprecatedGlobalTest.php80
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/phpunit/includes/DeprecatedGlobalTest.php b/tests/phpunit/includes/DeprecatedGlobalTest.php
deleted file mode 100644
index 3904d65d9e31..000000000000
--- a/tests/phpunit/includes/DeprecatedGlobalTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- */
-
-/**
- * @covers DeprecatedGlobal
- */
-class DeprecatedGlobalTest extends MediaWikiIntegrationTestCase {
- private $oldErrorLevel;
-
- protected function setUp() : void {
- parent::setUp();
- $this->oldErrorLevel = error_reporting( -1 );
- }
-
- protected function tearDown() : void {
- error_reporting( $this->oldErrorLevel );
- parent::tearDown();
- }
-
- public function testObjectDeStub() {
- global $wgDummy;
-
- $wgDummy = new DeprecatedGlobal( 'wgDummy', new HashBagOStuff(), '1.30' );
- $this->assertInstanceOf( DeprecatedGlobal::class, $wgDummy );
-
- $this->hideDeprecated( '$wgDummy' );
- // Trigger de-stubification
- $wgDummy->get( 'foo' );
-
- $this->assertInstanceOf( HashBagOStuff::class, $wgDummy );
- }
-
- public function testLazyLoad() {
- global $wgDummyLazy;
-
- $called = false;
- $factory = static function () use ( &$called ) {
- $called = true;
- return new HashBagOStuff();
- };
-
- $wgDummyLazy = new DeprecatedGlobal( 'wgDummyLazy', $factory, '1.30' );
- $this->assertInstanceOf( DeprecatedGlobal::class, $wgDummyLazy );
-
- $this->hideDeprecated( '$wgDummyLazy' );
- $this->assertFalse( $called );
- // Trigger de-stubification
- $wgDummyLazy->get( 'foo' );
- $this->assertTrue( $called );
- $this->assertInstanceOf( HashBagOStuff::class, $wgDummyLazy );
- }
-
- public function testWarning() {
- global $wgDummy1;
-
- $wgDummy1 = new DeprecatedGlobal( 'wgDummy1', new HashBagOStuff(), '1.30' );
- $this->expectDeprecation();
- $this->expectDeprecationMessage( 'Use of $wgDummy1 was deprecated in MediaWiki 1.30' );
- $wgDummy1->get( 'foo' );
- $this->assertInstanceOf( HashBagOStuff::class, $wgDummy1 );
- }
-
-}