wiki.techinc.nl/tests/phpunit/includes/api/ApiQueryAllPagesTest.php
btongminh 1f47c9b9ae Fix capitalization in ApiQueryBase::titlePartToKey()
ApiQueryBase::titlePartToKey now allows an extra parameter that
indicates the namespace in order to properly capitalize the title part.

This allows list=allcategories, list=allimages, list=alllinks,
list=allpages, list=deletedrevs and list=filearchive to
handle case-sensitivity properly for all parameters.

Bug: 25702
Change-Id: Iaa5a71ec536f3716f54bc84b39f645545dfd8660
2013-12-23 12:53:43 -05:00

30 lines
779 B
PHP

<?php
/**
* @group API
* @group Database
* @group medium
*/
class ApiQueryAllPagesTest extends ApiTestCase {
protected function setUp() {
parent::setUp();
$this->doLogin();
}
function testBug25702() {
$title = Title::newFromText( 'Category:Template:xyz' );
$page = WikiPage::factory( $title );
$page->doEdit( 'Some text', 'inserting content' );
$result = $this->doApiRequest( array(
'action' => 'query',
'list' => 'allpages',
'apnamespace' => NS_CATEGORY,
'apprefix' => 'Template:x' ) );
$this->assertArrayHasKey( 'query', $result[0] );
$this->assertArrayHasKey( 'allpages', $result[0]['query'] );
$this->assertNotEquals( 0, count( $result[0]['query']['allpages'] ),
'allpages list does not contain page Category:Template:xyz' );
}
}