wiki.techinc.nl/tests/phpunit/includes/api/query/ApiQueryAllPagesTest.php
Aaron Schulz 815912062f Move ApiQuery* tests under the /query subdirectory
Consistency aside, this is useful for grouping more tests
into separate threads when using directory based suites.

Bug: T50217
Change-Id: Ife9acd5990c4ae4a5fc18371559e93d7d86fb57d
2020-10-30 03:31:12 +00:00

35 lines
919 B
PHP

<?php
/**
* @group API
* @group Database
* @group medium
*
* @covers ApiQueryAllPages
*/
class ApiQueryAllPagesTest extends ApiTestCase {
/**
* Test T27702
* Prefixes of API search requests are not handled with case sensitivity and may result
* in wrong search results
*/
public function testPrefixNormalizationSearchBug() {
$title = Title::newFromText( 'Category:Template:xyz' );
$page = WikiPage::factory( $title );
$page->doEditContent(
ContentHandler::makeContent( 'Some text', $page->getTitle() ),
'inserting content'
);
$result = $this->doApiRequest( [
'action' => 'query',
'list' => 'allpages',
'apnamespace' => NS_CATEGORY,
'apprefix' => 'Template:x' ] );
$this->assertArrayHasKey( 'query', $result[0] );
$this->assertArrayHasKey( 'allpages', $result[0]['query'] );
$this->assertContains( 'Category:Template:xyz', $result[0]['query']['allpages'][0] );
}
}