* @covers MultiWriteBagOStuff::doWrite
*/
public function testSetImmediate() {
- $key = wfRandomString();
- $value = wfRandomString();
+ $key = 'key';
+ $value = 'value';
$this->cache->set( $key, $value );
// Set in tier 1
* @covers MultiWriteBagOStuff
*/
public function testSyncMerge() {
- $key = wfRandomString();
- $value = wfRandomString();
+ $key = 'keyA';
+ $value = 'value';
$func = function () use ( $value ) {
return $value;
};
// Set in tier 1
$this->assertEquals( $value, $this->cache1->get( $key ), 'Written to tier 1' );
// Not yet set in tier 2
- $this->assertEquals( false, $this->cache2->get( $key ), 'Not written to tier 2' );
+ $this->assertFalse( $this->cache2->get( $key ), 'Not written to tier 2' );
$dbw->commit();
// Set in tier 2
$this->assertEquals( $value, $this->cache2->get( $key ), 'Written to tier 2' );
- $key = wfRandomString();
+ $key = 'keyB';
$dbw->begin();
$this->cache->merge( $key, $func, 0, 1, BagOStuff::WRITE_SYNC );
* @covers MultiWriteBagOStuff::set
*/
public function testSetDelayed() {
- $key = wfRandomString();
- $value = (object)[ 'v' => wfRandomString() ];
+ $key = 'key';
+ $value = (object)[ 'v' => 'saved value' ];
$expectValue = clone $value;
// XXX: DeferredUpdates bound to transactions in CLI mode
$this->cache->set( $key, $value );
// Test that later changes to $value don't affect the saved value (e.g. T168040)
- $value->v = 'bogus';
+ $value->v = 'other value';
// Set in tier 1
$this->assertEquals( $expectValue, $this->cache1->get( $key ), 'Written to tier 1' );
// Not yet set in tier 2
- $this->assertEquals( false, $this->cache2->get( $key ), 'Not written to tier 2' );
+ $this->assertFalse( $this->cache2->get( $key ), 'Not written to tier 2' );
$dbw->commit();
* @covers MultiWriteBagOStuff::makeKey
*/
public function testMakeKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeKey' ] )->getMock();
$cache1->expects( $this->once() )->method( 'makeKey' )
* @covers MultiWriteBagOStuff::makeGlobalKey
*/
public function testMakeGlobalKey() {
+ if ( defined( 'HHVM_VERSION' ) ) {
+ $this->markTestSkipped( 'HHVM Reflection buggy' );
+ }
+
$cache1 = $this->getMockBuilder( HashBagOStuff::class )
->setMethods( [ 'makeGlobalKey' ] )->getMock();
$cache1->expects( $this->once() )->method( 'makeGlobalKey' )
$this->assertSame( 'special', $cache->makeGlobalKey( 'a', 'b' ) );
}
+ /**
+ * @covers MultiWriteBagOStuff::add
+ */
public function testDuplicateStoreAdd() {
$bag = new HashBagOStuff();
$cache = new MultiWriteBagOStuff( [