aboutsummaryrefslogtreecommitdiffstats
path: root/tests/version/version_fetch_test.php
blob: 4e8e82567a208de8da9d65bc480386d5aae888ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

/*
* @group slow
*/
class phpbb_version_helper_fetch_test extends phpbb_test_case
{
	public function setUp(): void
	{
		parent::setUp();

		global $phpbb_root_path, $phpEx;

		include_once($phpbb_root_path . 'includes/functions.' . $phpEx);

		$this->cache = $this->getMockBuilder('\phpbb\cache\service')
			->disableOriginalConstructor()
			->getMock();

		$this->version_helper = new \phpbb\version_helper(
			$this->cache,
			new \phpbb\config\config(array(
				'version'	=> '3.1.0',
			)),
			new \phpbb\file_downloader()
		);
	}

	public function test_version_phpbb_com()
	{
		global $phpbb_root_path, $phpEx;
		include_once($phpbb_root_path . 'includes/functions.' . $phpEx);

		if (!checkdnsrr('version.phpbb.com', 'A'))
		{
			$this->markTestSkipped(sprintf(
				'Could not find a DNS record for hostname %s. ' .
				'Assuming network is down.',
				'version.phpbb.com'
			));
		}

		$this->version_helper->get_versions();

		// get_versions checks to make sure we got a valid versions file or
		// throws an exception if we did not. We don't need to test anything
		// here, but adding an assertion so we do not get a warning about no
		// assertions in this test
		$this->assertSame(true, true);
	}
}