1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 01:06:48 +02:00

Merge remote-tracking branch 'upstream/develop' into ticket/11015

* upstream/develop: (666 commits)
  [ticket/11077] Remove code from old global announcements system
  [ticket/11189] Replace DEBUG_EXTRA with DEBUG
  [ticket/11189] Always log critical errors when in cron or in image output
  [ticket/11187] Added a blank array to fix errors in functional tests
  [ticket/10780] Make L_COLON available in the installer.
  [ticket/11183] Remove $load_extensions and weird dl() calls
  [ticket/10970] Added extra documentation to parse_dynamic_path.
  [ticket/10939] Added documentation for phpbb_request::file
  [ticket/10865] Use code tags for install/database_update.php.
  [ticket/10865] Should have been a slash.
  [ticket/10780] Use L_COLON on LDAP page.
  [ticket/10780] Use L_COLON on search backend ACP pages.
  [ticket/10780] Use L_COLON for "download all attachments".
  [ticket/10780] Use colon from language in ucp_pm_compose.php where possible.
  [ticket/10780] Replace colons in phpBB/adm/style/acp_ext_details.html.
  [ticket/10780] Replace colon usage in adm template output with {L_COLON}
  [ticket/10780] Replace colon usage in template output with {L_COLON}
  [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [develop-olympus]
  [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2)
  [ticket/10172] Show prosilver birthday list even if there are no birthdays.
  ...

Conflicts:
	phpBB/common.php
	phpBB/download/file.php
	phpBB/includes/db/dbal.php
	phpBB/includes/db/firebird.php
	phpBB/includes/db/mssql.php
	phpBB/includes/db/mssql_odbc.php
	phpBB/includes/db/mssqlnative.php
	phpBB/includes/db/mysql.php
	phpBB/includes/db/mysqli.php
	phpBB/includes/db/oracle.php
	phpBB/includes/db/postgres.php
	phpBB/includes/db/sqlite.php
	phpBB/includes/extension/manager.php
	phpBB/install/database_update.php
This commit is contained in:
Igor Wiedler
2012-11-12 10:33:40 +01:00
449 changed files with 12779 additions and 3043 deletions

View File

@@ -100,8 +100,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
$config = $this->get_database_config();
$dbms = $config['dbms'];
$db = new $dbms();
$db = new $config['dbms']();
$db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']);
return $db;
@@ -136,7 +135,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
*
* @return string The string with the specified match converted to uppercase
*/
public static function to_upper($matches)
static public function to_upper($matches)
{
return $matches[1] . strtoupper($matches[2]) . $matches[3];
}

View File

@@ -121,6 +121,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
$this->extension_manager = new phpbb_extension_manager(
$this->get_db(),
new phpbb_config(array()),
self::$config['table_prefix'] . 'ext',
$phpbb_root_path,
".$phpEx",
@@ -193,13 +194,11 @@ class phpbb_functional_test_case extends phpbb_test_case
$this->do_request('create_table', $data);
file_put_contents($phpbb_root_path . "config.$phpEx", phpbb_create_config_file_data($data, self::$config['dbms'], array(), true));
$this->do_request('config_file', $data);
copy($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_test.$phpEx");
file_put_contents($phpbb_root_path . "config.$phpEx", phpbb_create_config_file_data($data, self::$config['dbms'], true, true));
$this->do_request('final', $data);
copy($phpbb_root_path . "config.$phpEx", $phpbb_root_path . "config_test.$phpEx");
}
private function do_request($sub, $post_data = null)
@@ -249,6 +248,48 @@ class phpbb_functional_test_case extends phpbb_test_case
}
}
/**
* Login to the ACP
* You must run login() before calling this.
*/
protected function admin_login()
{
$this->add_lang('acp/common');
// Requires login first!
if (empty($this->sid))
{
$this->fail('$this->sid is empty. Make sure you call login() before admin_login()');
return;
}
$crawler = $this->request('GET', 'adm/index.php?sid=' . $this->sid);
$this->assertContains($this->lang('LOGIN_ADMIN_CONFIRM'), $crawler->filter('html')->text());
$form = $crawler->selectButton($this->lang('LOGIN'))->form();
foreach ($form->getValues() as $field => $value)
{
if (strpos($field, 'password_') === 0)
{
$login = $this->client->submit($form, array('username' => 'admin', $field => 'admin'));
$cookies = $this->cookieJar->all();
// The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
foreach ($cookies as $cookie);
{
if (substr($cookie->getName(), -4) == '_sid')
{
$this->sid = $cookie->getValue();
}
}
break;
}
}
}
protected function add_lang($lang_file)
{
if (is_array($lang_file))
@@ -285,4 +326,16 @@ class phpbb_functional_test_case extends phpbb_test_case
return call_user_func_array('sprintf', $args);
}
/**
* assertContains for language strings
*
* @param string $needle Search string
* @param string $haystack Search this
* @param string $message Optional failure message
*/
public function assertContainsLang($needle, $haystack, $message = null)
{
$this->assertContains(html_entity_decode($this->lang($needle), ENT_QUOTES), $haystack, $message);
}
}

View File

@@ -78,7 +78,7 @@ class phpbb_test_case_helpers
include($test_config);
$config = array_merge($config, array(
'dbms' => $dbms,
'dbms' => 'phpbb_db_driver_' . $dbms,
'dbhost' => $dbhost,
'dbport' => $dbport,
'dbname' => $dbname,
@@ -115,4 +115,112 @@ class phpbb_test_case_helpers
return $config;
}
/**
* Recursive directory copying function
*
* @param string $source
* @param string $dest
* @return array list of files copied
*/
public function copy_dir($source, $dest)
{
$source = (substr($source, -1) == '/') ? $source : $source . '/';
$dest = (substr($dest, -1) == '/') ? $dest : $dest . '/';
$copied_files = array();
if (!is_dir($dest))
{
$this->makedirs($dest);
}
$files = scandir($source);
foreach ($files as $file)
{
if ($file == '.' || $file == '..')
{
continue;
}
if (is_dir($source . $file))
{
$created_dir = false;
if (!is_dir($dest . $file))
{
$created_dir = true;
$this->makedirs($dest . $file);
}
$copied_files = array_merge($copied_files, self::copy_dir($source . $file, $dest . $file));
if ($created_dir)
{
$copied_files[] = $dest . $file;
}
}
else
{
if (!file_exists($dest . $file))
{
copy($source . $file, $dest . $file);
$copied_files[] = $dest . $file;
}
}
}
return $copied_files;
}
/**
* Remove files/directories that are listed in an array
* Designed for use with $this->copy_dir()
*
* @param array $file_list
*/
public function remove_files($file_list)
{
foreach ($file_list as $file)
{
if (is_dir($file))
{
rmdir($file);
}
else
{
unlink($file);
}
}
}
/**
* Empty directory (remove any subdirectories/files below)
*
* @param array $file_list
*/
public function empty_dir($path)
{
$path = (substr($path, -1) == '/') ? $path : $path . '/';
$files = scandir($path);
foreach ($files as $file)
{
if ($file == '.' || $file == '..')
{
continue;
}
if (is_dir($path . $file))
{
$this->empty_dir($path . $file);
rmdir($path . $file);
}
else
{
unlink($path . $file);
}
}
}
}