diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index dbcf6dae7e..669c551511 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -57,7 +57,11 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case new \phpbb\mimetype\content_guesser, ); $guesser = new \phpbb\mimetype\guesser($guessers); - $imagesize = new \FastImageSize\FastImageSize(); + $imagesize = $this->getMockBuilder('\FastImageSize\FastImageSize') + ->setMethods(['getImageSize']) + ->getMock(); + $imagesize->method('getImageSize') + ->willReturn(['width' => 80, 'height' => 80, 'mime' => 'image/jpeg']); $dispatcher = new phpbb_mock_event_dispatcher(); $phpbb_dispatcher = $dispatcher; @@ -405,9 +409,9 @@ class phpbb_avatar_manager_test extends \phpbb_database_test_case { return array( array('127.0.0.1:91?foo.jpg', 80, 80, array('AVATAR_URL_INVALID')), - array(gethostbyname('secure.gravatar.com') . '/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), + array('127.0.0.1/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), array('secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80), - array(gethostbyname('secure.gravatar.com') . ':120/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), + array('127.0.0.1:120/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), array('secure.gravatar.com:80/avatar/55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), array('secure.gravatar.com:80?55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), array('secure.gravatar.com?55502f40dc8b7c769880b10874abc9d0.jpg', 80, 80, array('AVATAR_URL_INVALID')), // should be a 404 diff --git a/tests/console/update/check_test.php b/tests/console/update/check_test.php index 2578eb21cc..5768808464 100644 --- a/tests/console/update/check_test.php +++ b/tests/console/update/check_test.php @@ -94,7 +94,32 @@ class phpbb_console_command_check_test extends phpbb_test_case ->getMock(); $config = new \phpbb\config\config(array('version' => $current_version)); - $this->version_helper = new \phpbb\version_helper($cache, $config, new \phpbb\file_downloader()); + $this->version_helper = $this->getMockBuilder('\phpbb\version_helper') + ->setConstructorArgs([$cache, $config, new \phpbb\file_downloader()]) + ->setMethods(['get_latest_version', 'get_suggested_updates']) + ->getMock(); + $this->version_helper->method('get_suggested_updates') + ->willReturnCallback(function($force_update = false, $force_cache = false) use ($config) + { + if ($config['version'] === '100000') + { + return []; + } + else if ($config['version'] === '0') + { + return [ + [ + 'version' => '100000', + 'stability' => 'stable', + 'download_url' => 'https://www.phpbb.com/downloads/', + ], + ]; + } + else + { + throw new \phpbb\exception\runtime_exception('VERSIONCHECK_FAIL'); + } + }); $container = new phpbb_mock_container_builder; $container->set('version_helper', $this->version_helper);