If {{REVISIONID}} results in a re-parse, that re-parse will be post-send
unless the user has canonical parser options and will need the output for
page views anyway (e.g. the refresh after editing).
Also make getPreparedEdit() allow lazy-loading of the parser output via
a callback. A magic __get() method handles objects created the new way
but accessed by other code the old way.
Bug: T216306
Change-Id: I2012437c45dd605a6c0868dea47cf43dc67061d8
22 lines
454 B
PHP
22 lines
454 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Edit;
|
|
|
|
use ParserOutput;
|
|
use MediaWikiTestCase;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Edit\PreparedEdit
|
|
*/
|
|
class PreparedEditTest extends MediaWikiTestCase {
|
|
function testCallback() {
|
|
$output = new ParserOutput();
|
|
$edit = new PreparedEdit();
|
|
$edit->parserOutputCallback = function () {
|
|
return new ParserOutput();
|
|
};
|
|
|
|
$this->assertEquals( $output, $edit->getOutput() );
|
|
$this->assertEquals( $output, $edit->output );
|
|
}
|
|
}
|