aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/objectcache/ObjectCacheTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/objectcache/ObjectCacheTest.php')
-rw-r--r--tests/phpunit/includes/objectcache/ObjectCacheTest.php35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/phpunit/includes/objectcache/ObjectCacheTest.php b/tests/phpunit/includes/objectcache/ObjectCacheTest.php
index d132183eacd4..f8ce24ec5533 100644
--- a/tests/phpunit/includes/objectcache/ObjectCacheTest.php
+++ b/tests/phpunit/includes/objectcache/ObjectCacheTest.php
@@ -63,7 +63,7 @@ class ObjectCacheTest extends MediaWikiTestCase {
}
/** @covers ObjectCache::newAnything */
- public function txestNewAnythingNoAccel() {
+ public function testNewAnythingNoAccel() {
$this->setMwGlobals( [
'wgMainCacheType' => CACHE_ACCEL
] );
@@ -79,4 +79,37 @@ class ObjectCacheTest extends MediaWikiTestCase {
'Fallback to DB if available types fall back to Empty'
);
}
+
+ /** @covers ObjectCache::newAnything */
+ public function testNewAnythingNoAccelNoDb() {
+ $this->overrideMwServices(); // Ensures restore on tear down
+ MediaWiki\MediaWikiServices::disableStorageBackend();
+
+ $this->setMwGlobals( [
+ 'wgMainCacheType' => CACHE_ACCEL
+ ] );
+
+ $this->setCacheConfig( [
+ // Mock APC not being installed (T160519, T147161)
+ CACHE_ACCEL => [ 'class' => 'EmptyBagOStuff' ]
+ ] );
+
+ $this->assertInstanceOf(
+ EmptyBagOStuff::class,
+ ObjectCache::newAnything( [] ),
+ 'Fallback to none if available types and DB are unavailable'
+ );
+ }
+
+ /** @covers ObjectCache::newAnything */
+ public function testNewAnythingNothingNoDb() {
+ $this->overrideMwServices();
+ MediaWiki\MediaWikiServices::disableStorageBackend();
+
+ $this->assertInstanceOf(
+ EmptyBagOStuff::class,
+ ObjectCache::newAnything( [] ),
+ 'No available types or DB. Fallback to none.'
+ );
+ }
}