Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7419030
OtlpSerializerTest.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
OtlpSerializerTest.php
View Options
<?php
namespace
Wikimedia\Tests\Telemetry
;
use
MediaWikiUnitTestCase
;
use
Wikimedia\Telemetry\OtlpSerializer
;
/**
* @covers \Wikimedia\Telemetry\OtlpSerializer
*/
class
OtlpSerializerTest
extends
MediaWikiUnitTestCase
{
/**
* @dataProvider provideKeyValuePairSerializationData
*/
public
function
testKeyValuePairSerialization
(
array
$input
,
array
$expected
):
void
{
$actual
=
OtlpSerializer
::
serializeKeyValuePairs
(
$input
);
$this
->
assertSame
(
$expected
,
$actual
);
}
public
static
function
provideKeyValuePairSerializationData
():
iterable
{
yield
'empty data'
=>
[
[],
[]
];
yield
'mixed data'
=>
[
[
'string-value'
=>
'string'
,
'numeric-value'
=>
123
,
'float-value'
=>
1.5
,
'object-value'
=>
new
\stdClass
(),
'boolean-value'
=>
true
,
'list-value'
=>
[
'a'
,
'b'
]
],
[
[
'key'
=>
'string-value'
,
'value'
=>
[
'stringValue'
=>
'string'
]
],
[
'key'
=>
'numeric-value'
,
'value'
=>
[
'intValue'
=>
123
]
],
[
'key'
=>
'float-value'
,
'value'
=>
[
'doubleValue'
=>
1.5
]
],
[
'key'
=>
'boolean-value'
,
'value'
=>
[
'boolValue'
=>
true
]
],
[
'key'
=>
'list-value'
,
'value'
=>
[
'arrayValue'
=>
[
'a'
,
'b'
]
]
]
]
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 04:15 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ad/14/87d7557935caac1f5ee39c49ccb9
Default Alt Text
OtlpSerializerTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment