Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4160657
ApiUndeleteTest.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
ApiUndeleteTest.php
View Options
<?php
namespace
MediaWiki\Tests\Api
;
use
MediaWiki\MainConfigNames
;
use
MediaWiki\Title\Title
;
use
Wikimedia\Rdbms\IDBAccessObject
;
/**
* Tests for Undelete API.
*
* @group API
* @group Database
* @group medium
*
* @covers \MediaWiki\Api\ApiUndelete
*/
class
ApiUndeleteTest
extends
ApiTestCase
{
protected
function
setUp
():
void
{
parent
::
setUp
();
$this
->
overrideConfigValue
(
MainConfigNames
::
WatchlistExpiry
,
true
);
}
/**
* @covers \MediaWiki\Api\ApiUndelete::execute()
*/
public
function
testUndeleteWithWatch
():
void
{
$title
=
Title
::
makeTitle
(
NS_MAIN
,
'TestUndeleteWithWatch'
);
$sysop
=
$this
->
getTestSysop
()->
getUser
();
$watchlistManager
=
$this
->
getServiceContainer
()->
getWatchlistManager
();
// Create page.
$this
->
editPage
(
$title
,
'Test'
,
''
,
NS_MAIN
,
$sysop
);
// Delete page.
$this
->
doApiRequestWithToken
(
[
'action'
=>
'delete'
,
'title'
=>
$title
->
getPrefixedText
(),
]
);
// For good measure.
$this
->
assertFalse
(
$title
->
exists
(
IDBAccessObject
::
READ_LATEST
)
);
$this
->
assertFalse
(
$watchlistManager
->
isWatched
(
$sysop
,
$title
)
);
// Restore page, and watch with expiry.
$this
->
doApiRequestWithToken
(
[
'action'
=>
'undelete'
,
'title'
=>
$title
->
getPrefixedText
(),
'watchlist'
=>
'watch'
,
'watchlistexpiry'
=>
'99990123000000'
,
]
);
$this
->
assertTrue
(
$title
->
exists
(
IDBAccessObject
::
READ_LATEST
)
);
$this
->
assertTrue
(
$watchlistManager
->
isTempWatched
(
$sysop
,
$title
)
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 20 2026, 00:33 (9 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
17/da/92c416db6f77ba464d108238fedc
Default Alt Text
ApiUndeleteTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment