mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 22:28:46 +01:00
[ticket/10011] Tests don't work on PHP < 5.3
Due to the usage of `__DIR__` for the file includes the tests can't be ran on systems with PHP < 5.3. Replace all occurances of `__DIR__` with `dirname(__FILE__)`. PHPBB3-10011
This commit is contained in:
parent
01fb5532cf
commit
14891cdf4e
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_dbal_select_test extends phpbb_database_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_dbal_write_test extends phpbb_database_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_random_gen_rand_string_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_censor_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_email_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_ipv4_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_ipv6_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_regex_url_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,8 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
|
||||
class phpbb_request_request_var_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,10 +7,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/base.php';
|
||||
require_once dirname(__FILE__) . '/base.php';
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/session.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/session.php';
|
||||
|
||||
class phpbb_security_extract_current_page_test extends phpbb_security_test_base
|
||||
{
|
||||
|
@ -7,10 +7,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/base.php';
|
||||
require_once dirname(__FILE__) . '/base.php';
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/session.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/session.php';
|
||||
|
||||
class phpbb_security_redirect_test extends phpbb_security_test_base
|
||||
{
|
||||
|
@ -7,8 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/template.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/template.php';
|
||||
|
||||
class phpbb_template_template_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -111,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(__DIR__ . '/../test_config.php'))
|
||||
else if (file_exists(dirname(__FILE__) . '/../test_config.php'))
|
||||
{
|
||||
include(__DIR__ . '/../test_config.php');
|
||||
include(dirname(__FILE__) . '/../test_config.php');
|
||||
|
||||
return array(
|
||||
'dbms' => $dbms,
|
||||
@ -129,7 +129,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
// Silently use sqlite
|
||||
return array(
|
||||
'dbms' => 'sqlite',
|
||||
'dbhost' => __DIR__ . '/../phpbb_unit_tests.sqlite2', // filename
|
||||
'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename
|
||||
'dbport' => '',
|
||||
'dbname' => '',
|
||||
'dbuser' => '',
|
||||
@ -340,7 +340,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
}
|
||||
}
|
||||
|
||||
$sql = $this->split_sql_file(file_get_contents(__DIR__ . "/../../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']);
|
||||
$sql = $this->split_sql_file(file_get_contents(dirname(__FILE__) . "/../../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']);
|
||||
|
||||
foreach ($sql as $query)
|
||||
{
|
||||
@ -376,7 +376,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
|
||||
$config = $this->get_database_config();
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/db/' . $config['dbms'] . '.php';
|
||||
require_once dirname(__FILE__) . '/../../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']);
|
||||
|
@ -7,8 +7,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_content.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
|
||||
|
||||
class phpbb_text_processing_make_clickable_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_normalizer.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_normalizer.php';
|
||||
|
||||
/**
|
||||
* @group slow
|
||||
@ -16,8 +16,8 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
|
||||
{
|
||||
static public function setUpBeforeClass()
|
||||
{
|
||||
self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', __DIR__.'/data');
|
||||
self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', __DIR__.'/data');
|
||||
self::download('http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt', dirname(__FILE__).'/data');
|
||||
self::download('http://www.unicode.org/Public/UNIDATA/UnicodeData.txt', dirname(__FILE__).'/data');
|
||||
}
|
||||
|
||||
public function test_normalizer()
|
||||
@ -62,7 +62,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
|
||||
|
||||
$tested_chars = array();
|
||||
|
||||
$fp = fopen(__DIR__.'/data/NormalizationTest.txt', 'rb');
|
||||
$fp = fopen(dirname(__FILE__).'/data/NormalizationTest.txt', 'rb');
|
||||
while (!feof($fp))
|
||||
{
|
||||
$line = fgets($fp);
|
||||
@ -117,7 +117,7 @@ class phpbb_utf_normalizer_test extends phpbb_test_case
|
||||
*/
|
||||
public function test_invariants(array $tested_chars)
|
||||
{
|
||||
$fp = fopen(__DIR__.'/data/UnicodeData.txt', 'rb');
|
||||
$fp = fopen(dirname(__FILE__).'/data/UnicodeData.txt', 'rb');
|
||||
|
||||
while (!feof($fp))
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
|
||||
class phpbb_utf_utf8_clean_string_test extends phpbb_test_case
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php';
|
||||
|
||||
class phpbb_utf_utf8_wordwrap_test extends phpbb_test_case
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user