Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5977015
UserEditCountInitJobTest.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
UserEditCountInitJobTest.php
View Options
<?php
/**
* @group JobQueue
* @group Database
*/
class
UserEditCountInitJobTest
extends
MediaWikiIntegrationTestCase
{
public
static
function
provideTestCases
()
{
// $startingEditCount, $setCount, $finalCount
yield
'Initiate count if not yet set'
=>
[
false
,
2
,
2
];
yield
'Update count when increasing'
=>
[
2
,
3
,
3
];
yield
'Never decrease count'
=>
[
10
,
3
,
10
];
}
/**
* @covers \UserEditCountInitJob
* @dataProvider provideTestCases
*/
public
function
testUserEditCountInitJob
(
$startingEditCount
,
$setCount
,
$finalCount
)
{
$user
=
$this
->
getMutableTestUser
()->
getUser
();
if
(
$startingEditCount
!==
false
)
{
$this
->
getServiceContainer
()->
getConnectionProvider
()->
getPrimaryDatabase
()
->
newUpdateQueryBuilder
()
->
update
(
'user'
)
->
set
(
[
'user_editcount'
=>
$startingEditCount
]
)
->
where
(
[
'user_id'
=>
$user
->
getId
()
]
)
->
caller
(
__METHOD__
)
->
execute
();
}
$job
=
new
UserEditCountInitJob
(
[
'userId'
=>
$user
->
getId
(),
'editCount'
=>
$setCount
]
);
$result
=
$job
->
run
();
$this
->
assertTrue
(
$result
);
$this
->
assertEquals
(
$finalCount
,
$user
->
getEditCount
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 19:35 (3 d, 3 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ca/53/e682e552dea4e1b1664ce95bd20a
Default Alt Text
UserEditCountInitJobTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment