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