From: Aryeh Gregor Date: Thu, 9 Aug 2018 14:38:13 +0000 (+0300) Subject: Only use "*Test.php" for actual PHPUnit tests X-Git-Tag: 1.34.0-rc.0~3895^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=2bb355108279197dd61ae928555b5409d0f95f91;p=lhc%2Fweb%2Fwiklou.git Only use "*Test.php" for actual PHPUnit tests Otherwise I get errors every time I try to run PHPUnit on includes/ or includes/parser, because it tries to run ParserIntegrationTest.php and fails. Apparently the in suite.xml doesn't work if PHPUnit is invoked on a directory. Bug: T201278 Change-Id: I7d09576bee2705d8516152e8fa671da8dac40233 --- diff --git a/tests/common/TestsAutoLoader.php b/tests/common/TestsAutoLoader.php index 0cb042a553..d864fc06b2 100644 --- a/tests/common/TestsAutoLoader.php +++ b/tests/common/TestsAutoLoader.php @@ -126,7 +126,7 @@ $wgAutoloadClasses += [ 'WikiPageDbTestBase' => "$testDir/phpunit/includes/page/WikiPageDbTestBase.php", # tests/phpunit/includes/parser - 'ParserIntegrationTest' => "$testDir/phpunit/includes/parser/ParserIntegrationTest.php", + 'ParserIntegrationTest' => "$testDir/phpunit/suites/ParserIntegrationTest.php", # tests/phpunit/includes/password 'PasswordTestCase' => "$testDir/phpunit/includes/password/PasswordTestCase.php", diff --git a/tests/phpunit/includes/parser/ParserIntegrationTest.php b/tests/phpunit/includes/parser/ParserIntegrationTest.php deleted file mode 100644 index 91653b5d86..0000000000 --- a/tests/phpunit/includes/parser/ParserIntegrationTest.php +++ /dev/null @@ -1,65 +0,0 @@ -ptTest = $test; - $this->ptRunner = $runner; - } - - public function testParse() { - $this->ptRunner->getRecorder()->setTestCase( $this ); - $result = $this->ptRunner->runTest( $this->ptTest ); - $this->assertEquals( $result->expected, $result->actual ); - } - - public function setUp() { - $this->ptTeardownScope = $this->ptRunner->staticSetup(); - } - - public function tearDown() { - if ( $this->ptTeardownScope ) { - ScopedCallback::consume( $this->ptTeardownScope ); - } - } -} diff --git a/tests/phpunit/suite.xml b/tests/phpunit/suite.xml index e125b8a314..a7d5001e5e 100644 --- a/tests/phpunit/suite.xml +++ b/tests/phpunit/suite.xml @@ -20,8 +20,6 @@ includes - - includes/parser/ParserIntegrationTest.php languages diff --git a/tests/phpunit/suites/ParserIntegrationTest.php b/tests/phpunit/suites/ParserIntegrationTest.php new file mode 100644 index 0000000000..91653b5d86 --- /dev/null +++ b/tests/phpunit/suites/ParserIntegrationTest.php @@ -0,0 +1,65 @@ +ptTest = $test; + $this->ptRunner = $runner; + } + + public function testParse() { + $this->ptRunner->getRecorder()->setTestCase( $this ); + $result = $this->ptRunner->runTest( $this->ptTest ); + $this->assertEquals( $result->expected, $result->actual ); + } + + public function setUp() { + $this->ptTeardownScope = $this->ptRunner->staticSetup(); + } + + public function tearDown() { + if ( $this->ptTeardownScope ) { + ScopedCallback::consume( $this->ptTeardownScope ); + } + } +}