summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/api/query/ApiQueryTestBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/api/query/ApiQueryTestBase.php')
-rw-r--r--tests/phpunit/includes/api/query/ApiQueryTestBase.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php
index 56c15b23..dabf72e0 100644
--- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php
+++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php
@@ -88,19 +88,26 @@ STR;
/**
* Checks that the request's result matches the expected results.
* @param array $values Array is a two element array( request, expected_results )
- * @throws Exception
+ * @param array $session
+ * @param bool $appendModule
+ * @param User $user
*/
- protected function check( $values ) {
+ protected function check( $values, array $session = null,
+ $appendModule = false, User $user = null
+ ) {
list( $req, $exp ) = $this->validateRequestExpectedPair( $values );
if ( !array_key_exists( 'action', $req ) ) {
$req['action'] = 'query';
}
+ if ( !array_key_exists( 'continue', $req ) ) {
+ $req['rawcontinue'] = '1';
+ }
foreach ( $req as &$val ) {
if ( is_array( $val ) ) {
$val = implode( '|', array_unique( $val ) );
}
}
- $result = $this->doApiRequest( $req );
+ $result = $this->doApiRequest( $req, $session, $appendModule, $user );
$this->assertResult( array( 'query' => $exp ), $result[0], $req );
}
@@ -113,9 +120,16 @@ STR;
if ( is_array( $message ) ) {
$message = http_build_query( $message );
}
+
+ // FIXME: once we migrate to phpunit 4.1+, hardcode ComparisonFailure exception use
+ $compEx = 'SebastianBergmann\Comparator\ComparisonFailure';
+ if ( !class_exists( $compEx ) ) {
+ $compEx = 'PHPUnit_Framework_ComparisonFailure';
+ }
+
throw new PHPUnit_Framework_ExpectationFailedException(
$e->getMessage() . "\nRequest: $message",
- new PHPUnit_Framework_ComparisonFailure(
+ new $compEx(
$exp,
$result,
print_r( $exp, true ),