jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/402369 )
Change subject: Assert order of MediaWikiTestCaseSchema*Test execution ...................................................................... Assert order of MediaWikiTestCaseSchema*Test execution Make sure that we fail if these tests are run in the wrong order. Essentially testing an assumption that currently holds true, but could change in the future. Change-Id: I8f33281d18f6f64e0e06c1b371b973542244dd24 --- M tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php M tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php 2 files changed, 14 insertions(+), 0 deletions(-) Approvals: Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php b/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php index 4b0e0bf..6f94494 100644 --- a/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php +++ b/tests/phpunit/tests/MediaWikiTestCaseSchema1Test.php @@ -8,6 +8,8 @@ */ class MediaWikiTestCaseSchema1Test extends MediaWikiTestCase { + public static $hasRun = false; + public function getSchemaOverrides() { return [ [ 'imagelinks', 'MediaWikiTestCaseTestTable' ], @@ -15,6 +17,12 @@ ]; } + public function testMediaWikiTestCaseSchemaTestOrder() { + // The test must be run before the second test + self::$hasRun = true; + $this->assertTrue( self::$hasRun ); + } + public function testSchemaExtension() { // make sure we can use the MediaWikiTestCaseTestTable table diff --git a/tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php b/tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php index b1c65ee..74f053e 100644 --- a/tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php +++ b/tests/phpunit/tests/MediaWikiTestCaseSchema2Test.php @@ -10,9 +10,15 @@ * that any schema modifications have been cleaned up between test cases. * As there seems to be no way to force execution order, we currently rely on * test classes getting run in anpha-numerical order. + * Order is checked by the testMediaWikiTestCaseSchemaTestOrder test in both classes. */ class MediaWikiTestCaseSchema2Test extends MediaWikiTestCase { + public function testMediaWikiTestCaseSchemaTestOrder() { + // The first test must have run before this one + $this->assertTrue( MediaWikiTestCaseSchema1Test::$hasRun ); + } + public function testSchemaExtension() { // Make sure MediaWikiTestCaseTestTable created by MediaWikiTestCaseSchema1Test // was dropped before executing MediaWikiTestCaseSchema2Test. -- To view, visit https://gerrit.wikimedia.org/r/402369 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8f33281d18f6f64e0e06c1b371b973542244dd24 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits