MediaWiki  REL1_24
DeferredUpdatesTest.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class DeferredUpdatesTest extends MediaWikiTestCase {
00004 
00005     public function testDoUpdates() {
00006         $updates = array(
00007             '1' => 'deferred update 1',
00008             '2' => 'deferred update 2',
00009             '3' => 'deferred update 3',
00010             '2-1' => 'deferred update 1 within deferred update 2',
00011         );
00012         DeferredUpdates::addCallableUpdate(
00013             function () use ( $updates ) {
00014                 echo $updates['1'];
00015             }
00016         );
00017         DeferredUpdates::addCallableUpdate(
00018             function () use ( $updates ) {
00019                 echo $updates['2'];
00020                 DeferredUpdates::addCallableUpdate(
00021                     function () use ( $updates ) {
00022                         echo $updates['2-1'];
00023                     }
00024                 );
00025             }
00026         );
00027         DeferredUpdates::addCallableUpdate(
00028             function () use ( $updates ) {
00029                 echo $updates[3];
00030             }
00031         );
00032 
00033         $this->expectOutputString( implode( '', $updates ) );
00034 
00035         DeferredUpdates::doUpdates();
00036     }
00037 
00038 }