mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
✅ Optimize tests execution time (force cache usage and set the modification date in the past instead of waiting 1s)
This commit is contained in:
@@ -40,6 +40,11 @@ class Router
|
||||
return static::$oSingleton;
|
||||
}
|
||||
|
||||
/**
|
||||
* @var bool $bUseCache
|
||||
*/
|
||||
protected $bUseCache = null;
|
||||
|
||||
/**********************/
|
||||
/* Non-static methods */
|
||||
/**********************/
|
||||
@@ -54,6 +59,14 @@ class Router
|
||||
// Don't do anything, we don't want to be initialized
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool|null $bUseCache Force cache usage for testing purposes, or leave it null for the default behavior
|
||||
*/
|
||||
public function SetUseCache(?bool $bUseCache): void
|
||||
{
|
||||
$this->bUseCache = $bUseCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a complete URL for a specific route and optional parameters
|
||||
*
|
||||
@@ -137,7 +150,7 @@ class Router
|
||||
public function GetRoutes(): array
|
||||
{
|
||||
$aRoutes = [];
|
||||
$bUseCache = false === utils::IsDevelopmentEnvironment();
|
||||
$bUseCache = is_null($this->bUseCache) ? (false === utils::IsDevelopmentEnvironment()) : $this->bUseCache;
|
||||
$bMustWriteCache = false;
|
||||
$sCacheFilePath = $this->GetCacheFileAbsPath();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user