Merge "Add GENDER support to $3 in logentry-rights-rights"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiQueryAllPagesTest.php
1 <?php
2
3 /**
4 * @group API
5 * @group Database
6 * @group medium
7 */
8 class ApiQueryAllPagesTest extends ApiTestCase {
9
10 protected function setUp() {
11 parent::setUp();
12 $this->doLogin();
13 }
14
15 /**
16 *Test bug 25702
17 *Prefixes of API search requests are not handled with case sensitivity and may result
18 *in wrong search results
19 */
20 public function testPrefixNormalizationSearchBug() {
21 $title = Title::newFromText( 'Category:Template:xyz' );
22 $page = WikiPage::factory( $title );
23 $page->doEdit( 'Some text', 'inserting content' );
24
25 $result = $this->doApiRequest( [
26 'action' => 'query',
27 'list' => 'allpages',
28 'apnamespace' => NS_CATEGORY,
29 'apprefix' => 'Template:x' ] );
30
31 $this->assertArrayHasKey( 'query', $result[0] );
32 $this->assertArrayHasKey( 'allpages', $result[0]['query'] );
33 $this->assertNotEquals( 0, count( $result[0]['query']['allpages'] ),
34 'allpages list does not contain page Category:Template:xyz' );
35 }
36 }