X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fregistration%2FVersionCheckerTest.php;h=4a2810bb58da15d66afea4f341074fa98e35cce9;hp=9ee58816dfa8968ff183c8cf4ddfd35342063086;hb=4ca1b96184331984d26c1b3811d2b16c06414597;hpb=849d6c980ca0172391e3c10a3444edd608b157ad diff --git a/tests/phpunit/includes/registration/VersionCheckerTest.php b/tests/phpunit/includes/registration/VersionCheckerTest.php index 9ee58816df..4a2810bb58 100644 --- a/tests/phpunit/includes/registration/VersionCheckerTest.php +++ b/tests/phpunit/includes/registration/VersionCheckerTest.php @@ -4,6 +4,9 @@ * @covers VersionChecker */ class VersionCheckerTest extends PHPUnit_Framework_TestCase { + + use MediaWikiCoversValidator; + /** * @dataProvider provideCheck */ @@ -51,6 +54,7 @@ class VersionCheckerTest extends PHPUnit_Framework_TestCase { 'FakeDependency' => [ 'version' => '1.0.0', ], + 'NoVersionGiven' => [], ] ); $this->assertEquals( $expected, $checker->checkArray( [ 'FakeExtension' => $given, @@ -75,6 +79,39 @@ class VersionCheckerTest extends PHPUnit_Framework_TestCase { ], [] ], + [ + [ + 'extensions' => [ + 'NoVersionGiven' => '*' + ] + ], + [], + ], + [ + [ + 'extensions' => [ + 'NoVersionGiven' => '1.0', + ] + ], + [ 'NoVersionGiven does not expose its version, but FakeExtension requires: 1.0.' ], + ], + [ + [ + 'extensions' => [ + 'Missing' => '*', + ] + ], + [ 'FakeExtension requires Missing to be installed.' ], + ], + [ + [ + 'extensions' => [ + 'FakeDependency' => '2.0.0', + ] + ], + // phpcs:ignore Generic.Files.LineLength.TooLong + [ 'FakeExtension is not compatible with the current installed version of FakeDependency (1.0.0), it requires: 2.0.0.' ], + ] ]; } @@ -108,7 +145,7 @@ class VersionCheckerTest extends PHPUnit_Framework_TestCase { ], ] ); - $this->setExpectedException( 'UnexpectedValueException' ); + $this->setExpectedException( UnexpectedValueException::class ); $checker->checkArray( [ 'FakeExtension' => [ 'FakeDependency' => 'not really valid',