From: addshore Date: Tue, 10 Oct 2017 16:58:13 +0000 (+0100) Subject: RevisionStorageTest: code style fixes X-Git-Tag: 1.31.0-rc.0~1805^2~3 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=c94ffdd2f901df2b39b44b25a4985102b2e2df98;p=lhc%2Fweb%2Fwiklou.git RevisionStorageTest: code style fixes Change-Id: I0d8e6e58c74c3ba849f9cb4a3a159a62049604a3 --- diff --git a/tests/phpunit/includes/RevisionStorageTest.php b/tests/phpunit/includes/RevisionStorageTest.php index 8ed85fe550..08f128a37f 100644 --- a/tests/phpunit/includes/RevisionStorageTest.php +++ b/tests/phpunit/includes/RevisionStorageTest.php @@ -16,7 +16,7 @@ class RevisionStorageTest extends MediaWikiTestCase { */ private $the_page; - function __construct( $name = null, array $data = [], $dataName = '' ) { + public function __construct( $name = null, array $data = [], $dataName = '' ) { parent::__construct( $name, $data, $dataName ); $this->tablesUsed = array_merge( $this->tablesUsed, @@ -50,7 +50,8 @@ class RevisionStorageTest extends MediaWikiTestCase { $wgContentHandlers['DUMMY'] = 'DummyContentHandlerForTesting'; MWNamespace::clearCaches(); - $wgContLang->resetNamespaces(); # reset namespace cache + // Reset namespace cache + $wgContLang->resetNamespaces(); if ( !$this->the_page ) { $this->the_page = $this->createPage( 'RevisionStorageTest_the_page', @@ -74,7 +75,8 @@ class RevisionStorageTest extends MediaWikiTestCase { unset( $wgContentHandlers['DUMMY'] ); MWNamespace::clearCaches(); - $wgContLang->resetNamespaces(); # reset namespace cache + // Reset namespace cache + $wgContLang->resetNamespaces(); } protected function makeRevision( $props = null ) { @@ -461,20 +463,10 @@ class RevisionStorageTest extends MediaWikiTestCase { } public static function provideUserWasLastToEdit() { - return [ - [ # 0 - 3, true, # actually the last edit - ], - [ # 1 - 2, true, # not the current edit, but still by this user - ], - [ # 2 - 1, false, # edit by another user - ], - [ # 3 - 0, false, # first edit, by this user, but another user edited in the mean time - ], - ]; + yield 'actually the last edit' => [ 3, true ]; + yield 'not the current edit, but still by this user' => [ 2, true ]; + yield 'edit by another user' => [ 1, false ]; + yield 'first edit, by this user, but another user edited in the mean time' => [ 0, false ]; } /** @@ -502,7 +494,6 @@ class RevisionStorageTest extends MediaWikiTestCase { 'RevisionStorageTest_testUserWasLastToEdit', $ns ) ); $page->insertOn( $dbw ); - # zero $revisions[0] = new Revision( [ 'page' => $page->getId(), // we need the title to determine the page's default content model @@ -515,7 +506,6 @@ class RevisionStorageTest extends MediaWikiTestCase { ] ); $revisions[0]->insertOn( $dbw ); - # one $revisions[1] = new Revision( [ 'page' => $page->getId(), // still need the title, because $page->getId() is 0 (there's no entry in the page table) @@ -528,7 +518,6 @@ class RevisionStorageTest extends MediaWikiTestCase { ] ); $revisions[1]->insertOn( $dbw ); - # two $revisions[2] = new Revision( [ 'page' => $page->getId(), 'title' => $page->getTitle(), @@ -540,7 +529,6 @@ class RevisionStorageTest extends MediaWikiTestCase { ] ); $revisions[2]->insertOn( $dbw ); - # three $revisions[3] = new Revision( [ 'page' => $page->getId(), 'title' => $page->getTitle(), @@ -552,7 +540,6 @@ class RevisionStorageTest extends MediaWikiTestCase { ] ); $revisions[3]->insertOn( $dbw ); - # four $revisions[4] = new Revision( [ 'page' => $page->getId(), 'title' => $page->getTitle(),