Index: trunk/phase3/tests/phpunit/structureTest.php |
— | — | @@ -1,53 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * The tests here verify the structure of the code. This is for outright bugs, |
5 | | - * not just style issues. |
6 | | - */ |
7 | | - |
8 | | -class structureTest extends MediaWikiTestCase { |
9 | | - /** |
10 | | - * Verify all files that appear to be tests have file names ending in |
11 | | - * Test. If the file names do not end in Test, they will not be run. |
12 | | - */ |
13 | | - public function testUnitTestFileNamesEndWithTest() { |
14 | | - $rootPath = escapeshellarg( __DIR__ ); |
15 | | - $testClassRegex = implode( '|', array( |
16 | | - 'ApiFormatTestBase', |
17 | | - 'ApiTestCase', |
18 | | - 'MediaWikiLangTestCase', |
19 | | - 'MediaWikiTestCase', |
20 | | - 'PHPUnit_Framework_TestCase', |
21 | | - ) ); |
22 | | - $testClassRegex = "^class .* extends ($testClassRegex)"; |
23 | | - $finder = "find $rootPath -name '*.php' '!' -name '*Test.php'" . |
24 | | - " | xargs grep -El '$testClassRegex|function suite\('"; |
25 | | - |
26 | | - $results = null; |
27 | | - $exitCode = null; |
28 | | - exec($finder, $results, $exitCode); |
29 | | - |
30 | | - $this->assertEquals( |
31 | | - 0, |
32 | | - $exitCode, |
33 | | - 'Verify find/grep command succeeds.' |
34 | | - ); |
35 | | - |
36 | | - $results = array_filter( |
37 | | - $results, |
38 | | - array( $this, 'filterSuites' ) |
39 | | - ); |
40 | | - |
41 | | - $this->assertEquals( |
42 | | - array(), |
43 | | - $results, |
44 | | - 'Unit test file names must end with Test.' |
45 | | - ); |
46 | | - } |
47 | | - |
48 | | - /** |
49 | | - * Filter to remove testUnitTestFileNamesEndWithTest false positives. |
50 | | - */ |
51 | | - public function filterSuites( $filename ) { |
52 | | - return strpos( $filename, __DIR__ . '/suites/' ) !== 0; |
53 | | - } |
54 | | -} |
Index: trunk/phase3/tests/phpunit/StructureTest.php |
— | — | @@ -0,0 +1,53 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * The tests here verify the structure of the code. This is for outright bugs, |
| 5 | + * not just style issues. |
| 6 | + */ |
| 7 | + |
| 8 | +class StructureTest extends MediaWikiTestCase { |
| 9 | + /** |
| 10 | + * Verify all files that appear to be tests have file names ending in |
| 11 | + * Test. If the file names do not end in Test, they will not be run. |
| 12 | + */ |
| 13 | + public function testUnitTestFileNamesEndWithTest() { |
| 14 | + $rootPath = escapeshellarg( __DIR__ ); |
| 15 | + $testClassRegex = implode( '|', array( |
| 16 | + 'ApiFormatTestBase', |
| 17 | + 'ApiTestCase', |
| 18 | + 'MediaWikiLangTestCase', |
| 19 | + 'MediaWikiTestCase', |
| 20 | + 'PHPUnit_Framework_TestCase', |
| 21 | + ) ); |
| 22 | + $testClassRegex = "^class .* extends ($testClassRegex)"; |
| 23 | + $finder = "find $rootPath -name '*.php' '!' -name '*Test.php'" . |
| 24 | + " | xargs grep -El '$testClassRegex|function suite\('"; |
| 25 | + |
| 26 | + $results = null; |
| 27 | + $exitCode = null; |
| 28 | + exec($finder, $results, $exitCode); |
| 29 | + |
| 30 | + $this->assertEquals( |
| 31 | + 0, |
| 32 | + $exitCode, |
| 33 | + 'Verify find/grep command succeeds.' |
| 34 | + ); |
| 35 | + |
| 36 | + $results = array_filter( |
| 37 | + $results, |
| 38 | + array( $this, 'filterSuites' ) |
| 39 | + ); |
| 40 | + |
| 41 | + $this->assertEquals( |
| 42 | + array(), |
| 43 | + $results, |
| 44 | + 'Unit test file names must end with Test.' |
| 45 | + ); |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Filter to remove testUnitTestFileNamesEndWithTest false positives. |
| 50 | + */ |
| 51 | + public function filterSuites( $filename ) { |
| 52 | + return strpos( $filename, __DIR__ . '/suites/' ) !== 0; |
| 53 | + } |
| 54 | +} |
Index: trunk/phase3/tests/phpunit/suite.xml |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | <directory>skins</directory> |
23 | 23 | </testsuite> |
24 | 24 | <testsuite name="structure"> |
25 | | - <file>structureTest.php</file> |
| 25 | + <file>StructureTest.php</file> |
26 | 26 | </testsuite> |
27 | 27 | <testsuite name="uploadfromurl"> |
28 | 28 | <file>suites/UploadFromUrlTestSuite.php</file> |