X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fdeferred%2FDeferredUpdatesTest.php;h=3b423563cace84fa3e5b8ab2ad13f5f190b700bb;hb=3daad1264bb80babc359f95843bd9b3d8ddc01e6;hp=2c199bc12aa1ca5b878238a4fd72c85d542b710f;hpb=ed92b00ea5b1af2638948beaf334bc28e22ff4b6;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/deferred/DeferredUpdatesTest.php b/tests/phpunit/includes/deferred/DeferredUpdatesTest.php index 2c199bc12a..3b423563ca 100644 --- a/tests/phpunit/includes/deferred/DeferredUpdatesTest.php +++ b/tests/phpunit/includes/deferred/DeferredUpdatesTest.php @@ -192,4 +192,30 @@ class DeferredUpdatesTest extends MediaWikiTestCase { DeferredUpdates::doUpdates(); } + + public function testPresendAddOnPostsendRun() { + $this->setMwGlobals( 'wgCommandLineMode', true ); + + $x = false; + $y = false; + wfGetLBFactory()->commitMasterChanges( __METHOD__ ); // clear anything + + DeferredUpdates::addCallableUpdate( + function () use ( &$x, &$y ) { + $x = true; + DeferredUpdates::addCallableUpdate( + function () use ( &$y ) { + $y = true; + }, + DeferredUpdates::PRESEND + ); + }, + DeferredUpdates::POSTSEND + ); + + DeferredUpdates::doUpdates(); + + $this->assertTrue( $x, "Outer POSTSEND update ran" ); + $this->assertTrue( $y, "Nested PRESEND update ran" ); + } }