MediaWiki  REL1_22
ApiQueryTestBase Class Reference

This class has some common functionality for testing query module. More...

Inheritance diagram for ApiQueryTestBase:
Collaboration diagram for ApiQueryTestBase:

List of all members.

Public Attributes

const PARAM_ASSERT

Protected Member Functions

 assertResult ($exp, $result, $message= '')
 check ($values)
 Checks that the request's result matches the expected results.
 merge ()
 Merges all requests parameter + expected values into one.

Private Member Functions

 assertResultRecursive ($expected, $result)
 Recursively compare arrays, ignoring mismatches in numeric key and pageids.
 mergeExpected (&$all, $item)
 Recursively merges the expected values in the $item into the $all.
 validateRequestExpectedPair ($v)
 Check that the parameter is a valid two element array, with the first element being API request and the second - expected result.

Detailed Description

This class has some common functionality for testing query module.

Definition at line 29 of file ApiQueryTestBase.php.


Member Function Documentation

ApiQueryTestBase::assertResult ( exp,
result,
message = '' 
) [protected]

Definition at line 105 of file ApiQueryTestBase.php.

References $result, assertResultRecursive(), and print.

Referenced by check(), and ApiQueryContinueTestBase\checkC().

ApiQueryTestBase::assertResultRecursive ( expected,
result 
) [private]

Recursively compare arrays, ignoring mismatches in numeric key and pageids.

Parameters:
$expectedarray expected values
$resultarray returned values

Definition at line 126 of file ApiQueryTestBase.php.

References $result.

Referenced by assertResult().

ApiQueryTestBase::check ( values) [protected]

Checks that the request's result matches the expected results.

Parameters:
$valuesarray is a two element array( request, expected_results )
Exceptions:
Exception

Definition at line 91 of file ApiQueryTestBase.php.

References $result, array(), as, assertResult(), ApiTestCase\doApiRequest(), list, and validateRequestExpectedPair().

Referenced by ApiQueryBasicTest\testAllTogether(), ApiQueryBasicTest\testGenerator(), ApiQueryBasicTest\testGeneratorRedirects(), ApiQueryBasicTest\testLists(), and ApiQueryBasicTest\testProps().

ApiQueryTestBase::merge ( ) [protected]

Merges all requests parameter + expected values into one.

Parameters:
...list of arrays, each of which contains exactly two
Returns:
array

Definition at line 42 of file ApiQueryTestBase.php.

References array(), as, list, mergeExpected(), and validateRequestExpectedPair().

Referenced by ApiQueryBasicTest\testAllTogether(), and ApiQueryBasicTest\testGenerator().

ApiQueryTestBase::mergeExpected ( &$  all,
item 
) [private]

Recursively merges the expected values in the $item into the $all.

Reimplemented in ApiQueryBasicTest.

Definition at line 72 of file ApiQueryTestBase.php.

References as.

Referenced by merge().

Check that the parameter is a valid two element array, with the first element being API request and the second - expected result.

Definition at line 58 of file ApiQueryTestBase.php.

References MediaWikiTestCase\assertType().

Referenced by check(), and merge().


Member Data Documentation

Initial value:
 <<<STR
Each parameter must be an array of two elements,
first - an array of params to the API call,
and the second array - expected results as returned by the API
STR

Definition at line 31 of file ApiQueryTestBase.php.


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