Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2753270
SerializeEventTest.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
SerializeEventTest.php
View Options
<?php
/**
* PHP Unit tests for serializeEvent function
*
* @file
* @ingroup Extensions
*
* @author Nuria Ruiz <nuria@wikimedia.org>
*/
use
MediaWiki\Extension\EventLogging\EventLogging
;
/**
* @group EventLogging
* @covers \MediaWiki\Extension\EventLogging\EventLogging::serializeEvent
*/
class
SerializeEventTest
extends
MediaWikiIntegrationTestCase
{
/**
* Empty event should be returned as an object.
*/
public
function
testSerializeEventEmptyEvent
()
{
$encapsulatedEvent
=
[
'event'
=>
[],
'other'
=>
'some'
,
];
$expectedJson
=
"{
\"
event
\"
:{},
\"
other
\"
:
\"
some
\"
}"
;
$json
=
EventLogging
::
serializeEvent
(
$encapsulatedEvent
);
$this
->
assertEquals
(
$expectedJson
,
$json
,
'Empty event should be returned as an object'
);
}
/**
* Event should be returned without modifications
*/
public
function
testSerializeEventHappyCase
()
{
$event
=
[];
$event
[
'prop1'
]
=
'blah'
;
$encapsulatedEvent
=
[
'event'
=>
$event
,
'other'
=>
'some'
,
];
$expectedJson
=
"{
\"
event
\"
:{
\"
prop1
\"
:
\"
blah
\"
},
\"
other
\"
:
\"
some
\"
}"
;
$json
=
EventLogging
::
serializeEvent
(
$encapsulatedEvent
);
$this
->
assertEquals
(
$expectedJson
,
$json
,
'Event should be a simple json string'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 21:01 (1 d, 1 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
35/9f/a08999b94d55bdd6c455a6f3a5ed
Default Alt Text
SerializeEventTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment