3 use Wikimedia\TestingAccessWrapper
;
8 class RedisBagOStuffTest
extends MediaWikiUnitTestCase
{
10 /** @var RedisBagOStuff */
13 protected function setUp() {
16 if ( defined( 'HHVM_VERSION' ) ) {
17 $this->markTestSkipped( 'HHVM Reflection buggy' );
20 $cache = $this->getMockBuilder( RedisBagOStuff
::class )
21 ->disableOriginalConstructor()
23 $this->cache
= TestingAccessWrapper
::newFromObject( $cache );
27 * @covers RedisBagOStuff::unserialize
28 * @dataProvider unserializeProvider
30 public function testUnserialize( $expected, $input, $message ) {
31 $actual = $this->cache
->unserialize( $input );
32 $this->assertSame( $expected, $actual, $message );
35 public function unserializeProvider() {
40 'String representation of \'-1\'',
45 'String representation of \'0\'',
50 'String representation of \'1\'',
55 'Serialized negative double',
66 * @covers RedisBagOStuff::serialize
67 * @dataProvider serializeProvider
69 public function testSerialize( $expected, $input, $message ) {
70 $actual = $this->cache
->serialize( $input );
71 $this->assertSame( $expected, $actual, $message );
74 public function serializeProvider() {
104 'String representation of 1',