Merge "Expose LinksUpdate recursive flag with a getter"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 13 Sep 2019 20:04:40 +0000 (20:04 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Sep 2019 20:04:40 +0000 (20:04 +0000)
includes/deferred/LinksUpdate.php
tests/phpunit/includes/deferred/LinksUpdateTest.php

index c4e8341..2bfdc0e 100644 (file)
@@ -1197,4 +1197,14 @@ class LinksUpdate extends DataUpdate {
 
                return $this->db;
        }
+
+       /**
+        * Whether or not this LinksUpdate will also update pages which transclude the
+        * current page or otherwise depend on it.
+        *
+        * @return bool
+        */
+       public function isRecursive() {
+               return $this->mRecursive;
+       }
 }
index cd3ddfa..1f9d29e 100644 (file)
@@ -430,4 +430,18 @@ class LinksUpdateTest extends MediaWikiLangTestCase {
                        $queueGroup->ack( $job );
                }
        }
+
+       public function testIsRecursive() {
+               list( $title, $po ) = $this->makeTitleAndParserOutput( 'Test', 1 );
+               $linksUpdate = new LinksUpdate( $title, $po );
+               $this->assertTrue( $linksUpdate->isRecursive(), 'LinksUpdate is recursive by default' );
+
+               $linksUpdate = new LinksUpdate( $title, $po, true );
+               $this->assertTrue( $linksUpdate->isRecursive(),
+                       'LinksUpdate is recursive when asked to be recursive' );
+
+               $linksUpdate = new LinksUpdate( $title, $po, false );
+               $this->assertFalse( $linksUpdate->isRecursive(),
+                       'LinksUpdate is not recursive when asked to be not recursive' );
+       }
 }