3 namespace MediaWiki\Tests\Maintenance
;
8 * @covers \ShowSiteStats
12 class ShowSiteStatsTest
extends MaintenanceBaseTestCase
{
14 protected function getMaintenanceClass() {
15 return ShowSiteStats
::class;
18 public function testExecute() {
19 $this->maintenance
->execute();
20 $this->expectOutputString(
21 "Total edits : 123\n" .
22 "Number of articles: 12\n" .
23 "Total pages : 20\n" .
24 "Number of users : 14\n" .
25 "Active users : 4\n" .
26 "Number of images : 3\n"
30 public function addDBData() {
31 // Add test data to the site_stats table.
32 $this->getDb()->newReplaceQueryBuilder()
33 ->table( 'site_stats' )
36 'ss_total_edits' => 123,
37 'ss_good_articles' => 12,
38 'ss_total_pages' => 20,
40 'ss_active_users' => 4,
43 ->uniqueIndexFields( [ 'ss_row_id' ] )
44 ->caller( __METHOD__
)