Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4143777
DeleteArchivedRevisionsTest.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
DeleteArchivedRevisionsTest.php
View Options
<?php
namespace
MediaWiki\Tests\Maintenance
;
use
DeleteArchivedRevisions
;
use
MediaWiki\Tests\Unit\Permissions\MockAuthorityTrait
;
/**
* @covers \DeleteArchivedRevisions
* @group Database
* @author Dreamy Jazz
*/
class
DeleteArchivedRevisionsTest
extends
MaintenanceBaseTestCase
{
use
MockAuthorityTrait
;
protected
function
getMaintenanceClass
()
{
return
DeleteArchivedRevisions
::
class
;
}
/** @dataProvider provideExecute */
public
function
testExecute
(
$options
,
$expectedRowCountAfterExecution
,
$expectedOutputRegex
)
{
// Create a page and then delete it
$testPage
=
$this
->
getExistingTestPage
();
$deleteStatus
=
$this
->
getServiceContainer
()->
getDeletePageFactory
()
->
newDeletePage
(
$testPage
,
$this
->
mockRegisteredUltimateAuthority
()
)
->
deleteIfAllowed
(
'test'
);
$this
->
assertStatusGood
(
$deleteStatus
);
// Check that this has caused a revision to be added to the archive table
$this
->
newSelectQueryBuilder
()
->
select
(
'COUNT(*)'
)
->
from
(
'archive'
)
->
assertFieldValue
(
1
);
// Call ::execute
foreach
(
$options
as
$name
=>
$value
)
{
$this
->
maintenance
->
setOption
(
$name
,
$value
);
}
$this
->
maintenance
->
execute
();
// Verify that the archive table is now empty.
$this
->
newSelectQueryBuilder
()
->
select
(
'COUNT(*)'
)
->
from
(
'archive'
)
->
assertFieldValue
(
$expectedRowCountAfterExecution
);
$this
->
expectOutputRegex
(
$expectedOutputRegex
);
}
public
static
function
provideExecute
()
{
return
[
'Dry-run'
=>
[
[],
1
,
'/Found 1 revisions to delete/'
],
'Actual deletion'
=>
[
[
'delete'
=>
1
],
0
,
'/Deleting archived revisions.*1 revisions deleted/'
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 19 2026, 16:57 (4 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
53/f4/0cdfbccf1f171caaac8c8ab79add
Default Alt Text
DeleteArchivedRevisionsTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment