Page MenuHomeWickedGov Phorge

HistoryTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

HistoryTest.php

<?php
use MediaWiki\User\User;
/**
* @group CentralNotice
* @group medium
* @group Database
*/
class HistoryTest extends MediaWikiIntegrationTestCase {
private User $userUser;
private CentralNoticeTestFixtures $cnFixtures;
protected function setUp(): void {
parent::setUp();
$this->userUser = $this->getTestUser()->getUser();
$this->cnFixtures = new CentralNoticeTestFixtures( $this->getTestSysop()->getUser() );
}
protected function tearDown(): void {
$this->cnFixtures->tearDownTestCases();
parent::tearDown();
}
/**
* @covers Campaign::getHistoricalCampaigns
*/
public function testStaleHistoricalCampaigns() {
// Bug was that expired campaigns would still be included in the
// history, as long as they were enabled.
$this->cnFixtures->setupTestCaseWithDefaults(
[
'setup' => [
'campaigns' => [
[
'banners' => [
[]
],
],
],
]
] );
$made_by_ts = wfTimestamp( TS_MW );
$this->assertCount( 1, Campaign::getHistoricalCampaigns( $made_by_ts ) );
$initialSettings = Campaign::getCampaignSettings(
$this->cnFixtures->spec['campaigns'][0]['name'] );
sleep( 1 );
// FIXME: Campaign::updateSettings
$newSettings = [
'end' => $made_by_ts,
] + $initialSettings;
Campaign::updateNoticeDate(
$this->cnFixtures->spec['campaigns'][0]['name'],
$newSettings['start'],
$newSettings['end']
);
Campaign::processAfterCampaignChange(
'modified',
$this->cnFixtures->spec['campaigns'][0]['id'],
$this->cnFixtures->spec['campaigns'][0]['name'],
$this->userUser,
$initialSettings,
$newSettings
);
$modified_ts = wfTimestamp( TS_MW );
$this->assertCount( 0, Campaign::getHistoricalCampaigns( $modified_ts ) );
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Jul 3, 21:02 (1 d, 1 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
4a/a2/aa76c0f9fe8e2ef11c550ef90533
Default Alt Text
HistoryTest.php (1 KB)

Event Timeline