mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-04 10:14:13 +08:00
Add Cache Reset Actions
- Add configuration file for module actions that should reset cache - Expose cache reset actions in the system config api - Add route event listener to reset cache when navigating a way from defined cache reset actions - Update unit tests
This commit is contained in:
parent
b52bbf6a6d
commit
ac0b0eb1b4
6 changed files with 76 additions and 9 deletions
|
@ -56,6 +56,7 @@ class SystemConfigHandlerTest extends Unit
|
|||
'datef' => true,
|
||||
'timef' => true,
|
||||
'currency' => true,
|
||||
'cache_reset_actions' => true
|
||||
];
|
||||
|
||||
$moduleMapper = new ModuleNameMapperHandler(
|
||||
|
@ -130,6 +131,12 @@ class SystemConfigHandlerTest extends Unit
|
|||
$sugar_config['datef'] = 'm/d/Y';
|
||||
$sugar_config['timef'] = 'H:i';
|
||||
|
||||
$cacheResetActions = [
|
||||
'users' => [
|
||||
'edit'
|
||||
]
|
||||
];
|
||||
|
||||
$this->handler = new SystemConfigHandler(
|
||||
$projectDir,
|
||||
$legacyDir,
|
||||
|
@ -141,7 +148,8 @@ class SystemConfigHandlerTest extends Unit
|
|||
$moduleMapper,
|
||||
$classicViewExclusionHandler,
|
||||
$mappers,
|
||||
$systemConfigKeyMap
|
||||
$systemConfigKeyMap,
|
||||
$cacheResetActions
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -293,4 +301,25 @@ class SystemConfigHandlerTest extends Unit
|
|||
static::assertArrayHasKey('iso4217', $currency);
|
||||
static::assertNotEmpty($currency['iso4217']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test cache reset actions
|
||||
*/
|
||||
public function testCacheResetActionsConfig(): void
|
||||
{
|
||||
$cacheClearActionsConfig = $this->handler->getSystemConfig('cache_reset_actions');
|
||||
static::assertNotNull($cacheClearActionsConfig);
|
||||
static::assertEquals('cache_reset_actions', $cacheClearActionsConfig->getId());
|
||||
static::assertNull($cacheClearActionsConfig->getValue());
|
||||
static::assertIsArray($cacheClearActionsConfig->getItems());
|
||||
static::assertNotEmpty($cacheClearActionsConfig->getItems());
|
||||
|
||||
$cacheClearActions = $cacheClearActionsConfig->getItems();
|
||||
static::assertNotNull($cacheClearActions);
|
||||
static::assertNotEmpty($cacheClearActions);
|
||||
|
||||
static::assertArrayHasKey('users', $cacheClearActions);
|
||||
static::assertNotEmpty($cacheClearActions['users']);
|
||||
static::assertContains('edit', $cacheClearActions['users']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue