MediaWiki
REL1_30
RedisBagOStuffTest.php
Go to the documentation of this file.
1
<?php
2
3
use Wikimedia\TestingAccessWrapper;
4
8
class
RedisBagOStuffTest
extends
PHPUnit_Framework_TestCase {
10
private
$cache
;
11
12
protected
function
setUp
() {
13
parent::setUp();
14
$cache
= $this->getMockBuilder(
'RedisBagOStuff'
)
15
->disableOriginalConstructor()
16
->getMock();
17
$this->
cache
= TestingAccessWrapper::newFromObject(
$cache
);
18
}
19
24
public
function
testUnserialize
( $expected,
$input
, $message ) {
25
$actual = $this->
cache
->unserialize(
$input
);
26
$this->assertSame( $expected, $actual, $message );
27
}
28
29
public
function
unserializeProvider
() {
30
return
[
31
[
32
-1,
33
'-1'
,
34
'String representation of \'-1\''
,
35
],
36
[
37
0,
38
'0'
,
39
'String representation of \'0\''
,
40
],
41
[
42
1,
43
'1'
,
44
'String representation of \'1\''
,
45
],
46
[
47
-1.0,
48
'd:-1;'
,
49
'Serialized negative double'
,
50
],
51
[
52
'foo'
,
53
's:3:"foo";'
,
54
'Serialized string'
,
55
]
56
];
57
}
58
63
public
function
testSerialize
( $expected,
$input
, $message ) {
64
$actual = $this->
cache
->serialize(
$input
);
65
$this->assertSame( $expected, $actual, $message );
66
}
67
68
public
function
serializeProvider
() {
69
return
[
70
[
71
-1,
72
-1,
73
'-1 as integer'
,
74
],
75
[
76
0,
77
0,
78
'0 as integer'
,
79
],
80
[
81
1,
82
1,
83
'1 as integer'
,
84
],
85
[
86
'd:-1;'
,
87
-1.0,
88
'Negative double'
,
89
],
90
[
91
's:3:"2.1";'
,
92
'2.1'
,
93
'Decimal string'
,
94
],
95
[
96
's:1:"1";'
,
97
'1'
,
98
'String representation of 1'
,
99
],
100
[
101
's:3:"foo";'
,
102
'foo'
,
103
'String'
,
104
],
105
];
106
}
107
}
RedisBagOStuffTest
BagOStuff.
Definition
RedisBagOStuffTest.php:8
RedisBagOStuffTest\setUp
setUp()
Definition
RedisBagOStuffTest.php:12
RedisBagOStuffTest\unserializeProvider
unserializeProvider()
Definition
RedisBagOStuffTest.php:29
RedisBagOStuffTest\$cache
RedisBagOStuff $cache
Definition
RedisBagOStuffTest.php:10
RedisBagOStuffTest\testSerialize
testSerialize( $expected, $input, $message)
RedisBagOStuff::serialize serializeProvider.
Definition
RedisBagOStuffTest.php:63
RedisBagOStuffTest\testUnserialize
testUnserialize( $expected, $input, $message)
RedisBagOStuff::unserialize unserializeProvider.
Definition
RedisBagOStuffTest.php:24
RedisBagOStuffTest\serializeProvider
serializeProvider()
Definition
RedisBagOStuffTest.php:68
RedisBagOStuff
Redis-based caching module for redis server >= 2.6.12.
Definition
RedisBagOStuff.php:28
cache
you have access to all of the normal MediaWiki so you can get a DB use the cache
Definition
maintenance.txt:55
$input
if(is_array($mode)) switch( $mode) $input
Definition
postprocess-phan.php:141
tests
phpunit
includes
objectcache
RedisBagOStuffTest.php
Generated on Mon Nov 25 2024 15:43:53 for MediaWiki by
1.10.0