MediaWiki
REL1_19
|
00001 <?php 00007 class StructureTest extends MediaWikiTestCase { 00012 public function testUnitTestFileNamesEndWithTest() { 00013 if ( wfIsWindows() ) { 00014 $this->markTestSkipped( 'This test does not work on Windows' ); 00015 } 00016 $rootPath = escapeshellarg( __DIR__ ); 00017 $testClassRegex = implode( '|', array( 00018 'ApiFormatTestBase', 00019 'ApiTestCase', 00020 'MediaWikiLangTestCase', 00021 'MediaWikiTestCase', 00022 'PHPUnit_Framework_TestCase', 00023 ) ); 00024 $testClassRegex = "^class .* extends ($testClassRegex)"; 00025 $finder = "find $rootPath -name '*.php' '!' -name '*Test.php'" . 00026 " | xargs grep -El '$testClassRegex|function suite\('"; 00027 00028 $results = null; 00029 $exitCode = null; 00030 exec($finder, $results, $exitCode); 00031 00032 $this->assertEquals( 00033 0, 00034 $exitCode, 00035 'Verify find/grep command succeeds.' 00036 ); 00037 00038 $results = array_filter( 00039 $results, 00040 array( $this, 'filterSuites' ) 00041 ); 00042 00043 $this->assertEquals( 00044 array(), 00045 $results, 00046 'Unit test file names must end with Test.' 00047 ); 00048 } 00049 00053 public function filterSuites( $filename ) { 00054 return strpos( $filename, __DIR__ . '/suites/' ) !== 0; 00055 } 00056 }