Tests: Assert that integration tests are not in unit test directory
authorKosta Harlan <kharlan@wikimedia.org>
Wed, 10 Jul 2019 17:41:44 +0000 (13:41 -0400)
committerKosta Harlan <kharlan@wikimedia.org>
Wed, 10 Jul 2019 17:41:44 +0000 (13:41 -0400)
Bug: T87781
Change-Id: If82efb1829095a6cf76435921f1328801508a70a

tests/phpunit/MediaWikiIntegrationTestCase.php

index bba9d5a..07d135d 100644 (file)
@@ -540,6 +540,11 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
 
        protected function setUp() {
                parent::setUp();
+               $reflection = new ReflectionClass( $this );
+               // TODO: Eventually we should assert for test presence in /integration/
+               if ( strpos( $reflection->getFilename(), '/unit/' ) !== false ) {
+                       $this->fail( 'This integration test should not be in "tests/phpunit/unit" !' );
+               }
                $this->called['setUp'] = true;
 
                $this->phpErrorLevel = intval( ini_get( 'error_reporting' ) );