Greatly simplifies query result iteration by the clients by providing a mechanism to track sub-iterations (props in generated set) Assuming the client has the param=>value dictionary with the original request parameters, client will only need to perform this operation in their language to get all results from the server regardless of what query they make. $request = array_merge( $request, $result['continue'] ); Related changes: * Moved dieContinueUsageIf() from ApiQueryBase to ApiBase * Internal calls will also return unused param warnings * Reworked query unit tests for easier testing Change-Id: Ieb45241fc6db2109f1d92fa3381165ec30701b63
63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* The tests here verify the structure of the code. This is for outright bugs,
|
|
* not just style issues.
|
|
*/
|
|
|
|
class StructureTest extends MediaWikiTestCase {
|
|
/**
|
|
* Verify all files that appear to be tests have file names ending in
|
|
* Test. If the file names do not end in Test, they will not be run.
|
|
* @group medium
|
|
*/
|
|
public function testUnitTestFileNamesEndWithTest() {
|
|
if ( wfIsWindows() ) {
|
|
$this->markTestSkipped( 'This test does not work on Windows' );
|
|
}
|
|
$rootPath = escapeshellarg( __DIR__ );
|
|
$testClassRegex = implode( '|', array(
|
|
'ApiFormatTestBase',
|
|
'ApiTestCase',
|
|
'ApiQueryTestBase',
|
|
'ApiQueryContinueTestBase',
|
|
'MediaWikiLangTestCase',
|
|
'MediaWikiTestCase',
|
|
'PHPUnit_Framework_TestCase',
|
|
'DumpTestCase',
|
|
) );
|
|
$testClassRegex = "^class .* extends ($testClassRegex)";
|
|
$finder = "find $rootPath -name '*.php' '!' -name '*Test.php'" .
|
|
" | xargs grep -El '$testClassRegex|function suite\('";
|
|
|
|
$results = null;
|
|
$exitCode = null;
|
|
exec( $finder, $results, $exitCode );
|
|
|
|
$this->assertEquals(
|
|
0,
|
|
$exitCode,
|
|
'Verify find/grep command succeeds.'
|
|
);
|
|
|
|
$results = array_filter(
|
|
$results,
|
|
array( $this, 'filterSuites' )
|
|
);
|
|
$strip = strlen( $rootPath ) - 1;
|
|
foreach ( $results as $k => $v ) {
|
|
$results[$k] = substr( $v, $strip );
|
|
}
|
|
$this->assertEquals(
|
|
array(),
|
|
$results,
|
|
"Unit test file in $rootPath must end with Test."
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Filter to remove testUnitTestFileNamesEndWithTest false positives.
|
|
*/
|
|
public function filterSuites( $filename ) {
|
|
return strpos( $filename, __DIR__ . '/suites/' ) !== 0;
|
|
}
|
|
}
|