+ $this->assertEquals( $expectValue, $this->cache2->get( $key ), 'Written to tier 2' );
+ }
+
+ /**
+ * @covers MultiWriteBagOStuff::makeKey
+ */
+ public function testMakeKey() {
+ $cache1 = $this->getMockBuilder( HashBagOStuff::class )
+ ->setMethods( [ 'makeKey' ] )->getMock();
+ $cache1->expects( $this->once() )->method( 'makeKey' )
+ ->willReturn( 'special' );
+
+ $cache2 = $this->getMockBuilder( HashBagOStuff::class )
+ ->setMethods( [ 'makeKey' ] )->getMock();
+ $cache2->expects( $this->never() )->method( 'makeKey' );
+
+ $cache = new MultiWriteBagOStuff( [ 'caches' => [ $cache1, $cache2 ] ] );
+ $this->assertSame( 'special', $cache->makeKey( 'a', 'b' ) );
+ }
+
+ /**
+ * @covers MultiWriteBagOStuff::makeGlobalKey
+ */
+ public function testMakeGlobalKey() {
+ $cache1 = $this->getMockBuilder( HashBagOStuff::class )
+ ->setMethods( [ 'makeGlobalKey' ] )->getMock();
+ $cache1->expects( $this->once() )->method( 'makeGlobalKey' )
+ ->willReturn( 'special' );
+
+ $cache2 = $this->getMockBuilder( HashBagOStuff::class )
+ ->setMethods( [ 'makeGlobalKey' ] )->getMock();
+ $cache2->expects( $this->never() )->method( 'makeGlobalKey' );
+
+ $cache = new MultiWriteBagOStuff( [ 'caches' => [ $cache1, $cache2 ] ] );
+
+ $this->assertSame( 'special', $cache->makeGlobalKey( 'a', 'b' ) );