Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4197628
AbuseLoggerTest.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
AbuseLoggerTest.php
View Options
<?php
namespace
MediaWiki\Extension\AbuseFilter\Tests\Integration
;
use
MediaWiki\Deferred\DeferredUpdates
;
use
MediaWiki\Extension\AbuseFilter\AbuseFilterServices
;
use
MediaWiki\Extension\AbuseFilter\Variables\VariableHolder
;
use
MediaWikiIntegrationTestCase
;
/**
* @covers \MediaWiki\Extension\AbuseFilter\AbuseLogger
* @group Database
*/
class
AbuseLoggerTest
extends
MediaWikiIntegrationTestCase
{
/**
* Tests that the AbuseFilter logs are sent to CheckUser, and that CheckUser actually inserts the row to the
* cu_private_event table.
*/
public
function
testSendingLogsToCheckUser
()
{
$this
->
markTestSkippedIfExtensionNotLoaded
(
'CheckUser'
);
AbuseFilterServices
::
getAbuseLoggerFactory
()->
newLogger
(
$this
->
getExistingTestPage
()->
getTitle
(),
$this
->
getTestUser
()->
getUser
(),
VariableHolder
::
newFromArray
(
[
'action'
=>
'edit'
]
)
)->
addLogEntries
(
[
1
=>
[
'warn'
]
]
);
// Sending the log to CheckUser happens on a DeferredUpdate, so we need to run the updates.
DeferredUpdates
::
doUpdates
();
// Assert that an insert into the cu_private_event table occurred for the abusefilter hit.
// This may be a bit brittle if the cu_private_event table schema changes, but as AbuseFilter is
// a dependency of CheckUser in CI and the columns checked are unlikely to change, this is acceptable.
$this
->
assertSame
(
1
,
(
int
)
$this
->
getDb
()->
newSelectQueryBuilder
()
->
select
(
'COUNT(*)'
)
->
from
(
'cu_private_event'
)
->
where
(
[
'cupe_log_type'
=>
'abusefilter'
,
'cupe_log_action'
=>
'hit'
]
)
->
fetchField
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 20 2026, 21:37 (12 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7c/83/bc923e340a0ef35c62ad3bd8e9e1
Default Alt Text
AbuseLoggerTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment