Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4092025
WikiBirthdayTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
WikiBirthdayTest.php
View Options
<?php
namespace
MediaWiki\Tests\Maintenance
;
use
MediaWiki\Title\Title
;
use
WikiBirthday
;
use
Wikimedia\Timestamp\ConvertibleTimestamp
;
/**
* @covers \WikiBirthday
* @group Database
* @author Dreamy Jazz
*/
class
WikiBirthdayTest
extends
MaintenanceBaseTestCase
{
protected
function
getMaintenanceClass
()
{
return
WikiBirthday
::
class
;
}
public
function
testExecuteForOneRevision
()
{
// Create a fake revision with a set timestamp
ConvertibleTimestamp
::
setFakeTime
(
'20230405060708'
);
$this
->
editPage
(
Title
::
newFromText
(
'Testing1234'
),
'Test1234'
);
// Set the timestamp to a year in advance
ConvertibleTimestamp
::
setFakeTime
(
'20240405060708'
);
$this
->
maintenance
->
execute
();
$this
->
expectOutputRegex
(
'/Wiki was created on: 5 April 2023.*age: 1 yr.*0 month.*0 day.*old/'
);
}
public
function
testExecuteForDeletedRevision
()
{
// Create a fake revision with a set timestamp, and then delete the associated page
ConvertibleTimestamp
::
setFakeTime
(
'20230505060708'
);
$editStatus
=
$this
->
editPage
(
Title
::
newFromText
(
'Testing1234'
),
'Test1234'
);
ConvertibleTimestamp
::
setFakeTime
(
'20230505060709'
);
$this
->
deletePage
(
$this
->
getServiceContainer
()->
getWikiPageFactory
()->
newFromTitle
(
$editStatus
->
getNewRevision
()->
getPage
()
)
);
// Set the timestamp to 3 months and 3 days in advance
ConvertibleTimestamp
::
setFakeTime
(
'20230708060708'
);
$this
->
maintenance
->
execute
();
$this
->
expectOutputRegex
(
'/Wiki was created on: 5 May.*age: 0 yr.*2 month.*3 day.*old/'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 18 2026, 12:01 (4 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b5/19/56e39e507cc22109ab7ffdf57122
Default Alt Text
WikiBirthdayTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment