Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5957571
RedisBagOStuffTest.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
RedisBagOStuffTest.php
View Options
<?php
use
Wikimedia\ObjectCache\RedisBagOStuff
;
use
Wikimedia\TestingAccessWrapper
;
/**
* @covers \Wikimedia\ObjectCache\RedisBagOStuff
* @group BagOStuff
*/
class
RedisBagOStuffTest
extends
MediaWikiUnitTestCase
{
/** @var RedisBagOStuff */
private
$cache
;
protected
function
setUp
():
void
{
parent
::
setUp
();
$cache
=
$this
->
createMock
(
RedisBagOStuff
::
class
);
$this
->
cache
=
TestingAccessWrapper
::
newFromObject
(
$cache
);
}
/**
* @dataProvider unserializeProvider
*/
public
function
testUnserialize
(
$expected
,
$input
,
$message
)
{
$actual
=
$this
->
cache
->
unserialize
(
$input
);
$this
->
assertSame
(
$expected
,
$actual
,
$message
);
}
public
static
function
unserializeProvider
()
{
return
[
[
-
1
,
'-1'
,
'String representation of
\'
-1
\'
'
,
],
[
0
,
'0'
,
'String representation of
\'
0
\'
'
,
],
[
1
,
'1'
,
'String representation of
\'
1
\'
'
,
],
[
-
1.0
,
'd:-1;'
,
'Serialized negative double'
,
],
[
'foo'
,
's:3:"foo";'
,
'Serialized string'
,
]
];
}
/**
* @dataProvider serializeProvider
*/
public
function
testSerialize
(
$expected
,
$input
,
$message
)
{
$actual
=
$this
->
cache
->
serialize
(
$input
);
$this
->
assertSame
(
$expected
,
$actual
,
$message
);
}
public
function
serializeProvider
()
{
return
[
[
-
1
,
-
1
,
'-1 as integer'
,
],
[
0
,
0
,
'0 as integer'
,
],
[
1
,
1
,
'1 as integer'
,
],
[
'd:-1;'
,
-
1.0
,
'Negative double'
,
],
[
's:3:"2.1";'
,
'2.1'
,
'Decimal string'
,
],
[
's:1:"1";'
,
'1'
,
'String representation of 1'
,
],
[
's:3:"foo";'
,
'foo'
,
'String'
,
],
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 05:12 (2 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c5/22/6804043093f0eff5f929fbc38da3
Default Alt Text
RedisBagOStuffTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment