blob: df4213abdf81199bbfae569003364f71c5ffa56c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php
class DeferredUpdatesTest extends MediaWikiTestCase {
public function testDoUpdatesWeb() {
$this->setMwGlobals( 'wgCommandLineMode', false );
$updates = array(
'1' => 'deferred update 1',
'2' => 'deferred update 2',
'3' => 'deferred update 3',
'2-1' => 'deferred update 1 within deferred update 2',
);
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates['1'];
}
);
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates['2'];
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates['2-1'];
}
);
}
);
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates[3];
}
);
$this->expectOutputString( implode( '', $updates ) );
DeferredUpdates::doUpdates();
}
public function testDoUpdatesCLI() {
$this->setMwGlobals( 'wgCommandLineMode', true );
$updates = array(
'1' => 'deferred update 1',
'2' => 'deferred update 2',
'2-1' => 'deferred update 1 within deferred update 2',
'3' => 'deferred update 3',
);
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates['1'];
}
);
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates['2'];
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates['2-1'];
}
);
}
);
DeferredUpdates::addCallableUpdate(
function () use ( $updates ) {
echo $updates[3];
}
);
$this->expectOutputString( implode( '', $updates ) );
DeferredUpdates::doUpdates();
}
}
|