Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4097771
UploadLogFormatterTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
UploadLogFormatterTest.php
View Options
<?php
/**
* @covers \UploadLogFormatter
*/
class
UploadLogFormatterTest
extends
LogFormatterTestCase
{
/**
* Provide different rows from the logging table to test
* for backward compatibility.
* Do not change the existing data, just add a new database row
*/
public
static
function
provideUploadLogDatabaseRows
()
{
return
[
// Current format
[
[
'type'
=>
'upload'
,
'action'
=>
'upload'
,
'comment'
=>
'upload comment'
,
'namespace'
=>
NS_FILE
,
'title'
=>
'File.png'
,
'params'
=>
[
'img_sha1'
=>
'hash'
,
'img_timestamp'
=>
'20150101000000'
,
],
],
[
'text'
=>
'User uploaded File:File.png'
,
'api'
=>
[
'img_sha1'
=>
'hash'
,
'img_timestamp'
=>
'2015-01-01T00:00:00Z'
,
],
],
],
// Old format without params
[
[
'type'
=>
'upload'
,
'action'
=>
'upload'
,
'comment'
=>
'upload comment'
,
'namespace'
=>
NS_FILE
,
'title'
=>
'File.png'
,
'params'
=>
[],
],
[
'text'
=>
'User uploaded File:File.png'
,
'api'
=>
[],
],
],
];
}
/**
* @dataProvider provideUploadLogDatabaseRows
*/
public
function
testUploadLogDatabaseRows
(
$row
,
$extra
)
{
$this
->
doTestLogFormatter
(
$row
,
$extra
);
}
/**
* Provide different rows from the logging table to test
* for backward compatibility.
* Do not change the existing data, just add a new database row
*/
public
static
function
provideOverwriteLogDatabaseRows
()
{
return
[
// Current format
[
[
'type'
=>
'upload'
,
'action'
=>
'overwrite'
,
'comment'
=>
'upload comment'
,
'namespace'
=>
NS_FILE
,
'title'
=>
'File.png'
,
'params'
=>
[
'img_sha1'
=>
'hash'
,
'img_timestamp'
=>
'20150101000000'
,
],
],
[
'text'
=>
'User uploaded a new version of File:File.png'
,
'api'
=>
[
'img_sha1'
=>
'hash'
,
'img_timestamp'
=>
'2015-01-01T00:00:00Z'
,
],
],
],
// Old format without params
[
[
'type'
=>
'upload'
,
'action'
=>
'overwrite'
,
'comment'
=>
'upload comment'
,
'namespace'
=>
NS_FILE
,
'title'
=>
'File.png'
,
'params'
=>
[],
],
[
'text'
=>
'User uploaded a new version of File:File.png'
,
'api'
=>
[],
],
],
];
}
/**
* @dataProvider provideOverwriteLogDatabaseRows
*/
public
function
testOverwriteLogDatabaseRows
(
$row
,
$extra
)
{
$this
->
doTestLogFormatter
(
$row
,
$extra
);
}
/**
* Provide different rows from the logging table to test
* for backward compatibility.
* Do not change the existing data, just add a new database row
*/
public
static
function
provideRevertLogDatabaseRows
()
{
return
[
// Current format
[
[
'type'
=>
'upload'
,
'action'
=>
'revert'
,
'comment'
=>
'upload comment'
,
'namespace'
=>
NS_FILE
,
'title'
=>
'File.png'
,
'params'
=>
[
'img_sha1'
=>
'hash'
,
'img_timestamp'
=>
'20150101000000'
,
],
],
[
'text'
=>
'User reverted File:File.png to an old version'
,
'api'
=>
[
'img_sha1'
=>
'hash'
,
'img_timestamp'
=>
'2015-01-01T00:00:00Z'
,
],
],
],
// Old format without params
[
[
'type'
=>
'upload'
,
'action'
=>
'revert'
,
'comment'
=>
'upload comment'
,
'namespace'
=>
NS_FILE
,
'title'
=>
'File.png'
,
'params'
=>
[],
],
[
'text'
=>
'User reverted File:File.png to an old version'
,
'api'
=>
[],
],
],
];
}
/**
* @dataProvider provideRevertLogDatabaseRows
*/
public
function
testRevertLogDatabaseRows
(
$row
,
$extra
)
{
$this
->
doTestLogFormatter
(
$row
,
$extra
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Aug 18, 15:02 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
98/6d/501c5425a66a05e88c25943f72f1
Default Alt Text
UploadLogFormatterTest.php (3 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment