Merge "Selenium: record video of every test"
[lhc/web/wiklou.git] / tests / phpunit / includes / parser / ParserOptionsTest.php
index 8c17780..6413ddd 100644 (file)
@@ -13,6 +13,7 @@ class ParserOptionsTest extends MediaWikiTestCase {
                $wrap->defaults = null;
                $wrap->lazyOptions = [
                        'dateformat' => [ ParserOptions::class, 'initDateFormat' ],
+                       'speculativeRevId' => [ ParserOptions::class, 'initSpeculativeRevId' ],
                ];
                $wrap->inCacheKey = [
                        'dateformat' => true,
@@ -309,4 +310,19 @@ class ParserOptionsTest extends MediaWikiTestCase {
                ], ParserOptions::allCacheVaryingOptions() );
        }
 
+       public function testGetSpeculativeRevid() {
+               $options = new ParserOptions();
+
+               $this->assertFalse( $options->getSpeculativeRevId() );
+
+               $counter = 0;
+               $options->setSpeculativeRevIdCallback( function () use( &$counter ) {
+                       return ++$counter;
+               } );
+
+               // make sure the same value is re-used once it is determined
+               $this->assertSame( 1, $options->getSpeculativeRevId() );
+               $this->assertSame( 1, $options->getSpeculativeRevId() );
+       }
+
 }