Merge branch 'develop-ascraeus' into develop

* develop-ascraeus:
  [ticket/12536] Restore missing @throws
  [ticket/12536] Add test cases with empty versions list
  [ticket/12536] Use stable values when unstable are unavailable
  [ticket/12536] Update doc block
  [ticket/12536] Return empty array if stability unavailable
  [ticket/12536] Get Versions Should Not Require Both Stable and Unstable
This commit is contained in:
Joas Schilling 2014-05-28 00:07:45 +02:00
commit 317ce7b0c7
2 changed files with 14 additions and 1 deletions

View file

@ -247,7 +247,7 @@ class version_helper
$info = json_decode($info, true); $info = json_decode($info, true);
if (empty($info['stable']) || empty($info['unstable'])) if (empty($info['stable']) && empty($info['unstable']))
{ {
$this->user->add_lang('acp/common'); $this->user->add_lang('acp/common');
@ -263,6 +263,9 @@ class version_helper
} }
} }
$info['stable'] = (empty($info['stable'])) ? array() : $info['stable'];
$info['unstable'] = (empty($info['unstable'])) ? $info['stable'] : $info['unstable'];
$this->cache->put($cache_file, $info, 86400); // 24 hours $this->cache->put($cache_file, $info, 86400); // 24 hours
} }

View file

@ -181,6 +181,11 @@ class phpbb_version_helper_test extends phpbb_test_case
), ),
), ),
), ),
array(
'1.1.0',
array(),
array(),
),
); );
} }
@ -286,6 +291,11 @@ class phpbb_version_helper_test extends phpbb_test_case
), ),
'1.1.0-a2', '1.1.0-a2',
), ),
array(
'1.1.0',
array(),
null,
),
); );
} }