4 * @covers MWCallableUpdate
6 class MWCallableUpdateTest
extends PHPUnit_Framework_TestCase
{
8 use MediaWikiCoversValidator
;
10 public function testDoUpdate() {
12 $update = new MWCallableUpdate( function () use ( &$ran ) {
15 $this->assertSame( 0, $ran );
17 $this->assertSame( 1, $ran );
20 public function testCancel() {
21 // Prepare update and DB
22 $db = new DatabaseTestHelper( __METHOD__
);
23 $db->begin( __METHOD__
);
25 $update = new MWCallableUpdate( function () use ( &$ran ) {
30 $db->rollback( __METHOD__
);
32 // Ensure it was cancelled
34 $this->assertSame( 0, $ran );