Merge "RevisionStorageTest: code style fixes"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 12 Oct 2017 00:07:01 +0000 (00:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 12 Oct 2017 00:07:01 +0000 (00:07 +0000)
tests/phpunit/includes/RevisionStorageTest.php

index 8ed85fe..08f128a 100644 (file)
@@ -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(),