jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/347512 )
Change subject: objectcache: Complete coverage for newAnything() ...................................................................... objectcache: Complete coverage for newAnything() * Fix typo that disabled testNewAnythingNoAccel(). Follows-up c5a0fa5bed, accidentally committed a local hack to disable the test. * Add missing case other types falling back and no DB. * Add missing case of no other types and no DB. Change-Id: If158f21053f0b3741f2625fe4455fdb31955a22f --- M tests/phpunit/includes/objectcache/ObjectCacheTest.php 1 file changed, 34 insertions(+), 1 deletion(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/phpunit/includes/objectcache/ObjectCacheTest.php b/tests/phpunit/includes/objectcache/ObjectCacheTest.php index d132183..f8ce24e 100644 --- a/tests/phpunit/includes/objectcache/ObjectCacheTest.php +++ b/tests/phpunit/includes/objectcache/ObjectCacheTest.php @@ -63,7 +63,7 @@ } /** @covers ObjectCache::newAnything */ - public function txestNewAnythingNoAccel() { + public function testNewAnythingNoAccel() { $this->setMwGlobals( [ 'wgMainCacheType' => CACHE_ACCEL ] ); @@ -79,4 +79,37 @@ '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.' + ); + } } -- To view, visit https://gerrit.wikimedia.org/r/347512 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If158f21053f0b3741f2625fe4455fdb31955a22f Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits