$this->backend->setDebug( $bool );
}
+ public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
+ parent::deleteObjectsExpiringBefore( $date, $progressCallback );
+ return $this->backend->deleteObjectsExpiringBefore( $date, $progressCallback );
+ }
+
+ public function makeKey() {
+ return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
+ }
+
+ public function makeGlobalKey() {
+ return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
+ }
+
+ // These just call the backend (tested elsewhere)
+ // @codeCoverageIgnoreStart
+
public function lock( $key, $timeout = 6, $expiry = 6, $rclass = '' ) {
return $this->backend->lock( $key, $timeout, $expiry, $rclass );
}
return $this->backend->unlock( $key );
}
- public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
- parent::deleteObjectsExpiringBefore( $date, $progressCallback );
- return $this->backend->deleteObjectsExpiringBefore( $date, $progressCallback );
- }
-
public function getLastError() {
return $this->backend->getLastError();
}
public function clearLastError() {
- $this->backend->clearLastError();
+ return $this->backend->clearLastError();
}
public function modifySimpleRelayEvent( array $event ) {
return $this->backend->modifySimpleRelayEvent( $event );
}
- public function makeKey() {
- return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
- }
-
- public function makeGlobalKey() {
- return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
- }
-
+ // @codeCoverageIgnoreEnd
}
$this->assertEquals( true, $cache->get( 'bar' ) );
}
+ /**
+ * @covers CachedBagOStuff::setDebug
+ */
+ public function testSetDebug() {
+ $backend = new HashBagOStuff();
+ $cache = new CachedBagOStuff( $backend );
+ // Access private property 'debugMode'
+ $backend = TestingAccessWrapper::newFromObject( $backend );
+ $cache = TestingAccessWrapper::newFromObject( $cache );
+ $this->assertFalse( $backend->debugMode );
+ $this->assertFalse( $cache->debugMode );
+
+ $cache->setDebug( true );
+ // Should have set both
+ $this->assertTrue( $backend->debugMode, 'sets backend' );
+ $this->assertTrue( $cache->debugMode, 'sets self' );
+ }
+
+ /**
+ * @covers CachedBagOStuff::deleteObjectsExpiringBefore
+ */
+ public function testExpire() {
+ $backend = $this->getMockBuilder( HashBagOStuff::class )
+ ->setMethods( [ 'deleteObjectsExpiringBefore' ] )
+ ->getMock();
+ $backend->expects( $this->once() )
+ ->method( 'deleteObjectsExpiringBefore' )
+ ->willReturn( false );
+
+ $cache = new CachedBagOStuff( $backend );
+ $cache->deleteObjectsExpiringBefore( '20110401000000' );
+ }
+
/**
* @covers CachedBagOStuff::makeKey
*/