MediaWiki  master
ApiQueryContinueTestBase Class Reference
Inheritance diagram for ApiQueryContinueTestBase:
Collaboration diagram for ApiQueryContinueTestBase:

Protected Member Functions

 checkC ( $expected, $params, $expectedCount, $id, $continue=true)
 Run query() and compare against expected values. More...
 
 mergeResult (&$results, $newResult, $numericIds=false)
 Recursively merge the new result returned from the query to the previous results. More...
 
 query ( $params, $expectedCount, $id, $useContinue=true)
 Run query in a loop until no more values are available. More...
 
- Protected Member Functions inherited from ApiQueryTestBase
 assertResult ( $exp, $result, $message='')
 
 check ( $values, array $session=null, $appendModule=false, User $user=null)
 Checks that the request's result matches the expected results. More...
 
 merge (... $arrays)
 Merges all requests parameter + expected values into one. More...
 
- Protected Member Functions inherited from ApiTestCase
 doApiRequest (array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
 Does the API request and returns the result. More...
 
 doApiRequestWithToken (array $params, array $session=null, User $user=null, $tokenType='auto')
 Convenience function to access the token parameter of doApiRequest() more succinctly. More...
 
 doLogin ( $testUser=null)
 Previously this would do API requests to log in, as well as setting $wgUser and the request context's user. More...
 
 getTokenList (TestUser $user, $session=null)
 
 setExpectedApiException ( $msg, $code=null, array $data=null, $httpCode=0)
 Expect an ApiUsageException to be thrown with the given parameters, which are the same as ApiUsageException::newWithMessage()'s parameters. More...
 
 setUp ()
 
 tearDown ()
 
- Protected Member Functions inherited from MediaWikiLangTestCase
 setUp ()
 

Protected Attributes

 $mVerbose = false
 Enable to print in-depth debugging info during the test run. More...
 
- Protected Attributes inherited from ApiTestCase
ApiTestContext $apiContext
 

Private Member Functions

 printResult ( $data)
 

Static Private Member Functions

static GetItems ( $q, $moduleName, $name, &$print)
 

Additional Inherited Members

- Public Member Functions inherited from ApiTestCase
 testApiTestGroup ()
 
- Static Public Member Functions inherited from ApiTestCase
static apiExceptionHasCode (ApiUsageException $ex, $code)
 
- Public Attributes inherited from ApiQueryTestBase
const PARAM_ASSERT
 
- Static Protected Member Functions inherited from ApiTestCase
static getErrorFormatter ()
 
- Static Protected Attributes inherited from ApiTestCase
static $apiUrl
 
static $errorFormatter = null
 

Detailed Description

Definition at line 22 of file ApiQueryContinueTestBase.php.

Member Function Documentation

◆ checkC()

ApiQueryContinueTestBase::checkC (   $expected,
  $params,
  $expectedCount,
  $id,
  $continue = true 
)
protected

Run query() and compare against expected values.

Parameters
array$expected
array$paramsApi parameters
int$expectedCountMax number of iterations
string$idUnit test id
bool$continueTrue to use smart continue
Returns
array Merged results data array

Definition at line 38 of file ApiQueryContinueTestBase.php.

References $params, ApiQueryTestBase\assertResult(), and query().

Referenced by ApiQueryContinueTest\test1List(), ApiQueryContinueTest\test2Lists(), ApiQueryContinue2Test\testA(), ApiQueryContinueTest\testGen1Prop(), ApiQueryContinueTest\testGen1Prop1List(), ApiQueryContinueTest\testGen2Prop(), ApiQueryContinueTest\testGen2Prop2List1Meta(), ApiQueryContinueTest\testSameGenAndProp(), and ApiQueryContinueTest\testSameGenList().

◆ GetItems()

static ApiQueryContinueTestBase::GetItems (   $q,
  $moduleName,
  $name,
$print 
)
staticprivate

Definition at line 147 of file ApiQueryContinueTestBase.php.

◆ mergeResult()

ApiQueryContinueTestBase::mergeResult ( $results,
  $newResult,
  $numericIds = false 
)
protected

Recursively merge the new result returned from the query to the previous results.

Parameters
mixed&$results
mixed$newResult
bool$numericIdsIf true, treat keys as ids to be merged instead of appending

Definition at line 164 of file ApiQueryContinueTestBase.php.

References $sort, $value, as, and null.

Referenced by query().

◆ printResult()

ApiQueryContinueTestBase::printResult (   $data)
private
Parameters
array$data

Definition at line 111 of file ApiQueryContinueTestBase.php.

References as, and print.

Referenced by query().

◆ query()

ApiQueryContinueTestBase::query (   $params,
  $expectedCount,
  $id,
  $useContinue = true 
)
protected

Run query in a loop until no more values are available.

Parameters
array$paramsApi parameters
int$expectedCountMax number of iterations
string$idUnit test id
bool$useContinueTrue to use smart continue
Returns
array Merged results data array
Exceptions
Exception

Definition at line 52 of file ApiQueryContinueTestBase.php.

References $e, $params, $request, ApiTestCase\doApiRequest(), mergeResult(), print, and printResult().

Referenced by checkC(), ApiQueryContinueTest\test1List(), ApiQueryContinueTest\test2Lists(), ApiQueryContinue2Test\testA(), ApiQueryContinueTest\testGen1Prop(), ApiQueryContinueTest\testGen1Prop1List(), ApiQueryContinueTest\testGen2Prop(), ApiQueryContinueTest\testGen2Prop2List1Meta(), ApiQueryContinueTest\testSameGenAndProp(), and ApiQueryContinueTest\testSameGenList().

Member Data Documentation

◆ $mVerbose

ApiQueryContinueTestBase::$mVerbose = false
protected

Enable to print in-depth debugging info during the test run.

Definition at line 27 of file ApiQueryContinueTestBase.php.


The documentation for this class was generated from the following file: