aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/phpunit/includes/debug/DeprecationHelperTest.php6
-rw-r--r--tests/phpunit/integration/includes/StubGlobalUserTest.php14
-rw-r--r--tests/phpunit/unit/includes/DeprecatedGlobalTest.php3
-rw-r--r--tests/phpunit/unit/includes/Revision/RevisionRecordTests.php9
-rw-r--r--tests/phpunit/unit/includes/dao/WikiAwareEntityTraitTest.php2
-rw-r--r--tests/phpunit/unit/includes/debug/DeprecatablePropertyArrayTest.php3
-rw-r--r--tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php2
-rw-r--r--tests/phpunit/unit/includes/rcfeed/RCFeedTest.php4
-rw-r--r--tests/phpunit/unit/includes/user/UserIdentityValueTest.php4
9 files changed, 21 insertions, 26 deletions
diff --git a/tests/phpunit/includes/debug/DeprecationHelperTest.php b/tests/phpunit/includes/debug/DeprecationHelperTest.php
index 8010e0128f25..847719517d62 100644
--- a/tests/phpunit/includes/debug/DeprecationHelperTest.php
+++ b/tests/phpunit/includes/debug/DeprecationHelperTest.php
@@ -31,7 +31,8 @@ class DeprecationHelperTest extends MediaWikiIntegrationTestCase {
}, $expectedLevel, $expectedMessage );
} else {
$this->assertDeprecationWarningIssued( function () use ( $propName ) {
- $this->assertSame( 1, $this->testClass->$propName );
+ $expectedValue = $propName === 'fallbackDeprecatedMethodName' ? 'FOO' : 1;
+ $this->assertSame( $expectedValue, $this->testClass->$propName );
}, $expectedMessage );
}
}
@@ -225,8 +226,7 @@ class DeprecationHelperTest extends MediaWikiIntegrationTestCase {
}
protected function assertDeprecationWarningIssued( callable $callback, string $expectedMessage ) {
- $this->expectDeprecation();
- $this->expectDeprecationMessage( $expectedMessage );
+ $this->expectDeprecationAndContinue( '/' . preg_quote( $expectedMessage, '/' ) . '/' );
$callback();
}
diff --git a/tests/phpunit/integration/includes/StubGlobalUserTest.php b/tests/phpunit/integration/includes/StubGlobalUserTest.php
index 838e046f3dec..4398e20952c6 100644
--- a/tests/phpunit/integration/includes/StubGlobalUserTest.php
+++ b/tests/phpunit/integration/includes/StubGlobalUserTest.php
@@ -75,8 +75,8 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase {
}
public function testMagicCall() {
- $this->expectDeprecation();
- $this->expectDeprecationMessage( 'Use of $wgUser was deprecated in MediaWiki 1.35' );
+ $this->expectDeprecationAndContinue( '/Use of \$wgUser was deprecated in MediaWiki 1\.35/' );
+ $this->expectDeprecationAndContinue( '/\$wgUser reassignment detected/' );
global $wgUser;
$this->assertInstanceOf(
@@ -97,8 +97,8 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase {
}
public function testGetMagic() {
- $this->expectDeprecation();
- $this->expectDeprecationMessage( 'Use of $wgUser was deprecated in MediaWiki 1.35' );
+ $this->expectDeprecationAndContinue( '/Use of \$wgUser was deprecated in MediaWiki 1\.35/' );
+ $this->expectDeprecationAndContinue( '/\$wgUser reassignment detected/' );
global $wgUser;
$this->assertInstanceOf(
@@ -123,8 +123,8 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase {
// and not try to detect and throw exceptions in unstub loops - for some reason it
// thinks this creates a loop.
- $this->expectDeprecation();
- $this->expectDeprecationMessage( 'Use of $wgUser was deprecated in MediaWiki 1.35' );
+ $this->expectDeprecationAndContinue( '/Use of \$wgUser was deprecated in MediaWiki 1\.35/' );
+ $this->expectDeprecationAndContinue( '/\$wgUser reassignment detected/' );
global $wgUser;
$this->assertInstanceOf(
@@ -146,7 +146,7 @@ class StubGlobalUserTest extends MediaWikiIntegrationTestCase {
}
public function testDeprecationEmittedWhenReassigned() {
- $this->expectDeprecation();
+ $this->expectDeprecationAndContinue( '/\$wgUser reassignment detected/' );
global $wgUser;
$wgUser = new User;
}
diff --git a/tests/phpunit/unit/includes/DeprecatedGlobalTest.php b/tests/phpunit/unit/includes/DeprecatedGlobalTest.php
index 4c2945ccbaf6..d4a5809bea5f 100644
--- a/tests/phpunit/unit/includes/DeprecatedGlobalTest.php
+++ b/tests/phpunit/unit/includes/DeprecatedGlobalTest.php
@@ -73,8 +73,7 @@ class DeprecatedGlobalTest extends MediaWikiUnitTestCase {
global $wgDummy1;
$wgDummy1 = new DeprecatedGlobal( 'wgDummy1', new HashBagOStuff(), '1.30' );
- $this->expectDeprecation();
- $this->expectDeprecationMessage( 'Use of $wgDummy1 was deprecated in MediaWiki 1.30' );
+ $this->expectDeprecationAndContinue( '/Use of \$wgDummy1 was deprecated in MediaWiki 1\.30/' );
$wgDummy1->get( 'foo' );
$this->assertInstanceOf( HashBagOStuff::class, $wgDummy1 );
}
diff --git a/tests/phpunit/unit/includes/Revision/RevisionRecordTests.php b/tests/phpunit/unit/includes/Revision/RevisionRecordTests.php
index ea79414aaa39..41ce22176d47 100644
--- a/tests/phpunit/unit/includes/Revision/RevisionRecordTests.php
+++ b/tests/phpunit/unit/includes/Revision/RevisionRecordTests.php
@@ -46,8 +46,7 @@ trait RevisionRecordTests {
}
public function testGetIdTriggerDeprecatedWarning() {
- $this->expectDeprecation();
- $this->expectDeprecationMessageMatches( '/Deprecated cross-wiki access.*/' );
+ $this->expectDeprecationAndContinue( '/Deprecated cross-wiki access/' );
$revision = $this->newRevision( [ 'wikiId' => 'acmewiki', 'rev_id' => 5 ] );
$revision->getId();
}
@@ -64,8 +63,7 @@ trait RevisionRecordTests {
}
public function testGetPageIdTriggerDeprecatedWarning() {
- $this->expectDeprecation();
- $this->expectDeprecationMessageMatches( '/Deprecated cross-wiki access.*/' );
+ $this->expectDeprecationAndContinue( '/Deprecated cross-wiki access/' );
$revision = $this->newRevision( [ 'wikiId' => 'acmewiki', 'rev_page_id' => 17 ] );
$revision->getPageId();
}
@@ -82,8 +80,7 @@ trait RevisionRecordTests {
}
public function testGetParentIdTriggerDeprecatedWarning() {
- $this->expectDeprecation();
- $this->expectDeprecationMessageMatches( '/Deprecated cross-wiki access.*/' );
+ $this->expectDeprecationAndContinue( '/Deprecated cross-wiki access/' );
$revision = $this->newRevision( [ 'wikiId' => 'acmewiki', 'rev_parent_id' => 1 ] );
$revision->getParentId();
}
diff --git a/tests/phpunit/unit/includes/dao/WikiAwareEntityTraitTest.php b/tests/phpunit/unit/includes/dao/WikiAwareEntityTraitTest.php
index 4a4606e223d9..0ab69dfa15c2 100644
--- a/tests/phpunit/unit/includes/dao/WikiAwareEntityTraitTest.php
+++ b/tests/phpunit/unit/includes/dao/WikiAwareEntityTraitTest.php
@@ -95,7 +95,7 @@ class WikiAwareEntityTraitTest extends MediaWikiUnitTestCase {
* @dataProvider provideMismatchingWikis
*/
public function testDeprecateInvalidCrossWikiMismatch( $entityWiki, $assertWiki ) {
- $this->expectDeprecation();
+ $this->expectDeprecationAndContinue( '/Deprecated cross-wiki access/' );
TestingAccessWrapper::newFromObject( $this->getEntityInstance( $entityWiki ) )
->deprecateInvalidCrossWiki( $assertWiki, '1.99' );
}
diff --git a/tests/phpunit/unit/includes/debug/DeprecatablePropertyArrayTest.php b/tests/phpunit/unit/includes/debug/DeprecatablePropertyArrayTest.php
index 5fd970c52e7d..7582210e164c 100644
--- a/tests/phpunit/unit/includes/debug/DeprecatablePropertyArrayTest.php
+++ b/tests/phpunit/unit/includes/debug/DeprecatablePropertyArrayTest.php
@@ -13,8 +13,7 @@ class DeprecatablePropertyArrayTest extends MediaWikiUnitTestCase {
* @dataProvider provideDeprecationWarning
*/
public function testDeprecationWarning( callable $callback, string $message ) {
- $this->expectDeprecation();
- $this->expectDeprecationMessage( $message );
+ $this->expectDeprecationAndContinue( '/' . preg_quote( $message, '/' ) . '/' );
$callback();
}
diff --git a/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php b/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php
index 66f6e945470d..c0723fcfddd6 100644
--- a/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php
+++ b/tests/phpunit/unit/includes/libs/rdbms/platform/SQLPlatformTest.php
@@ -545,7 +545,7 @@ class SQLPlatformTest extends PHPUnit\Framework\TestCase {
* @dataProvider provideUpdateEmptyCondition
*/
public function testUpdateEmptyCondition( $sql ) {
- $this->expectDeprecation();
+ $this->expectDeprecationAndContinue( '/Use of Wikimedia\\\\Rdbms\\\\Platform\\\\SQLPlatform::updateSqlText called with empty \$conds was deprecated in MediaWiki 1\.35/' );
$this->platform->updateSqlText(
$sql['table'],
$sql['values'],
diff --git a/tests/phpunit/unit/includes/rcfeed/RCFeedTest.php b/tests/phpunit/unit/includes/rcfeed/RCFeedTest.php
index df7c632fadfe..6e48ca88a213 100644
--- a/tests/phpunit/unit/includes/rcfeed/RCFeedTest.php
+++ b/tests/phpunit/unit/includes/rcfeed/RCFeedTest.php
@@ -36,8 +36,8 @@ class RCFeedTest extends MediaWikiUnitTestCase {
}
public function testFactoryCustomUriDeprecated() {
- $this->expectDeprecation();
- $this->expectDeprecationMessage( '$wgRCFeeds without class' );
+ $this->expectDeprecationAndContinue( '/\$wgRCFeeds without class/' );
+ $this->expectException( InvalidArgumentException::class );
$feed = RCFeed::factory( [ 'uri' => 'test://bogus' ] );
}
diff --git a/tests/phpunit/unit/includes/user/UserIdentityValueTest.php b/tests/phpunit/unit/includes/user/UserIdentityValueTest.php
index f93ddf4f3ac4..26cd8b8c5a20 100644
--- a/tests/phpunit/unit/includes/user/UserIdentityValueTest.php
+++ b/tests/phpunit/unit/includes/user/UserIdentityValueTest.php
@@ -15,7 +15,7 @@ class UserIdentityValueTest extends MediaWikiUnitTestCase {
$foreignWikiId = 'Foreign Wiki';
$user = new UserIdentityValue( 0, 'TestUserName', UserIdentityValue::LOCAL );
- $this->expectDeprecation();
+ $this->expectDeprecationAndContinue( '/Use of MediaWiki\\\\User\\\\UserIdentityValue::getActorId was deprecated in MediaWiki 1\.36/' );
$this->assertSame( 0, $user->getActorId( $foreignWikiId ) );
}
@@ -25,7 +25,7 @@ class UserIdentityValueTest extends MediaWikiUnitTestCase {
public function testGetActorIdDeprecated() {
$user = new UserIdentityValue( 0, 'TestUserName' );
- $this->expectDeprecation();
+ $this->expectDeprecationAndContinue( '/Use of MediaWiki\\\\User\\\\UserIdentityValue::getActorId was deprecated in MediaWiki 1\.36/' );
$this->assertSame( 0, $user->getActorId() );
}