aboutsummaryrefslogtreecommitdiffstats
path: root/tests/network/checkdnsrr_test.php
blob: a3852b26565049ca1895fab751745036ca0bfc64 (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
63
64
65
66
67
68
69
<?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.
*
*/

require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';

/**
* @group slow
*/
class phpbb_network_checkdnsrr_test extends phpbb_test_case
{
	public function data_provider()
	{
		return array(
			// Existing MX record
			array('phpbb.com', 'MX', true),

			// Non-existing MX record
			array('does-not-exist.phpbb.com', 'MX', false),

			// Existing A record
			array('www.phpbb.com', 'A', true),

			// Non-existing A record
			array('does-not-exist.phpbb.com', 'A', false),

			// Existing AAAA record
			array('www.six.heise.de', 'AAAA', true),

			// Non-existing AAAA record
			array('does-not-exist.phpbb.com', 'AAAA', false),

			// Existing CNAME record
			array('news.cnet.com', 'CNAME', true),

			// Non-existing CNAME record
			array('does-not-exist.phpbb.com', 'CNAME', false),

			// Existing NS record
			array('phpbb.com', 'NS', true),

			// Non-existing NS record
			array('does-not-exist', 'NS', false),

			// Existing TXT record
			array('phpbb.com', 'TXT', true),

			// Non-existing TXT record
			array('does-not-exist', 'TXT', false),
		);
	}

	/**
	* @dataProvider data_provider
	*/
	public function test_checkdnsrr($host, $type, $expected)
	{
		$this->assertEquals($expected, phpbb_checkdnsrr($host, $type));
	}
}