aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Semenik <maxsem.wiki@gmail.com>2019-10-03 15:20:49 -0700
committerMax Semenik <maxsem.wiki@gmail.com>2019-10-04 14:19:05 -0700
commitbc3878e33ac1af4dc5d4426e418aecffeb01ae22 (patch)
treed226d9934300db3528a70d7c8c2a650cb0569251
parent618e24e089751a58466fc3fd108b7763f4c0a8b1 (diff)
downloadmediawikicore-bc3878e33ac1af4dc5d4426e418aecffeb01ae22.tar.gz
mediawikicore-bc3878e33ac1af4dc5d4426e418aecffeb01ae22.zip
Begin cleaning up PHPUnit 4 code from tests
This process will be broken up into several parts for reviewability. Bug: T192167 Change-Id: Ie415fd3308384a5ca2b3de24ba037785f8a3a714
-rw-r--r--tests/phpunit/includes/EditPageTest.php6
-rw-r--r--tests/phpunit/includes/FauxRequestTest.php11
-rw-r--r--tests/phpunit/includes/HooksTest.php7
-rw-r--r--tests/phpunit/includes/MagicWordFactoryTest.php2
-rw-r--r--tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php1
-rw-r--r--tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php2
-rw-r--r--tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php2
-rw-r--r--tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php9
-rw-r--r--tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php5
-rw-r--r--tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php1
-rw-r--r--tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php3
-rw-r--r--tests/phpunit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php3
-rw-r--r--tests/phpunit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php6
-rw-r--r--tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php1
-rw-r--r--tests/phpunit/includes/sparql/SparqlClientTest.php7
-rw-r--r--tests/phpunit/unit/includes/libs/services/ServiceContainerTest.php23
-rw-r--r--tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php6
17 files changed, 38 insertions, 57 deletions
diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php
index 1f9465dee3df..22cc3f15e29c 100644
--- a/tests/phpunit/includes/EditPageTest.php
+++ b/tests/phpunit/includes/EditPageTest.php
@@ -703,10 +703,8 @@ hello
'wpUnicodeCheck' => EditPage::UNICODE_CHECK,
];
- $this->setExpectedException(
- MWException::class,
- 'This content model is not supported: testing'
- );
+ $this->expectException( MWException::class );
+ $this->expectExceptionMessage( 'This content model is not supported: testing' );
$this->doEditDummyNonTextPage( $edit );
}
diff --git a/tests/phpunit/includes/FauxRequestTest.php b/tests/phpunit/includes/FauxRequestTest.php
index 75bdc98b3a25..fc98113e7aa6 100644
--- a/tests/phpunit/includes/FauxRequestTest.php
+++ b/tests/phpunit/includes/FauxRequestTest.php
@@ -5,7 +5,6 @@ use MediaWiki\Session\SessionManager;
class FauxRequestTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
public function setUp() {
parent::setUp();
@@ -21,7 +20,8 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
* @covers FauxRequest::__construct
*/
public function testConstructInvalidData() {
- $this->setExpectedException( MWException::class, 'bogus data' );
+ $this->expectException( MWException::class );
+ $this->expectExceptionMessage( 'bogus data' );
$req = new FauxRequest( 'x' );
}
@@ -29,7 +29,8 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
* @covers FauxRequest::__construct
*/
public function testConstructInvalidSession() {
- $this->setExpectedException( MWException::class, 'bogus session' );
+ $this->expectException( MWException::class );
+ $this->expectExceptionMessage( 'bogus session' );
$req = new FauxRequest( [], false, 'x' );
}
@@ -160,7 +161,7 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
*/
public function testGetRequestURL_disallowed() {
$req = new FauxRequest();
- $this->setExpectedException( MWException::class );
+ $this->expectException( MWException::class );
$req->getRequestURL();
}
@@ -181,7 +182,7 @@ class FauxRequestTest extends PHPUnit\Framework\TestCase {
$GLOBALS['wgServer'] = '//wiki.test';
$req = new FauxRequest();
- $this->setExpectedException( MWException::class );
+ $this->expectException( MWException::class );
$req->getFullRequestURL();
}
diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php
index c66b712b8355..cda0cda851ee 100644
--- a/tests/phpunit/includes/HooksTest.php
+++ b/tests/phpunit/includes/HooksTest.php
@@ -267,10 +267,9 @@ class HooksTest extends MediaWikiTestCase {
} );
$foo = 'original';
- $this->setExpectedException(
- UnexpectedValueException::class,
- 'Invalid return from hook-MediaWikiHooksTest001-closure for ' .
- 'unabortable MediaWikiHooksTest001'
+ $this->expectException( UnexpectedValueException::class );
+ $this->expectExceptionMessage( 'Invalid return from hook-MediaWikiHooksTest001-closure for ' .
+ 'unabortable MediaWikiHooksTest001'
);
Hooks::runWithoutAbort( 'MediaWikiHooksTest001', [ &$foo ] );
}
diff --git a/tests/phpunit/includes/MagicWordFactoryTest.php b/tests/phpunit/includes/MagicWordFactoryTest.php
index 065024bd73be..69bc5a3ab7c1 100644
--- a/tests/phpunit/includes/MagicWordFactoryTest.php
+++ b/tests/phpunit/includes/MagicWordFactoryTest.php
@@ -32,7 +32,7 @@ class MagicWordFactoryTest extends MediaWikiTestCase {
public function testGetInvalidMagicWord() {
$magicWordFactory = $this->makeMagicWordFactory();
- $this->setExpectedException( MWException::class );
+ $this->expectException( MWException::class );
\Wikimedia\suppressWarnings();
try {
$magicWordFactory->get( 'invalid magic word' );
diff --git a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
index 90bebd8190de..eba4aff1d683 100644
--- a/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
+++ b/tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
@@ -19,7 +19,6 @@ use Wikimedia\TestingAccessWrapper;
class WANObjectCacheTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
/** @var WANObjectCache */
private $cache;
diff --git a/tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php b/tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php
index 857f7090c960..afa270540179 100644
--- a/tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php
+++ b/tests/phpunit/includes/libs/rdbms/connectionmanager/ConnectionManagerTest.php
@@ -13,8 +13,6 @@ use Wikimedia\Rdbms\ConnectionManager;
* @author Daniel Kinzler
*/
class ConnectionManagerTest extends \PHPUnit\Framework\TestCase {
- use \PHPUnit4And6Compat;
-
/**
* @return IDatabase|PHPUnit_Framework_MockObject_MockObject
*/
diff --git a/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php b/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
index 3492c3d9bbc7..3221d0120f3b 100644
--- a/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
+++ b/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
@@ -13,8 +13,6 @@ use Wikimedia\Rdbms\SessionConsistentConnectionManager;
* @author Daniel Kinzler
*/
class SessionConsistentConnectionManagerTest extends \PHPUnit\Framework\TestCase {
- use \PHPUnit4And6Compat;
-
/**
* @return IDatabase|PHPUnit_Framework_MockObject_MockObject
*/
diff --git a/tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php b/tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php
index fafeb4e20d9b..393265a50c4a 100644
--- a/tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php
+++ b/tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php
@@ -12,13 +12,12 @@ use Wikimedia\Rdbms\IResultWrapper;
class DBConnRefTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
/**
* @return ILoadBalancer
*/
private function getLoadBalancerMock() {
- $lb = $this->getMock( ILoadBalancer::class );
+ $lb = $this->createMock( ILoadBalancer::class );
$lb->method( 'getConnection' )->willReturnCallback(
function () {
@@ -79,7 +78,7 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
}
public function testConstruct_params() {
- $lb = $this->getMock( ILoadBalancer::class );
+ $lb = $this->createMock( ILoadBalancer::class );
$lb->expects( $this->once() )
->method( 'getConnection' )
@@ -123,7 +122,7 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
}
public function testConstruct_failure() {
- $this->setExpectedException( InvalidArgumentException::class, '' );
+ $this->expectException( InvalidArgumentException::class );
$lb = $this->getLoadBalancerMock();
new DBConnRef( $lb, 17, DB_REPLICA ); // bad constructor argument
@@ -133,7 +132,7 @@ class DBConnRefTest extends PHPUnit\Framework\TestCase {
* @covers Wikimedia\Rdbms\DBConnRef::getDomainId
*/
public function testGetDomainID() {
- $lb = $this->getMock( ILoadBalancer::class );
+ $lb = $this->createMock( ILoadBalancer::class );
// getDomainID is optimized to not create a connection
$lb->expects( $this->never() )
diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php
index b1d4fadb7d84..6f3565d7b01f 100644
--- a/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php
+++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseDomainTest.php
@@ -8,7 +8,6 @@ use Wikimedia\Rdbms\DatabaseDomain;
class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
public static function provideConstruct() {
return [
@@ -34,7 +33,7 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
*/
public function testConstruct( $db, $schema, $prefix, $id, $exception = false ) {
if ( $exception ) {
- $this->setExpectedException( InvalidArgumentException::class );
+ $this->expectException( InvalidArgumentException::class );
new DatabaseDomain( $db, $schema, $prefix );
return;
}
@@ -74,7 +73,7 @@ class DatabaseDomainTest extends PHPUnit\Framework\TestCase {
*/
public function testNewFromId( $id, $db, $schema, $prefix, $exception = false ) {
if ( $exception ) {
- $this->setExpectedException( InvalidArgumentException::class );
+ $this->expectException( InvalidArgumentException::class );
DatabaseDomain::newFromId( $id );
return;
}
diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php
index 374ca1988de8..8a92e29415f5 100644
--- a/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php
+++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php
@@ -29,7 +29,6 @@ use Wikimedia\TestingAccessWrapper;
class DatabaseMysqlBaseTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
/**
* @dataProvider provideDiapers
diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php
index 16f6a6c05395..f2f9b009c417 100644
--- a/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php
+++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php
@@ -15,7 +15,6 @@ use Wikimedia\Rdbms\DBTransactionError;
class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
/** @var DatabaseTestHelper|Database */
private $database;
@@ -1412,7 +1411,7 @@ class DatabaseSQLTest extends PHPUnit\Framework\TestCase {
* @dataProvider provideBuildSubstring_invalidParams
*/
public function testBuildSubstring_invalidParams( $start, $length ) {
- $this->setExpectedException( InvalidArgumentException::class );
+ $this->expectException( InvalidArgumentException::class );
$this->database->buildSubstring( 'foo', $start, $length );
}
diff --git a/tests/phpunit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php b/tests/phpunit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php
index a886d6bf7635..7fea92c423d9 100644
--- a/tests/phpunit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php
+++ b/tests/phpunit/includes/libs/rdbms/database/DatabaseSqliteRdbmsTest.php
@@ -11,7 +11,6 @@ use Wikimedia\Rdbms\DatabaseSqlite;
class DatabaseSqliteRdbmsTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
/**
* @return PHPUnit_Framework_MockObject_MockObject|DatabaseSqlite
@@ -53,7 +52,7 @@ class DatabaseSqliteRdbmsTest extends PHPUnit\Framework\TestCase {
*/
public function testBuildSubstring_invalidParams( $start, $length ) {
$dbMock = $this->getMockDb();
- $this->setExpectedException( InvalidArgumentException::class );
+ $this->expectException( InvalidArgumentException::class );
$dbMock->buildSubstring( 'foo', $start, $length );
}
diff --git a/tests/phpunit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php b/tests/phpunit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php
index 46e23e36db71..94a10ba02bdd 100644
--- a/tests/phpunit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php
+++ b/tests/phpunit/includes/libs/stats/PrefixingStatsdDataFactoryProxyTest.php
@@ -7,8 +7,6 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
*/
class PrefixingStatsdDataFactoryProxyTest extends PHPUnit\Framework\TestCase {
- use PHPUnit4And6Compat;
-
public function provideMethodNames() {
return [
[ 'timing' ],
@@ -26,7 +24,7 @@ class PrefixingStatsdDataFactoryProxyTest extends PHPUnit\Framework\TestCase {
*/
public function testPrefixingAndPassthrough( $method ) {
/** @var StatsdDataFactoryInterface|PHPUnit_Framework_MockObject_MockObject $innerFactory */
- $innerFactory = $this->getMock(
+ $innerFactory = $this->createMock(
\Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface::class
);
$innerFactory->expects( $this->once() )
@@ -43,7 +41,7 @@ class PrefixingStatsdDataFactoryProxyTest extends PHPUnit\Framework\TestCase {
*/
public function testPrefixIsTrimmed( $method ) {
/** @var StatsdDataFactoryInterface|PHPUnit_Framework_MockObject_MockObject $innerFactory */
- $innerFactory = $this->getMock(
+ $innerFactory = $this->createMock(
\Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface::class
);
$innerFactory->expects( $this->once() )
diff --git a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
index 628ddb1ba1f1..d5760ed4b261 100644
--- a/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
+++ b/tests/phpunit/includes/resourceloader/MessageBlobStoreTest.php
@@ -9,7 +9,6 @@ use Wikimedia\TestingAccessWrapper;
class MessageBlobStoreTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator;
- use PHPUnit4And6Compat;
const NAME = 'test.blobstore';
diff --git a/tests/phpunit/includes/sparql/SparqlClientTest.php b/tests/phpunit/includes/sparql/SparqlClientTest.php
index 62af48920b3e..f6d96557947d 100644
--- a/tests/phpunit/includes/sparql/SparqlClientTest.php
+++ b/tests/phpunit/includes/sparql/SparqlClientTest.php
@@ -5,17 +5,14 @@ namespace MediaWiki\Sparql;
use Http;
use MediaWiki\Http\HttpRequestFactory;
use MWHttpRequest;
-use PHPUnit4And6Compat;
/**
* @covers \MediaWiki\Sparql\SparqlClient
*/
class SparqlClientTest extends \PHPUnit\Framework\TestCase {
- use PHPUnit4And6Compat;
-
private function getRequestFactory( $request ) {
- $requestFactory = $this->getMock( HttpRequestFactory::class );
+ $requestFactory = $this->createMock( HttpRequestFactory::class );
$requestFactory->method( 'create' )->willReturn( $request );
return $requestFactory;
}
@@ -160,7 +157,7 @@ JSON;
* @param array $expectedOptions
*/
public function testOptions( $sparql, $options, $timeout, $expectedUrl, $expectedOptions ) {
- $requestFactory = $this->getMock( HttpRequestFactory::class );
+ $requestFactory = $this->createMock( HttpRequestFactory::class );
$client = new SparqlClient( 'http://acme.test/', $requestFactory );
$request = $this->getRequestMock( '{}' );
diff --git a/tests/phpunit/unit/includes/libs/services/ServiceContainerTest.php b/tests/phpunit/unit/includes/libs/services/ServiceContainerTest.php
index f9e820ac6bdc..0747724c8b02 100644
--- a/tests/phpunit/unit/includes/libs/services/ServiceContainerTest.php
+++ b/tests/phpunit/unit/includes/libs/services/ServiceContainerTest.php
@@ -8,7 +8,6 @@ use Wikimedia\Services\ServiceContainer;
class ServiceContainerTest extends PHPUnit\Framework\TestCase {
use MediaWikiCoversValidator; // TODO this library is supposed to be independent of MediaWiki
- use PHPUnit4And6Compat;
private function newServiceContainer( $extraArgs = [] ) {
return new ServiceContainer( $extraArgs );
@@ -97,7 +96,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
$name = 'TestService92834576';
- $this->setExpectedException( Wikimedia\Services\NoSuchServiceException::class );
+ $this->expectException( Wikimedia\Services\NoSuchServiceException::class );
$services->getService( $name );
}
@@ -139,7 +138,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
$name = 'TestService92834576';
- $this->setExpectedException( Wikimedia\Services\NoSuchServiceException::class );
+ $this->expectException( Wikimedia\Services\NoSuchServiceException::class );
$services->peekService( $name );
}
@@ -169,7 +168,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
return $theService;
} );
- $this->setExpectedException( Wikimedia\Services\ServiceAlreadyDefinedException::class );
+ $this->expectException( Wikimedia\Services\ServiceAlreadyDefinedException::class );
$services->defineService( $name, function () use ( $theService ) {
return $theService;
@@ -283,7 +282,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
];
// loading the same file twice should fail, because
- $this->setExpectedException( Wikimedia\Services\ServiceAlreadyDefinedException::class );
+ $this->expectException( Wikimedia\Services\ServiceAlreadyDefinedException::class );
$services->loadWiringFiles( $wiringFiles );
}
@@ -341,7 +340,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
$theService = new stdClass();
$name = 'TestService92834576';
- $this->setExpectedException( Wikimedia\Services\NoSuchServiceException::class );
+ $this->expectException( Wikimedia\Services\NoSuchServiceException::class );
$services->redefineService( $name, function () use ( $theService ) {
return $theService;
@@ -361,7 +360,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
// create the service, so it can no longer be redefined
$services->getService( $name );
- $this->setExpectedException( Wikimedia\Services\CannotReplaceActiveServiceException::class );
+ $this->expectException( Wikimedia\Services\CannotReplaceActiveServiceException::class );
$services->redefineService( $name, function () use ( $theService ) {
return $theService;
@@ -408,7 +407,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
$theService = new stdClass();
$name = 'TestService92834576';
- $this->setExpectedException( Wikimedia\Services\NoSuchServiceException::class );
+ $this->expectException( Wikimedia\Services\NoSuchServiceException::class );
$services->addServiceManipulator( $name, function () use ( $theService ) {
return $theService;
@@ -428,7 +427,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
// create the service, so it can no longer be redefined
$services->getService( $name );
- $this->setExpectedException( Wikimedia\Services\CannotReplaceActiveServiceException::class );
+ $this->expectException( Wikimedia\Services\CannotReplaceActiveServiceException::class );
$services->addServiceManipulator( $name, function () {
return 'Foo';
@@ -477,7 +476,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
$this->assertContains( 'Bar', $services->getServiceNames() );
$this->assertContains( 'Qux', $services->getServiceNames() );
- $this->setExpectedException( Wikimedia\Services\ServiceDisabledException::class );
+ $this->expectException( Wikimedia\Services\ServiceDisabledException::class );
$services->getService( 'Qux' );
}
@@ -487,7 +486,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
$theService = new stdClass();
$name = 'TestService92834576';
- $this->setExpectedException( Wikimedia\Services\NoSuchServiceException::class );
+ $this->expectException( Wikimedia\Services\NoSuchServiceException::class );
$services->redefineService( $name, function () use ( $theService ) {
return $theService;
@@ -516,7 +515,7 @@ class ServiceContainerTest extends PHPUnit\Framework\TestCase {
// destroy the container
$services->destroy();
- $this->setExpectedException( Wikimedia\Services\ContainerDisabledException::class );
+ $this->expectException( Wikimedia\Services\ContainerDisabledException::class );
$services->getService( 'Bar' );
}
diff --git a/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php
index 13de142ae697..dafccb776ea0 100644
--- a/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php
+++ b/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php
@@ -350,7 +350,7 @@ class ExtensionProcessorTest extends \MediaWikiUnitTestCase {
public function testExtractCredits() {
$processor = new ExtensionProcessor();
$processor->extractInfo( $this->dir, self::$default, 1 );
- $this->setExpectedException( Exception::class );
+ $this->expectException( Exception::class );
$processor->extractInfo( $this->dir, self::$default, 1 );
}
@@ -662,8 +662,8 @@ class ExtensionProcessorTest extends \MediaWikiUnitTestCase {
public function testAttributes1_notarray() {
$processor = new ExtensionProcessor();
- $this->setExpectedException(
- InvalidArgumentException::class,
+ $this->expectException( InvalidArgumentException::class );
+ $this->expectExceptionMessage(
"The value for 'FooBarPlugins' should be an array (from {$this->dir})"
);
$processor->extractInfo(