diff options
Diffstat (limited to 'tests/version')
-rw-r--r-- | tests/version/version_fetch_test.php | 3 | ||||
-rw-r--r-- | tests/version/version_helper_remote_test.php | 15 | ||||
-rw-r--r-- | tests/version/version_test.php | 17 |
3 files changed, 22 insertions, 13 deletions
diff --git a/tests/version/version_fetch_test.php b/tests/version/version_fetch_test.php index cfc87183cf..c44bd5514a 100644 --- a/tests/version/version_fetch_test.php +++ b/tests/version/version_fetch_test.php @@ -33,8 +33,7 @@ class phpbb_version_helper_fetch_test extends phpbb_test_case new \phpbb\config\config(array( 'version' => '3.1.0', )), - new \phpbb\file_downloader(), - new \phpbb\user('\phpbb\datetime') + new \phpbb\file_downloader() ); } diff --git a/tests/version/version_helper_remote_test.php b/tests/version/version_helper_remote_test.php index b2d497b72a..35c3d92a3a 100644 --- a/tests/version/version_helper_remote_test.php +++ b/tests/version/version_helper_remote_test.php @@ -30,21 +30,22 @@ class version_helper_remote_test extends \phpbb_test_case )); $container = new \phpbb_mock_container_builder(); $db = new \phpbb\db\driver\factory($container); - $this->cache = $this->getMock('\phpbb\cache\service', array('get'), array(new \phpbb\cache\driver\null(), $config, $db, '../../', 'php')); + $this->cache = $this->getMock('\phpbb\cache\service', array('get'), array(new \phpbb\cache\driver\dummy(), $config, $db, '../../', 'php')); $this->cache->expects($this->any()) ->method('get') ->with($this->anything()) ->will($this->returnValue(false)); $this->file_downloader = new phpbb_mock_file_downloader(); - $this->user = new \phpbb\user('\phpbb\datetime'); - $this->user->add_lang('acp/common'); + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $this->version_helper = new \phpbb\version_helper( $this->cache, $config, - $this->file_downloader, - $this->user + $this->file_downloader ); + $this->user = new \phpbb\user(new \phpbb\language\language($lang_loader), '\phpbb\datetime'); + $this->user->add_lang('acp/common'); } public function provider_get_versions() @@ -202,8 +203,8 @@ class version_helper_remote_test extends \phpbb_test_case { try { $return = $this->version_helper->get_versions(); - } catch (\RuntimeException $e) { - $this->assertEquals((string)$e->getMessage(), $this->user->lang($expected_exception)); + } catch (\phpbb\exception\runtime_exception $e) { + $this->assertEquals((string)$e->getMessage(), $expected_exception); } } else diff --git a/tests/version/version_test.php b/tests/version/version_test.php index 528f1602d6..93d47a40a6 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_test.php @@ -30,8 +30,7 @@ class phpbb_version_helper_test extends phpbb_test_case new \phpbb\config\config(array( 'version' => '3.1.0', )), - new \phpbb\file_downloader(), - new \phpbb\user('\phpbb\datetime') + new \phpbb\file_downloader() ); } @@ -199,6 +198,11 @@ class phpbb_version_helper_test extends phpbb_test_case */ public function test_get_suggested_updates($current_version, $versions, $expected) { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $version_helper = $this ->getMockBuilder('\phpbb\version_helper') ->setMethods(array( @@ -210,7 +214,7 @@ class phpbb_version_helper_test extends phpbb_test_case 'version' => $current_version, )), new \phpbb\file_downloader(), - new \phpbb\user('\phpbb\datetime'), + new \phpbb\user($lang, '\phpbb\datetime'), )) ->getMock() ; @@ -310,6 +314,11 @@ class phpbb_version_helper_test extends phpbb_test_case */ public function test_get_latest_on_current_branch($current_version, $versions, $expected) { + global $phpbb_root_path, $phpEx; + + $lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); + $lang = new \phpbb\language\language($lang_loader); + $version_helper = $this ->getMockBuilder('\phpbb\version_helper') ->setMethods(array( @@ -321,7 +330,7 @@ class phpbb_version_helper_test extends phpbb_test_case 'version' => $current_version, )), new \phpbb\file_downloader(), - new \phpbb\user('\phpbb\datetime'), + new \phpbb\user($lang, '\phpbb\datetime'), )) ->getMock() ; |