| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
" |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
namespace MediaWiki\Tests\Api\Query; |
| 23 |
|
| 24 |
use Exception; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
class ApiQueryContinue2Test extends ApiQueryContinueTestBase { |
| 33 |
|
| 34 |
protected $exceptionFromAddDBData; |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 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; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 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", |
| 67 |
]; |
| 68 |
}; |
| 69 |
|
| 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' ); |
| 76 |
} |
| 77 |
} |