Fix build service test - mock environment store
This commit is contained in:
parent
5da247afc7
commit
1cef8260e9
2 changed files with 49 additions and 6 deletions
|
|
@ -771,6 +771,16 @@ class Project extends Model
|
|||
return $icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EnvironmentStore
|
||||
*/
|
||||
protected function getEnvironmentStore()
|
||||
{
|
||||
/** @var EnvironmentStore $store */
|
||||
$store = Factory::getStore('Environment', 'PHPCensor');
|
||||
return $store;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Environments
|
||||
*
|
||||
|
|
@ -788,8 +798,7 @@ class Project extends Model
|
|||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
/** @var EnvironmentStore $store */
|
||||
$store = Factory::getStore('Environment', 'PHPCensor');
|
||||
$store = $this->getEnvironmentStore();
|
||||
$rtn = $store->getByProjectId($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
|
@ -843,7 +852,7 @@ class Project extends Model
|
|||
$environments_names = !empty($environments_config) ? array_keys($environments_config) : [];
|
||||
|
||||
$current_environments = $this->getEnvironmentsObjects();
|
||||
$store = Factory::getStore('Environment', 'PHPCensor');
|
||||
$store = $this->getEnvironmentStore();
|
||||
foreach ($current_environments['items'] as $environment) {
|
||||
/** @var Environment $environment */
|
||||
$key = array_search($environment->getName(), $environments_names);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue