3 * The tests here verify the structure of the code. This is for outright bugs,
4 * not just style issues.
7 class StructureTest
extends MediaWikiTestCase
{
9 * Verify all files that appear to be tests have file names ending in
10 * Test. If the file names do not end in Test, they will not be run.
12 public function testUnitTestFileNamesEndWithTest() {
13 $rootPath = escapeshellarg( __DIR__
);
14 $testClassRegex = implode( '|', array(
17 'MediaWikiLangTestCase',
19 'PHPUnit_Framework_TestCase',
21 $testClassRegex = "^class .* extends ($testClassRegex)";
22 $finder = "find $rootPath -name '*.php' '!' -name '*Test.php'" .
23 " | xargs grep -El '$testClassRegex|function suite\('";
27 exec($finder, $results, $exitCode);
32 'Verify find/grep command succeeds.'
35 $results = array_filter(
37 array( $this, 'filterSuites' )
43 'Unit test file names must end with Test.'
48 * Filter to remove testUnitTestFileNamesEndWithTest false positives.
50 public function filterSuites( $filename ) {
51 return strpos( $filename, __DIR__
. '/suites/' ) !== 0;