14 $update1 = SiteStatsUpdate::factory( [
'pages' => 1,
'users' => 2 ] );
15 $update2 = SiteStatsUpdate::factory( [
'users' => 1,
'images' => 1 ] );
17 $update1->merge( $update2 );
18 $wrapped = TestingAccessWrapper::newFromObject( $update1 );
20 $this->assertEquals( 1, $wrapped->pages );
21 $this->assertEquals( 3, $wrapped->users );
22 $this->assertEquals( 1, $wrapped->images );
23 $this->assertEquals( 0, $wrapped->edits );
24 $this->assertEquals( 0, $wrapped->articles );
37 $statsInit->refresh();
45 $dbw->begin( __METHOD__ );
47 $update = SiteStatsUpdate::factory( [
'pages' => 2,
'images' => 1,
'edits' => 2 ] );
48 $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount() );
50 $this->assertEquals( 1, DeferredUpdates::pendingUpdatesCount() );
59 $this->assertEquals( 1, DeferredUpdates::pendingUpdatesCount() );
61 $dbw->commit( __METHOD__ );
63 $this->assertEquals( 1, DeferredUpdates::pendingUpdatesCount() );
64 DeferredUpdates::doUpdates();
65 $this->assertEquals( 0, DeferredUpdates::pendingUpdatesCount() );
75 $statsInit->refresh();