Browse Source

chore(app): Do not clear unused cache key

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tags/v28.0.0beta1
Christoph Wurst 1 year ago
parent
commit
3d1acca1f3
No account linked to committer's email address
2 changed files with 0 additions and 12 deletions
  1. 0
    2
      lib/private/App/AppManager.php
  2. 0
    10
      tests/lib/App/AppManagerTest.php

+ 0
- 2
lib/private/App/AppManager.php View File

* Clear the cached list of apps when enabling/disabling an app * Clear the cached list of apps when enabling/disabling an app
*/ */
public function clearAppsCache() { public function clearAppsCache() {
$settingsMemCache = $this->memCacheFactory->createDistributed('settings');
$settingsMemCache->clear('listApps');
$this->appInfos = []; $this->appInfos = [];
} }



+ 0
- 10
tests/lib/App/AppManagerTest.php View File

); );
} }


protected function expectClearCache() {
$this->cache->expects($this->once())
->method('clear')
->with('listApps');
}

public function testEnableApp() { public function testEnableApp() {
$this->expectClearCache();
// making sure "files_trashbin" is disabled // making sure "files_trashbin" is disabled
if ($this->manager->isEnabledForUser('files_trashbin')) { if ($this->manager->isEnabledForUser('files_trashbin')) {
$this->manager->disableApp('files_trashbin'); $this->manager->disableApp('files_trashbin');
} }


public function testDisableApp() { public function testDisableApp() {
$this->expectClearCache();
$this->eventDispatcher->expects($this->once())->method('dispatchTyped')->with(new AppDisableEvent('files_trashbin')); $this->eventDispatcher->expects($this->once())->method('dispatchTyped')->with(new AppDisableEvent('files_trashbin'));
$this->manager->disableApp('files_trashbin'); $this->manager->disableApp('files_trashbin');
$this->assertEquals('no', $this->appConfig->getValue('files_trashbin', 'enabled', 'no')); $this->assertEquals('no', $this->appConfig->getValue('files_trashbin', 'enabled', 'no'));
->willReturn('group2'); ->willReturn('group2');


$groups = [$group1, $group2]; $groups = [$group1, $group2];
$this->expectClearCache();


/** @var AppManager|MockObject $manager */ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class) $manager = $this->getMockBuilder(AppManager::class)
->willReturn('group2'); ->willReturn('group2');


$groups = [$group1, $group2]; $groups = [$group1, $group2];
$this->expectClearCache();


/** @var AppManager|MockObject $manager */ /** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class) $manager = $this->getMockBuilder(AppManager::class)

Loading…
Cancel
Save