Upgrade PHPUnit to version 7
Going directly to 8 is too much pain. Depends-On: Iafcea151389663d79e70ad6ab3741ce8b2e25cac Bug: T192167 Change-Id: I77ea560f4a5344bd1c356ecc3e7857968ad829b8
This commit is contained in:
parent
7902007cc6
commit
4a17fd1202
9 changed files with 31 additions and 26 deletions
|
|
@ -60,7 +60,6 @@
|
|||
"zordius/lightncandy": "0.23"
|
||||
},
|
||||
"require-dev": {
|
||||
"cache/integration-tests": "0.16.0",
|
||||
"composer/spdx-licenses": "1.5.1",
|
||||
"doctrine/dbal": "2.9.3",
|
||||
"giorgiosironi/eris": "^0.10.0",
|
||||
|
|
@ -73,14 +72,15 @@
|
|||
"nikic/php-parser": "4.2.4",
|
||||
"seld/jsonlint": "1.7.1",
|
||||
"nmred/kafka-php": "0.1.5",
|
||||
"phpunit/phpunit": "^6.5.14",
|
||||
"phpunit/phpunit": "^7.5.13",
|
||||
"psy/psysh": "0.9.9",
|
||||
"wikimedia/avro": "1.9.0",
|
||||
"wikimedia/testing-access-wrapper": "~1.0",
|
||||
"wmde/hamcrest-html-matchers": "^0.1.0",
|
||||
"mediawiki/mediawiki-phan-config": "0.8.0",
|
||||
"symfony/yaml": "~3.4 | 4.3.4",
|
||||
"johnkary/phpunit-speedtrap": "^1.0 | ^2.0"
|
||||
"johnkary/phpunit-speedtrap": "^3.1",
|
||||
"phpunit/php-invoker": "^2.0"
|
||||
},
|
||||
"replace": {
|
||||
"symfony/polyfill-ctype": "1.99",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
timeoutForLargeTests="60"
|
||||
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTestSize="true"
|
||||
enforceTimeLimit="true"
|
||||
verbose="false">
|
||||
<php>
|
||||
<ini name="memory_limit" value="512M" />
|
||||
|
|
|
|||
|
|
@ -34,19 +34,19 @@ class MediaWikiLoggerPHPUnitTestListener implements TestListener {
|
|||
LoggerFactory::registerProvider( $this->spi );
|
||||
}
|
||||
|
||||
public function addRiskyTest( Test $test, Exception $e, $time ) : void {
|
||||
public function addRiskyTest( Test $test, Throwable $e, $time ) : void {
|
||||
$this->augmentTestWithLogs( $test );
|
||||
}
|
||||
|
||||
public function addIncompleteTest( Test $test, Exception $e, $time ) : void {
|
||||
public function addIncompleteTest( Test $test, Throwable $e, $time ) : void {
|
||||
$this->augmentTestWithLogs( $test );
|
||||
}
|
||||
|
||||
public function addSkippedTest( Test $test, Exception $e, $time ) : void {
|
||||
public function addSkippedTest( Test $test, Throwable $e, $time ) : void {
|
||||
$this->augmentTestWithLogs( $test );
|
||||
}
|
||||
|
||||
public function addError( Test $test, Exception $e, $time ) : void {
|
||||
public function addError( Test $test, Throwable $e, $time ) : void {
|
||||
$this->augmentTestWithLogs( $test );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class MediaWikiPHPUnitTestListener implements TestListener {
|
|||
return $name;
|
||||
}
|
||||
|
||||
protected function getErrorName( Exception $exception ) : string {
|
||||
protected function getErrorName( Throwable $exception ) : string {
|
||||
$name = get_class( $exception );
|
||||
$name = "[$name] " . $exception->getMessage();
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ class MediaWikiPHPUnitTestListener implements TestListener {
|
|||
* An error occurred.
|
||||
*
|
||||
* @param Test $test
|
||||
* @param Exception $e
|
||||
* @param Throwable $e
|
||||
* @param float $time
|
||||
*/
|
||||
public function addError( Test $test, Exception $e, $time ) : void {
|
||||
public function addError( Test $test, Throwable $e, float $time ) : void {
|
||||
wfDebugLog(
|
||||
$this->logChannel,
|
||||
'ERROR in ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
|
||||
|
|
@ -57,7 +57,7 @@ class MediaWikiPHPUnitTestListener implements TestListener {
|
|||
* @param AssertionFailedError $e
|
||||
* @param float $time
|
||||
*/
|
||||
public function addFailure( Test $test, AssertionFailedError $e, $time ) : void {
|
||||
public function addFailure( Test $test, AssertionFailedError $e, float $time ) : void {
|
||||
wfDebugLog(
|
||||
$this->logChannel,
|
||||
'FAILURE in ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
|
||||
|
|
@ -68,13 +68,13 @@ class MediaWikiPHPUnitTestListener implements TestListener {
|
|||
* Incomplete test.
|
||||
*
|
||||
* @param Test $test
|
||||
* @param Exception $e
|
||||
* @param Throwable $t
|
||||
* @param float $time
|
||||
*/
|
||||
public function addIncompleteTest( Test $test, Exception $e, $time ) : void {
|
||||
public function addIncompleteTest( Test $test, Throwable $t, float $time ) : void {
|
||||
wfDebugLog(
|
||||
$this->logChannel,
|
||||
'Incomplete test ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
|
||||
'Incomplete test ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $t )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -82,13 +82,13 @@ class MediaWikiPHPUnitTestListener implements TestListener {
|
|||
* Skipped test.
|
||||
*
|
||||
* @param Test $test
|
||||
* @param Exception $e
|
||||
* @param Throwable $t
|
||||
* @param float $time
|
||||
*/
|
||||
public function addSkippedTest( Test $test, Exception $e, $time ) : void {
|
||||
public function addSkippedTest( Test $test, Throwable $t, float $time ) : void {
|
||||
wfDebugLog(
|
||||
$this->logChannel,
|
||||
'Skipped test ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $e )
|
||||
'Skipped test ' . $this->getTestName( $test ) . ': ' . $this->getErrorName( $t )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ class MediaWikiPHPUnitTestListener implements TestListener {
|
|||
* @param Test $test
|
||||
* @param float $time
|
||||
*/
|
||||
public function endTest( Test $test, $time ) : void {
|
||||
public function endTest( Test $test, float $time ) : void {
|
||||
Hooks::run( 'MediaWikiPHPUnitTest::endTest', [ $test, $time ] );
|
||||
wfDebugLog( $this->logChannel, 'End test ' . $this->getTestName( $test ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class PasswordResetTest extends MediaWikiTestCase {
|
|||
->with( $user, 'editmyprivateinfo' )
|
||||
->willReturn( $canEditPrivate );
|
||||
|
||||
$loadBalancer = $this->getMockBuilder( ILoadBalancer::class )->getMock();
|
||||
$loadBalancer = $this->createMock( ILoadBalancer::class );
|
||||
|
||||
$passwordReset = new PasswordReset(
|
||||
$config,
|
||||
|
|
@ -239,8 +239,7 @@ class PasswordResetTest extends MediaWikiTestCase {
|
|||
'SpecialPasswordResetOnSubmit' => [],
|
||||
] );
|
||||
|
||||
$loadBalancer = $this->getMockBuilder( ILoadBalancer::class )
|
||||
->getMock();
|
||||
$loadBalancer = $this->createMock( ILoadBalancer::class );
|
||||
|
||||
$users = $this->makeUsers();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use SebastianBergmann\FileIterator\Facade;
|
||||
|
||||
class AutoLoaderStructureTest extends MediaWikiTestCase {
|
||||
/**
|
||||
* Assert that there were no classes loaded that are not registered with the AutoLoader.
|
||||
|
|
@ -25,7 +27,7 @@ class AutoLoaderStructureTest extends MediaWikiTestCase {
|
|||
}
|
||||
|
||||
private function recurseFiles( $dir ) {
|
||||
return ( new File_Iterator_Facade() )->getFilesAsArray( $dir, [ '.php' ] );
|
||||
return ( new Facade() )->getFilesAsArray( $dir, [ '.php' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
use SebastianBergmann\FileIterator\Facade;
|
||||
|
||||
/**
|
||||
* The tests here verify the structure of the code. This is for outright bugs,
|
||||
* not just style issues.
|
||||
|
|
@ -58,6 +61,6 @@ class StructureTest extends MediaWikiTestCase {
|
|||
}
|
||||
|
||||
private function recurseFiles( $dir ) {
|
||||
return ( new File_Iterator_Facade() )->getFilesAsArray( $dir, [ '.php' ] );
|
||||
return ( new Facade() )->getFilesAsArray( $dir, [ '.php' ] );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
timeoutForLargeTests="60"
|
||||
beStrictAboutTestsThatDoNotTestAnything="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTestSize="true"
|
||||
enforceTimeLimit="true"
|
||||
verbose="false">
|
||||
<testsuites>
|
||||
<testsuite name="includes">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use SebastianBergmann\FileIterator\Facade;
|
||||
|
||||
/**
|
||||
* This test suite runs unit tests registered by extensions.
|
||||
|
|
@ -25,7 +26,7 @@ class ExtensionsTestSuite extends TestSuite {
|
|||
// If the path is a directory, search for test cases.
|
||||
// @since 1.24
|
||||
$suffixes = [ 'Test.php' ];
|
||||
$fileIterator = new File_Iterator_Facade();
|
||||
$fileIterator = new Facade();
|
||||
$matchingFiles = $fileIterator->getFilesAsArray( $path, $suffixes );
|
||||
$this->addTestFiles( $matchingFiles );
|
||||
} elseif ( file_exists( $path ) ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue