Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
78.26% covered (warning)
78.26%
18 / 23
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_version_fetch_test
78.26% covered (warning)
78.26%
18 / 23
50.00% covered (danger)
50.00%
1 / 2
3.09
0.00% covered (danger)
0.00%
0 / 1
 setUp
100.00% covered (success)
100.00%
13 / 13
100.00% covered (success)
100.00%
1 / 1
1
 test_version_phpbb_com
50.00% covered (danger)
50.00%
5 / 10
0.00% covered (danger)
0.00%
0 / 1
2.50
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14/*
15* @group slow
16*/
17class phpbb_version_fetch_test extends phpbb_test_case
18{
19    protected $cache, $version_helper;
20
21    protected function setUp(): void
22    {
23        parent::setUp();
24
25        global $phpbb_root_path, $phpEx;
26
27        include_once($phpbb_root_path . 'includes/functions.' . $phpEx);
28
29        $this->cache = $this->getMockBuilder('\phpbb\cache\service')
30            ->disableOriginalConstructor()
31            ->getMock();
32
33        $this->version_helper = new \phpbb\version_helper(
34            $this->cache,
35            new \phpbb\config\config(array(
36                'version'    => '3.1.0',
37            )),
38            new \phpbb\file_downloader()
39        );
40    }
41
42    public function test_version_phpbb_com()
43    {
44        global $phpbb_root_path, $phpEx;
45        include_once($phpbb_root_path . 'includes/functions.' . $phpEx);
46
47        if (!checkdnsrr('version.phpbb.com', 'A'))
48        {
49            $this->markTestSkipped(sprintf(
50                'Could not find a DNS record for hostname %s. ' .
51                'Assuming network is down.',
52                'version.phpbb.com'
53            ));
54        }
55
56        $this->version_helper->get_versions();
57
58        // get_versions checks to make sure we got a valid versions file or
59        // throws an exception if we did not. We don't need to test anything
60        // here, but adding an assertion so we do not get a warning about no
61        // assertions in this test
62        $this->assertSame(true, true);
63    }
64}