MediaWiki
REL1_31
RedisBagOStuffTest.php
Go to the documentation of this file.
1
<?php
2
3
use Wikimedia\TestingAccessWrapper;
4
8
class
RedisBagOStuffTest
extends
PHPUnit\Framework\TestCase {
9
10
use MediaWikiCoversValidator;
11
13
private
$cache
;
14
15
protected
function
setUp
() {
16
parent::setUp();
17
$cache
= $this->getMockBuilder( RedisBagOStuff::class )
18
->disableOriginalConstructor()
19
->getMock();
20
$this->
cache
= TestingAccessWrapper::newFromObject(
$cache
);
21
}
22
27
public
function
testUnserialize
( $expected,
$input
, $message ) {
28
$actual = $this->
cache
->unserialize(
$input
);
29
$this->assertSame( $expected, $actual, $message );
30
}
31
32
public
function
unserializeProvider
() {
33
return
[
34
[
35
-1,
36
'-1'
,
37
'String representation of \'-1\''
,
38
],
39
[
40
0,
41
'0'
,
42
'String representation of \'0\''
,
43
],
44
[
45
1,
46
'1'
,
47
'String representation of \'1\''
,
48
],
49
[
50
-1.0,
51
'd:-1;'
,
52
'Serialized negative double'
,
53
],
54
[
55
'foo'
,
56
's:3:"foo";'
,
57
'Serialized string'
,
58
]
59
];
60
}
61
66
public
function
testSerialize
( $expected,
$input
, $message ) {
67
$actual = $this->
cache
->serialize(
$input
);
68
$this->assertSame( $expected, $actual, $message );
69
}
70
71
public
function
serializeProvider
() {
72
return
[
73
[
74
-1,
75
-1,
76
'-1 as integer'
,
77
],
78
[
79
0,
80
0,
81
'0 as integer'
,
82
],
83
[
84
1,
85
1,
86
'1 as integer'
,
87
],
88
[
89
'd:-1;'
,
90
-1.0,
91
'Negative double'
,
92
],
93
[
94
's:3:"2.1";'
,
95
'2.1'
,
96
'Decimal string'
,
97
],
98
[
99
's:1:"1";'
,
100
'1'
,
101
'String representation of 1'
,
102
],
103
[
104
's:3:"foo";'
,
105
'foo'
,
106
'String'
,
107
],
108
];
109
}
110
}
RedisBagOStuffTest
BagOStuff.
Definition
RedisBagOStuffTest.php:8
RedisBagOStuffTest\setUp
setUp()
Definition
RedisBagOStuffTest.php:15
RedisBagOStuffTest\unserializeProvider
unserializeProvider()
Definition
RedisBagOStuffTest.php:32
RedisBagOStuffTest\$cache
RedisBagOStuff $cache
Definition
RedisBagOStuffTest.php:13
RedisBagOStuffTest\testSerialize
testSerialize( $expected, $input, $message)
RedisBagOStuff::serialize serializeProvider.
Definition
RedisBagOStuffTest.php:66
RedisBagOStuffTest\testUnserialize
testUnserialize( $expected, $input, $message)
RedisBagOStuff::unserialize unserializeProvider.
Definition
RedisBagOStuffTest.php:27
RedisBagOStuffTest\serializeProvider
serializeProvider()
Definition
RedisBagOStuffTest.php:71
RedisBagOStuff
Redis-based caching module for redis server >= 2.6.12 and phpredis >= 2.2.4.
Definition
RedisBagOStuff.php:32
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:145
tests
phpunit
includes
objectcache
RedisBagOStuffTest.php
Generated on Mon Nov 25 2024 15:36:29 for MediaWiki by
1.10.0