3 class DeferredUpdatesTest
extends MediaWikiTestCase
{
4 public function testDoUpdatesWeb() {
5 $this->setMwGlobals( 'wgCommandLineMode', false );
8 '1' => 'deferred update 1',
9 '2' => 'deferred update 2',
10 '3' => 'deferred update 3',
11 '2-1' => 'deferred update 1 within deferred update 2',
13 DeferredUpdates
::addCallableUpdate(
14 function () use ( $updates ) {
18 DeferredUpdates
::addCallableUpdate(
19 function () use ( $updates ) {
21 DeferredUpdates
::addCallableUpdate(
22 function () use ( $updates ) {
28 DeferredUpdates
::addCallableUpdate(
29 function () use ( $updates ) {
34 $this->expectOutputString( implode( '', $updates ) );
36 DeferredUpdates
::doUpdates();
39 public function testDoUpdatesCLI() {
40 $this->setMwGlobals( 'wgCommandLineMode', true );
43 '1' => 'deferred update 1',
44 '2' => 'deferred update 2',
45 '2-1' => 'deferred update 1 within deferred update 2',
46 '3' => 'deferred update 3',
48 DeferredUpdates
::addCallableUpdate(
49 function () use ( $updates ) {
53 DeferredUpdates
::addCallableUpdate(
54 function () use ( $updates ) {
56 DeferredUpdates
::addCallableUpdate(
57 function () use ( $updates ) {
63 DeferredUpdates
::addCallableUpdate(
64 function () use ( $updates ) {
69 $this->expectOutputString( implode( '', $updates ) );
71 DeferredUpdates
::doUpdates();