MediaWiki REL1_33
SiteStatsTest.php
Go to the documentation of this file.
1<?php
2
4
9 $cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
10 $this->setService( 'MainWANObjectCache', $cache );
11 $jobq = JobQueueGroup::singleton();
12
13 $jobq->push( new NullJob( Title::newMainPage(), [] ) );
14 $this->assertEquals( 1, SiteStats::jobs(),
15 'A single job enqueued bumps jobscount stat to 1' );
16
17 $jobq->push( new NullJob( Title::newMainPage(), [] ) );
18 $this->assertEquals( 1, SiteStats::jobs(),
19 'SiteStats::jobs() count does not reflect addition ' .
20 'of a second job (cached)'
21 );
22
23 $jobq->get( 'null' )->delete(); // clear jobqueue
24 $this->assertEquals( 0, $jobq->get( 'null' )->getSize(),
25 'Job queue for NullJob has been cleaned' );
26
27 $cache->delete( $cache->makeKey( 'SiteStats', 'jobscount' ) );
28 $this->assertEquals( 1, SiteStats::jobs(),
29 'jobs count is kept in process cache' );
30
31 $cache->clearProcessCache();
32 $this->assertEquals( 0, SiteStats::jobs() );
33 }
34
35}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Simple store for keeping values in an associative array for the current process.
setService( $name, $object)
Sets a service, maintaining a stashed version of the previous service to be restored in tearDown.
Degenerate job that does nothing, but can optionally replace itself in the queue and/or sleep for a b...
Definition NullJob.php:47
testJobsCountGetCached()
SiteStats::jobs.
static jobs()
Total number of jobs in the job queue.
Multi-datacenter aware caching interface.
$cache
Definition mcc.php:33