mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch 'develop-olympus' into develop
This commit also ports all ascraeus tests to the new format. Conflicts: tests/all_tests.php tests/network/all_tests.php tests/request/all_tests.php tests/request/request_var.php tests/template/templates/includephp.html
This commit is contained in:
commit
14a84cf89c
47 changed files with 128 additions and 678 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
*~
|
||||
phpunit.xml
|
||||
phpBB/cache/*.php
|
||||
phpBB/config.php
|
||||
phpBB/files/*
|
||||
|
|
|
@ -42,12 +42,11 @@
|
|||
<delete dir="build/save" />
|
||||
</target>
|
||||
|
||||
<target name="test">
|
||||
<exec dir="tests"
|
||||
command="phpunit --log-junit ../build/logs/phpunit.xml
|
||||
--coverage-clover ../build/logs/clover.xml
|
||||
--coverage-html ../build/coverage
|
||||
phpbb_all_tests all_tests.php"
|
||||
<target name="test" depends="clean,prepare">
|
||||
<exec dir="."
|
||||
command="phpunit --log-junit build/logs/phpunit.xml
|
||||
--coverage-clover build/logs/clover.xml
|
||||
--coverage-html build/coverage"
|
||||
passthru="true" />
|
||||
|
||||
|
||||
|
|
25
phpunit.xml.dist
Normal file
25
phpunit.xml.dist
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="true"
|
||||
backupStaticAttributes="true"
|
||||
colors="false"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="phpBB Test Suite">
|
||||
<directory suffix=".php">./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<blacklist>
|
||||
<directory>./tests/</directory>
|
||||
</blacklist>
|
||||
</filter>
|
||||
</phpunit>
|
|
@ -7,7 +7,7 @@ Prerequisites
|
|||
PHPUnit
|
||||
-------
|
||||
|
||||
phpBB unit tests use PHPUnit framework. Version 3.3 or better is required
|
||||
phpBB unit tests use PHPUnit framework. Version 3.5 or better is required
|
||||
to run the tests. PHPUnit prefers to be installed via PEAR; refer to
|
||||
http://www.phpunit.de/ for more information.
|
||||
|
||||
|
@ -41,14 +41,14 @@ will run phpunit with the same parameters as in the shown test_config.php file:
|
|||
|
||||
$ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \
|
||||
PHPBB_TEST_DBNAME='database' PHPBB_TEST_DBUSER='user' \
|
||||
PHPBB_TEST_DBPASSWD='password' phpunit all_tests.php
|
||||
PHPBB_TEST_DBPASSWD='password' phpunit
|
||||
|
||||
Running
|
||||
=======
|
||||
|
||||
Once the prerequisites are installed, run the tests from tests directory:
|
||||
Once the prerequisites are installed, run the tests from the project root directory (above phpBB):
|
||||
|
||||
$ phpunit all_tests.php
|
||||
$ phpunit
|
||||
|
||||
More Information
|
||||
================
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'class_loader/all_tests.php';
|
||||
require_once 'utf/all_tests.php';
|
||||
require_once 'request/all_tests.php';
|
||||
require_once 'security/all_tests.php';
|
||||
require_once 'template/all_tests.php';
|
||||
#require_once 'bbcode/all_tests.php';
|
||||
require_once 'text_processing/all_tests.php';
|
||||
require_once 'dbal/all_tests.php';
|
||||
require_once 'regex/all_tests.php';
|
||||
require_once 'network/all_tests.php';
|
||||
require_once 'random/all_tests.php';
|
||||
require_once 'download/all_tests.php';
|
||||
|
||||
// exclude the test directory from code coverage reports
|
||||
if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0)
|
||||
{
|
||||
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist('./');
|
||||
}
|
||||
else
|
||||
{
|
||||
PHPUnit_Util_Filter::addDirectoryToFilter('./');
|
||||
}
|
||||
|
||||
class phpbb_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB');
|
||||
|
||||
$suite->addTest(phpbb_class_loader_all_tests::suite());
|
||||
$suite->addTest(phpbb_utf_all_tests::suite());
|
||||
$suite->addTest(phpbb_request_all_tests::suite());
|
||||
$suite->addTest(phpbb_security_all_tests::suite());
|
||||
$suite->addTest(phpbb_template_all_tests::suite());
|
||||
# $suite->addTest(phpbb_bbcode_all_tests::suite());
|
||||
$suite->addTest(phpbb_text_processing_all_tests::suite());
|
||||
$suite->addTest(phpbb_dbal_all_tests::suite());
|
||||
$suite->addTest(phpbb_regex_all_tests::suite());
|
||||
$suite->addTest(phpbb_network_all_tests::suite());
|
||||
$suite->addTest(phpbb_random_all_tests::suite());
|
||||
$suite->addTest(phpbb_download_all_tests::suite());
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_all_tests::main')
|
||||
{
|
||||
phpbb_all_tests::main();
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @version $Id$
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_bbcode_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'bbcode/parser_test.php';
|
||||
|
||||
class phpbb_bbcode_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Formatted Text / BBCode');
|
||||
|
||||
$suite->addTestSuite('phpbb_bbcode_parser_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_bbcode_all_tests::main')
|
||||
{
|
||||
phpbb_bbcode_all_tests::main();
|
||||
}
|
|
@ -8,16 +8,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/bbcode/bbcode_parser_base.php';
|
||||
require_once '../phpBB/includes/bbcode/bbcode_parser.php';
|
||||
// require_once __DIR__ . '/../../phpBB/includes/bbcode/bbcode_parser_base.php';
|
||||
// require_once __DIR__ . '/../../phpBB/includes/bbcode/bbcode_parser.php';
|
||||
|
||||
class phpbb_bbcode_parser_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_both_passes()
|
||||
{
|
||||
$this->markTestIncomplete('New bbcode parser has not been backported from feature/ascraeus-experiment yet.');
|
||||
|
||||
$parser = new phpbb_bbcode_parser();
|
||||
|
||||
$result = $parser->first_pass('[i]Italic [u]underlined text[/u][/i]');
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
*/
|
||||
|
||||
define('IN_PHPBB', true);
|
||||
$phpbb_root_path = '../phpBB/';
|
||||
$phpbb_root_path = 'phpBB/';
|
||||
$phpEx = 'php';
|
||||
$table_prefix = '';
|
||||
|
||||
error_reporting(E_ALL & ~E_DEPRECATED);
|
||||
|
||||
// If we are on PHP >= 6.0.0 we do not need some code
|
||||
if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
|
||||
{
|
||||
|
@ -25,19 +27,6 @@ else
|
|||
|
||||
require_once $phpbb_root_path . 'includes/constants.php';
|
||||
|
||||
// require at least PHPUnit 3.3.0
|
||||
require_once 'PHPUnit/Runner/Version.php';
|
||||
if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', '<'))
|
||||
{
|
||||
trigger_error('PHPUnit >= 3.3.0 required');
|
||||
}
|
||||
|
||||
if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<'))
|
||||
{
|
||||
require_once 'PHPUnit/Framework.php';
|
||||
require_once 'PHPUnit/Extensions/Database/TestCase.php';
|
||||
}
|
||||
|
||||
require_once 'test_framework/phpbb_test_case_helpers.php';
|
||||
require_once 'test_framework/phpbb_test_case.php';
|
||||
require_once 'test_framework/phpbb_database_test_case.php';
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_class_loader_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'class_loader/class_loader_test.php';
|
||||
|
||||
class phpbb_class_loader_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Class Loader');
|
||||
|
||||
$suite->addTestSuite('phpbb_class_loader_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_class_loader_all_tests::main')
|
||||
{
|
||||
phpbb_class_loader_all_tests::main();
|
||||
}
|
||||
|
|
@ -8,17 +8,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'class_loader/cache_mock.php';
|
||||
|
||||
require_once '../phpBB/includes/class_loader.php';
|
||||
require_once __DIR__ . '/cache_mock.php';
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/class_loader.php';
|
||||
|
||||
class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_resolve_path()
|
||||
{
|
||||
$prefix = 'class_loader/';
|
||||
$prefix = __DIR__ . '/';
|
||||
$class_loader = new phpbb_class_loader($prefix);
|
||||
|
||||
$prefix .= 'includes/';
|
||||
|
@ -56,7 +54,7 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
|
|||
$cache = new phpbb_cache_mock;
|
||||
$cache->put('class_loader', array('phpbb_a_cached_name' => 'a/cached_name'));
|
||||
|
||||
$prefix = 'class_loader/';
|
||||
$prefix = __DIR__ . '/';
|
||||
$class_loader = new phpbb_class_loader($prefix, '.php', $cache);
|
||||
|
||||
$prefix .= 'includes/';
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_dbal_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'dbal/select.php';
|
||||
require_once 'dbal/write.php';
|
||||
|
||||
class phpbb_dbal_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Database Abstraction Layer');
|
||||
|
||||
$suite->addTestSuite('phpbb_dbal_select_test');
|
||||
$suite->addTestSuite('phpbb_dbal_write_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_dbal_all_tests::main')
|
||||
{
|
||||
phpbb_dbal_all_tests::main();
|
||||
}
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_dbal_select_test extends phpbb_database_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_dbal_write_test extends phpbb_database_test_case
|
||||
{
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_download_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'download/http_byte_range.php';
|
||||
|
||||
class phpbb_download_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Download Tests');
|
||||
|
||||
$suite->addTestSuite('phpbb_download_http_byte_range_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_download_all_tests::main')
|
||||
{
|
||||
phpbb_regex_all_tests::main();
|
||||
}
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions_download.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_download.php';
|
||||
|
||||
class phpbb_download_http_byte_range_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_network_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'network/checkdnsrr.php';
|
||||
require_once 'network/inet_ntop_pton.php';
|
||||
require_once 'network/ip_normalise.php';
|
||||
|
||||
class phpbb_network_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Network Functions');
|
||||
|
||||
$suite->addTestSuite('phpbb_network_checkdnsrr_test');
|
||||
$suite->addTestSuite('phpbb_network_inet_ntop_pton_test');
|
||||
$suite->addTestSuite('phpbb_network_ip_normalise_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_network_all_tests::main')
|
||||
{
|
||||
phpbb_network_all_tests::main();
|
||||
}
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_network_checkdnsrr_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_network_inet_ntop_pton_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_network_ip_normalise_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_random_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'random/gen_rand_string.php';
|
||||
|
||||
class phpbb_random_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Random Functions');
|
||||
|
||||
$suite->addTestSuite('phpbb_random_gen_rand_string_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_random_all_tests::main')
|
||||
{
|
||||
phpbb_random_all_tests::main();
|
||||
}
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_random_gen_rand_string_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2010 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_regex_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'regex/email.php';
|
||||
require_once 'regex/ipv4.php';
|
||||
require_once 'regex/ipv6.php';
|
||||
require_once 'regex/url.php';
|
||||
|
||||
class phpbb_regex_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Regular Expressions');
|
||||
|
||||
$suite->addTestSuite('phpbb_regex_email_test');
|
||||
$suite->addTestSuite('phpbb_regex_ipv4_test');
|
||||
$suite->addTestSuite('phpbb_regex_ipv6_test');
|
||||
$suite->addTestSuite('phpbb_regex_url_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_regex_all_tests::main')
|
||||
{
|
||||
phpbb_regex_all_tests::main();
|
||||
}
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_email_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_ipv4_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_ipv6_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_url_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_request_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'request/type_cast_helper.php';
|
||||
require_once 'request/deactivated_super_global.php';
|
||||
require_once 'request/request.php';
|
||||
require_once 'request/request_var.php';
|
||||
|
||||
class phpbb_request_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Request Parameter Handling');
|
||||
|
||||
$suite->addTestSuite('phpbb_type_cast_helper_test');
|
||||
$suite->addTestSuite('phpbb_deactivated_super_global_test');
|
||||
$suite->addTestSuite('phpbb_request_test');
|
||||
$suite->addTestSuite('phpbb_request_var_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_request_all_tests::main')
|
||||
{
|
||||
phpbb_request_all_tests::main();
|
||||
}
|
||||
|
|
@ -8,9 +8,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/request/interface.php';
|
||||
require_once '../phpBB/includes/request/deactivated_super_global.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/interface.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/deactivated_super_global.php';
|
||||
|
||||
class phpbb_deactivated_super_global_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/request/type_cast_helper_interface.php';
|
||||
require_once '../phpBB/includes/request/interface.php';
|
||||
require_once '../phpBB/includes/request/deactivated_super_global.php';
|
||||
require_once '../phpBB/includes/request/request.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper_interface.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/interface.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/deactivated_super_global.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/request.php';
|
||||
|
||||
class phpbb_request_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,13 +7,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/request/type_cast_helper_interface.php';
|
||||
require_once '../phpBB/includes/request/type_cast_helper.php';
|
||||
require_once '../phpBB/includes/request/deactivated_super_global.php';
|
||||
require_once '../phpBB/includes/request/interface.php';
|
||||
require_once '../phpBB/includes/request/request.php';
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper_interface.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/deactivated_super_global.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/interface.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/request.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_request_var_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -8,10 +8,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/utf/utf_tools.php';
|
||||
require_once '../phpBB/includes/request/type_cast_helper_interface.php';
|
||||
require_once '../phpBB/includes/request/type_cast_helper.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper_interface.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/request/type_cast_helper.php';
|
||||
|
||||
class phpbb_type_cast_helper_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,18 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_security_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'security/extract_current_page.php';
|
||||
require_once 'security/redirect.php';
|
||||
|
||||
class phpbb_security_all_tests extends PHPUnit_Framework_TestSuite
|
||||
abstract class phpbb_security_test_base extends phpbb_test_case
|
||||
{
|
||||
/**
|
||||
* Set up the required user object and server variables for the suites
|
||||
|
@ -62,25 +51,4 @@ class phpbb_security_all_tests extends PHPUnit_Framework_TestSuite
|
|||
global $user;
|
||||
$user = NULL;
|
||||
}
|
||||
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
// I bet there is a better method calling this... :)
|
||||
$suite = new phpbb_security_all_tests('phpBB Security Fixes');
|
||||
|
||||
$suite->addTestSuite('phpbb_security_extract_current_page_test');
|
||||
$suite->addTestSuite('phpbb_security_redirect_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_security_all_tests::main')
|
||||
{
|
||||
phpbb_security_all_tests::main();
|
||||
}
|
|
@ -7,12 +7,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once __DIR__ . '/base.php';
|
||||
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once '../phpBB/includes/session.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/session.php';
|
||||
|
||||
class phpbb_security_extract_current_page_test extends phpbb_test_case
|
||||
class phpbb_security_extract_current_page_test extends phpbb_security_test_base
|
||||
{
|
||||
public static function security_variables()
|
||||
{
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once __DIR__ . '/base.php';
|
||||
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once '../phpBB/includes/session.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/session.php';
|
||||
|
||||
class phpbb_security_redirect_test extends phpbb_test_case
|
||||
class phpbb_security_redirect_test extends phpbb_security_test_base
|
||||
{
|
||||
public static function provider()
|
||||
{
|
||||
|
@ -22,13 +22,15 @@ class phpbb_security_redirect_test extends phpbb_test_case
|
|||
array('bad://localhost/phpBB/index.php', 'Tried to redirect to potentially insecure url.', false),
|
||||
array('http://www.otherdomain.com/somescript.php', false, 'http://localhost/phpBB'),
|
||||
array("http://localhost/phpBB/memberlist.php\n\rConnection: close", 'Tried to redirect to potentially insecure url.', false),
|
||||
array('javascript:test', false, 'http://localhost/phpBB/../tests/javascript:test'),
|
||||
array('javascript:test', false, 'http://localhost/phpBB/../javascript:test'),
|
||||
array('http://localhost/phpBB/index.php;url=', 'Tried to redirect to potentially insecure url.', false),
|
||||
);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$GLOBALS['config'] = array(
|
||||
'force_server_vars' => '0',
|
||||
);
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_template_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'template/template.php';
|
||||
|
||||
class phpbb_template_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Template Engine');
|
||||
|
||||
$suite->addTestSuite('phpbb_template_template_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_template_all_tests::main')
|
||||
{
|
||||
phpbb_template_all_tests::main();
|
||||
}
|
|
@ -7,9 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
|
||||
require_once '../phpBB/includes/template.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/template.php';
|
||||
|
||||
class phpbb_template_template_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
|
||||
echo "testing included php";
|
3
tests/template/templates/_dummy_include.php.inc
Normal file
3
tests/template/templates/_dummy_include.php.inc
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
// extension is .php.inc so PHPUnit ignores it
|
||||
echo "testing included php";
|
|
@ -1 +1 @@
|
|||
<!-- INCLUDEPHP _dummy_include.php -->
|
||||
<!-- INCLUDEPHP ../templates/_dummy_include.php.inc -->
|
||||
|
|
|
@ -13,6 +13,21 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
|||
|
||||
protected $test_case_helpers;
|
||||
|
||||
public function __construct($name = NULL, array $data = array(), $dataName = '')
|
||||
{
|
||||
parent::__construct($name, $data, $dataName);
|
||||
$this->backupStaticAttributesBlacklist += array(
|
||||
'PHP_CodeCoverage' => array('instance'),
|
||||
'PHP_CodeCoverage_Filter' => array('instance'),
|
||||
'PHP_CodeCoverage_Util' => array('ignoredLines', 'templateMethods'),
|
||||
'PHP_Timer' => array('startTimes',),
|
||||
'PHP_Token_Stream' => array('customTokens'),
|
||||
'PHP_Token_Stream_CachingFactory' => array('cache'),
|
||||
|
||||
'phpbb_database_test_case' => array('already_connected'),
|
||||
);
|
||||
}
|
||||
|
||||
public function get_test_case_helpers()
|
||||
{
|
||||
if (!$this->test_case_helpers)
|
||||
|
@ -96,9 +111,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
|||
'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : '',
|
||||
);
|
||||
}
|
||||
else if (file_exists('test_config.php'))
|
||||
else if (file_exists(__DIR__ . '/../test_config.php'))
|
||||
{
|
||||
include('test_config.php');
|
||||
include(__DIR__ . '/../test_config.php');
|
||||
|
||||
return array(
|
||||
'dbms' => $dbms,
|
||||
|
@ -114,7 +129,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
|||
// Silently use sqlite
|
||||
return array(
|
||||
'dbms' => 'sqlite',
|
||||
'dbhost' => 'phpbb_unit_tests.sqlite2', // filename
|
||||
'dbhost' => __DIR__ . '/../phpbb_unit_tests.sqlite2', // filename
|
||||
'dbport' => '',
|
||||
'dbname' => '',
|
||||
'dbuser' => '',
|
||||
|
@ -325,7 +340,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
|||
}
|
||||
}
|
||||
|
||||
$sql = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']);
|
||||
$sql = $this->split_sql_file(file_get_contents(__DIR__ . "/../../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']);
|
||||
|
||||
foreach ($sql as $query)
|
||||
{
|
||||
|
@ -361,7 +376,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
|||
|
||||
$config = $this->get_database_config();
|
||||
|
||||
require_once '../phpBB/includes/db/' . $config['dbms'] . '.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/db/' . $config['dbms'] . '.php';
|
||||
$dbal = 'dbal_' . $config['dbms'];
|
||||
$db = new $dbal();
|
||||
$db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']);
|
||||
|
|
|
@ -11,6 +11,21 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase
|
|||
{
|
||||
protected $test_case_helpers;
|
||||
|
||||
public function __construct($name = NULL, array $data = array(), $dataName = '')
|
||||
{
|
||||
parent::__construct($name, $data, $dataName);
|
||||
$this->backupStaticAttributesBlacklist += array(
|
||||
'PHP_CodeCoverage' => array('instance'),
|
||||
'PHP_CodeCoverage_Filter' => array('instance'),
|
||||
'PHP_CodeCoverage_Util' => array('ignoredLines', 'templateMethods'),
|
||||
'PHP_Timer' => array('startTimes',),
|
||||
'PHP_Token_Stream' => array('customTokens'),
|
||||
'PHP_Token_Stream_CachingFactory' => array('cache'),
|
||||
|
||||
'phpbb_database_test_case' => array('already_connected'),
|
||||
);
|
||||
}
|
||||
|
||||
public function get_test_case_helpers()
|
||||
{
|
||||
if (!$this->test_case_helpers)
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_text_processing_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'text_processing/make_clickable.php';
|
||||
|
||||
class phpbb_text_processing_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Text Processing Tools');
|
||||
|
||||
$suite->addTestSuite('phpbb_text_processing_make_clickable_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_text_processing_all_tests::main')
|
||||
{
|
||||
phpbb_text_processing_all_tests::main();
|
||||
}
|
||||
|
|
@ -7,10 +7,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
|
||||
require_once '../phpBB/includes/functions.php';
|
||||
require_once '../phpBB/includes/functions_content.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_content.php';
|
||||
|
||||
class phpbb_text_processing_make_clickable_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('PHPUnit_MAIN_METHOD'))
|
||||
{
|
||||
define('PHPUnit_MAIN_METHOD', 'phpbb_utf_all_tests::main');
|
||||
}
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once 'PHPUnit/TextUI/TestRunner.php';
|
||||
|
||||
require_once 'utf/utf8_wordwrap_test.php';
|
||||
require_once 'utf/utf8_clean_string_test.php';
|
||||
|
||||
class phpbb_utf_all_tests
|
||||
{
|
||||
public static function main()
|
||||
{
|
||||
PHPUnit_TextUI_TestRunner::run(self::suite());
|
||||
}
|
||||
|
||||
public static function suite()
|
||||
{
|
||||
$suite = new PHPUnit_Framework_TestSuite('phpBB Unicode Transformation Format');
|
||||
|
||||
$suite->addTestSuite('phpbb_utf_utf8_wordwrap_test');
|
||||
$suite->addTestSuite('phpbb_utf_utf8_clean_string_test');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
}
|
||||
|
||||
if (PHPUnit_MAIN_METHOD == 'phpbb_utf_all_tests::main')
|
||||
{
|
||||
phpbb_utf_all_tests::main();
|
||||
}
|
||||
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/utf/utf_tools.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
|
||||
class phpbb_utf_utf8_clean_string_test extends phpbb_test_case
|
||||
{
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
require_once 'test_framework/framework.php';
|
||||
require_once '../phpBB/includes/utf/utf_tools.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
|
||||
class phpbb_utf_utf8_wordwrap_test extends phpbb_test_case
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue