Merge "Drop cache interwiki"
[mediawiki.git] / tests / phpunit / includes / api / query / ApiQueryContinue2Test.php
blob2eb6a62087119b89e342000f9d06e4f56e955d07
1 <?php
3 /**
4 * Copyright © 2013 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
22 namespace MediaWiki\Tests\Api\Query;
24 use Exception;
26 /**
27 * @group API
28 * @group Database
29 * @group medium
30 * @covers MediaWiki\Api\ApiQuery
32 class ApiQueryContinue2Test extends ApiQueryContinueTestBase {
33 /** @var Exception|null */
34 protected $exceptionFromAddDBData;
36 /**
37 * Create a set of pages. These must not change, otherwise the tests might give wrong results.
39 * @see MediaWikiIntegrationTestCase::addDBDataOnce()
41 public function addDBDataOnce() {
42 try {
43 $this->editPage( 'AQCT73462-A', '**AQCT73462-A** [[AQCT73462-B]] [[AQCT73462-C]]' );
44 $this->editPage( 'AQCT73462-B', '[[AQCT73462-A]] **AQCT73462-B** [[AQCT73462-C]]' );
45 $this->editPage( 'AQCT73462-C', '[[AQCT73462-A]] [[AQCT73462-B]] **AQCT73462-C**' );
46 $this->editPage( 'AQCT73462-A', '**AQCT73462-A** [[AQCT73462-B]] [[AQCT73462-C]]' );
47 $this->editPage( 'AQCT73462-B', '[[AQCT73462-A]] **AQCT73462-B** [[AQCT73462-C]]' );
48 $this->editPage( 'AQCT73462-C', '[[AQCT73462-A]] [[AQCT73462-B]] **AQCT73462-C**' );
49 } catch ( Exception $e ) {
50 $this->exceptionFromAddDBData = $e;
54 /**
55 * @group medium
57 public function testA() {
58 $this->mVerbose = false;
59 $mk = static function ( $g, $p, $gDir ) {
60 return [
61 'generator' => 'allpages',
62 'gapprefix' => 'AQCT73462-',
63 'prop' => 'links',
64 'gaplimit' => "$g",
65 'pllimit' => "$p",
66 'gapdir' => $gDir ? "ascending" : "descending",
69 // generator + 1 prop + 1 list
70 $data = $this->query( $mk( 99, 99, true ), 1, 'g1p', false ) +
71 [ 'batchcomplete' => true ];
72 $this->checkC( $data, $mk( 1, 1, true ), 6, 'g1p-11t' );
73 $this->checkC( $data, $mk( 2, 2, true ), 3, 'g1p-22t' );
74 $this->checkC( $data, $mk( 1, 1, false ), 6, 'g1p-11f' );
75 $this->checkC( $data, $mk( 2, 2, false ), 3, 'g1p-22f' );