$wrap->defaults = null;
$wrap->lazyOptions = [
'dateformat' => [ ParserOptions::class, 'initDateFormat' ],
+ 'speculativeRevId' => [ ParserOptions::class, 'initSpeculativeRevId' ],
];
$wrap->inCacheKey = [
'dateformat' => true,
], 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() );
+ }
+
}