X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/supprimer.php?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiQueryRecentChangesIntegrationTest.php;h=ff0e2e69a8e86c1db8339e09810339e9c4781462;hb=1bd43b1bffffc3720e1ef743d802e88fdf849b0f;hp=5b43dd1b8316c90c45e9a8b17441f0b34e814c93;hpb=046250bfc357c3b4f5c5106aa223d608ce83c203;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiQueryRecentChangesIntegrationTest.php b/tests/phpunit/includes/api/ApiQueryRecentChangesIntegrationTest.php index 5b43dd1b83..ff0e2e69a8 100644 --- a/tests/phpunit/includes/api/ApiQueryRecentChangesIntegrationTest.php +++ b/tests/phpunit/includes/api/ApiQueryRecentChangesIntegrationTest.php @@ -149,16 +149,8 @@ class ApiQueryRecentChangesIntegrationTest extends ApiTestCase { return $response[0]['query']['recentchanges']; } - private function getTitleFormatter() { - return new MediaWikiTitleCodec( - Language::factory( 'en' ), - MediaWikiServices::getInstance()->getGenderCache() - ); - } - private function getPrefixedText( LinkTarget $target ) { - $formatter = $this->getTitleFormatter(); - return $formatter->getPrefixedText( $target ); + return MediaWikiServices::getInstance()->getTitleFormatter()->getPrefixedText( $target ); } public function testListRecentChanges_returnsRCInfo() { @@ -863,6 +855,65 @@ class ApiQueryRecentChangesIntegrationTest extends ApiTestCase { ); } + public function testTitleParams() { + $page1 = new TitleValue( 0, 'ApiQueryRecentChangesIntegrationTestPage' ); + $page2 = new TitleValue( 1, 'ApiQueryRecentChangesIntegrationTestPage2' ); + $page3 = new TitleValue( 0, 'ApiQueryRecentChangesIntegrationTestPage3' ); + $this->doPageEdits( + $this->getLoggedInTestUser(), + [ + [ + 'target' => $page1, + 'summary' => 'Create the page', + ], + [ + 'target' => $page2, + 'summary' => 'Create the page', + ], + [ + 'target' => $page3, + 'summary' => 'Create the page', + ], + ] + ); + + $result = $this->doListRecentChangesRequest( + [ + 'rctitle' => 'ApiQueryRecentChangesIntegrationTestPage', + 'rcprop' => 'title' + ] + ); + + $result2 = $this->doListRecentChangesRequest( + [ + 'rctitle' => 'Talk:ApiQueryRecentChangesIntegrationTestPage2', + 'rcprop' => 'title' + ] + ); + + $this->assertEquals( + [ + [ + 'type' => 'new', + 'ns' => $page1->getNamespace(), + 'title' => $this->getPrefixedText( $page1 ) + ], + ], + $this->getItemsFromApiResponse( $result ) + ); + + $this->assertEquals( + [ + [ + 'type' => 'new', + 'ns' => $page2->getNamespace(), + 'title' => $this->getPrefixedText( $page2 ) + ], + ], + $this->getItemsFromApiResponse( $result2 ) + ); + } + public function testStartEndParams() { $target = new TitleValue( 0, 'ApiQueryRecentChangesIntegrationTestPage' ); $this->doPageEdit( $this->getLoggedInTestUser(), $target, 'Create the page' );