Merge "Chinese Conversion Table Update 2017-6"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiQueryAllPagesTest.php
index 124988f..b482c31 100644 (file)
@@ -4,6 +4,8 @@
  * @group API
  * @group Database
  * @group medium
+ *
+ * @covers ApiQueryAllPages
  */
 class ApiQueryAllPagesTest extends ApiTestCase {
 
@@ -13,18 +15,24 @@ class ApiQueryAllPagesTest extends ApiTestCase {
        }
 
        /**
-        * @todo give this test a real name explaining what is being tested here
+        *Test T27702
+        *Prefixes of API search requests are not handled with case sensitivity and may result
+        *in wrong search results
         */
-       public function testBug25702() {
+       public function testPrefixNormalizationSearchBug() {
                $title = Title::newFromText( 'Category:Template:xyz' );
                $page = WikiPage::factory( $title );
-               $page->doEdit( 'Some text', 'inserting content' );
 
-               $result = $this->doApiRequest( array(
+               $page->doEditContent(
+                       ContentHandler::makeContent( 'Some text', $page->getTitle() ),
+                       'inserting content'
+               );
+
+               $result = $this->doApiRequest( [
                        'action' => 'query',
                        'list' => 'allpages',
                        'apnamespace' => NS_CATEGORY,
-                       'apprefix' => 'Template:x' ) );
+                       'apprefix' => 'Template:x' ] );
 
                $this->assertArrayHasKey( 'query', $result[0] );
                $this->assertArrayHasKey( 'allpages', $result[0]['query'] );