mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/9599] Adding tests for phpbb_checkdnsrr().
Tests for existing and non-existing records of the types: MX, A, AAAA, NS, CNAME, TXT PHPBB3-9599
This commit is contained in:
parent
3e111bb41a
commit
4707b0c18e
2 changed files with 67 additions and 0 deletions
|
@ -15,6 +15,8 @@ if (!defined('PHPUnit_MAIN_METHOD'))
|
||||||
require_once 'test_framework/framework.php';
|
require_once 'test_framework/framework.php';
|
||||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||||
|
|
||||||
|
require_once 'network/checkdnsrr.php';
|
||||||
|
|
||||||
class phpbb_network_all_tests
|
class phpbb_network_all_tests
|
||||||
{
|
{
|
||||||
public static function main()
|
public static function main()
|
||||||
|
@ -26,6 +28,8 @@ class phpbb_network_all_tests
|
||||||
{
|
{
|
||||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Network Functions');
|
$suite = new PHPUnit_Framework_TestSuite('phpBB Network Functions');
|
||||||
|
|
||||||
|
$suite->addTestSuite('phpbb_network_checkdnsrr_test');
|
||||||
|
|
||||||
return $suite;
|
return $suite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
63
tests/network/checkdnsrr.php
Normal file
63
tests/network/checkdnsrr.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package testing
|
||||||
|
* @copyright (c) 2010 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once 'test_framework/framework.php';
|
||||||
|
require_once '../phpBB/includes/functions.php';
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue