wiki.techinc.nl/tests/phpunit/includes/api/ApiQueryAllPagesTest.php
Thiemo Kreuz d2227f415a tests: Fix broken assertion in ApiQueryAllPagesTest
The description had two errors:

* It talked about the presence of a specific value, but all it did
was checking a count.

* It was talking about the value *not* being there.

I just removed it. The possible error message from PHPUnit should be
good enough.

Change-Id: I7ea85dd37db8969bdd120f9600eeb6145e42eb1e
2019-09-30 16:22:54 +02: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] );
}
}