API: Fixes for AuthManager
[mediawiki.git] / tests / phpunit / includes / objectcache / RedisBagOStuffTest.php
blobcf87a980987616bab487d44266e005a370335eaa
1 <?php
2 /**
3 * @group BagOStuff
4 */
5 class RedisBagOStuffTest extends MediaWikiTestCase {
6 /** @var RedisBagOStuff */
7 private $cache;
9 protected function setUp() {
10 parent::setUp();
11 $this->cache = TestingAccessWrapper::newFromObject( new RedisBagOStuff( [ 'servers' => [] ] ) );
14 /**
15 * @covers RedisBagOStuff::unserialize
16 * @dataProvider unserializeProvider
18 public function testUnserialize( $expected, $input, $message ) {
19 $actual = $this->cache->unserialize( $input );
20 $this->assertSame( $expected, $actual, $message );
23 public function unserializeProvider() {
24 return [
26 -1,
27 '-1',
28 'String representation of \'-1\'',
32 '0',
33 'String representation of \'0\'',
37 '1',
38 'String representation of \'1\'',
41 -1.0,
42 'd:-1;',
43 'Serialized negative double',
46 'foo',
47 's:3:"foo";',
48 'Serialized string',
53 /**
54 * @covers RedisBagOStuff::serialize
55 * @dataProvider serializeProvider
57 public function testSerialize( $expected, $input, $message ) {
58 $actual = $this->cache->serialize( $input );
59 $this->assertSame( $expected, $actual, $message );
62 public function serializeProvider() {
63 return [
65 -1,
66 -1,
67 '-1 as integer',
72 '0 as integer',
77 '1 as integer',
80 'd:-1;',
81 -1.0,
82 'Negative double',
85 's:3:"2.1";',
86 '2.1',
87 'Decimal string',
90 's:1:"1";',
91 '1',
92 'String representation of 1',
95 's:3:"foo";',
96 'foo',
97 'String',