mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-24 10:31:57 +02:00
Merge remote-tracking branch 'upstream/develop' into feature/dic
* upstream/develop: (259 commits) [prep-release-3.0.11] Bumping version number for 3.0.11 final. [feature/php-events] Fix doc of core.viewonline_overwrite_location [feature/php-events] Fix doc of core.user_set_default_group [feature/php-events] Fix doc of core.generate_smilies_after [feature/php-events] Fix doc of core.delete_user_after [feature/php-events] Fix doc of core.delete_user_before [feature/php-events] Fix doc of core.update_username [feature/php-events] Fix doc of core.memberlist_prepare_profile_data [feature/php-events] Fix doc and position of viewonline_overwrite_location [feature/php-events] Fix doc of core.viewtopic_get_post_data [feature/php-events] Fix doc of core.viewtopic_cache_guest_data [ticket/11061] Add the --dev flag to the composer instructions in README [ticket/11060] Make sure pyrus can install everything on travis [ticket/11059] Use https for the README logo [feature/php-events] Fix acp_manage_forums_update_data_before and is_new_forum [feature/php-events] Fix core.acp_manage_forums_update_data_after vars [ticket/11032] fix language of error displayed [ticket/11052] update search backend constructor everywhere [ticket/11052] pass parametes to search construct while posting [ticket/11054] Fixed $config var description ... Conflicts: phpBB/includes/cron/task/core/tidy_cache.php phpBB/includes/cron/task/core/tidy_search.php
This commit is contained in:
41
tests/cache/cache_test.php
vendored
41
tests/cache/cache_test.php
vendored
@@ -9,7 +9,7 @@
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
|
||||
|
||||
class phpbb_cache_test extends phpbb_test_case
|
||||
class phpbb_cache_test extends phpbb_database_test_case
|
||||
{
|
||||
private $cache_dir;
|
||||
|
||||
@@ -18,8 +18,15 @@ class phpbb_cache_test extends phpbb_test_case
|
||||
$this->cache_dir = dirname(__FILE__) . '/../tmp/cache/';
|
||||
}
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml');
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if (file_exists($this->cache_dir))
|
||||
{
|
||||
// cache directory possibly left after aborted
|
||||
@@ -35,6 +42,8 @@ class phpbb_cache_test extends phpbb_test_case
|
||||
{
|
||||
$this->remove_cache_dir();
|
||||
}
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
private function create_cache_dir()
|
||||
@@ -67,4 +76,34 @@ class phpbb_cache_test extends phpbb_test_case
|
||||
'File ACM put and get'
|
||||
);
|
||||
}
|
||||
|
||||
public function test_cache_sql()
|
||||
{
|
||||
$driver = new phpbb_cache_driver_file($this->cache_dir);
|
||||
|
||||
global $db, $cache;
|
||||
$db = $this->new_dbal();
|
||||
$cache = new phpbb_cache_service($driver);
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
$first_result = $db->sql_fetchrow($result);
|
||||
|
||||
$this->assertFileExists($this->cache_dir . 'sql_' . md5(preg_replace('/[\n\r\s\t]+/', ' ', $sql)) . '.php');
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'foo'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
|
||||
$this->assertEquals($first_result, $db->sql_fetchrow($result));
|
||||
|
||||
$sql = "SELECT * FROM phpbb_config
|
||||
WHERE config_name = 'bar'";
|
||||
$result = $db->sql_query($sql, 300);
|
||||
|
||||
$this->assertNotEquals($first_result, $db->sql_fetchrow($result));
|
||||
|
||||
$db->sql_close();
|
||||
}
|
||||
}
|
||||
|
18
tests/cache/fixtures/config.xml
vendored
Normal file
18
tests/cache/fixtures/config.xml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_config">
|
||||
<column>config_name</column>
|
||||
<column>config_value</column>
|
||||
<column>is_dynamic</column>
|
||||
<row>
|
||||
<value>foo</value>
|
||||
<value>23</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>bar</value>
|
||||
<value>42</value>
|
||||
<value>1</value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
@@ -46,8 +46,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
||||
*/
|
||||
public function test_build_cfg_template_text($tpl_type, $key, $new, $config_key, $vars, $expected)
|
||||
{
|
||||
global $user;
|
||||
global $user, $phpbb_dispatcher;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user->lang = new phpbb_mock_lang();
|
||||
|
||||
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
|
||||
@@ -80,8 +81,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
||||
*/
|
||||
public function test_build_cfg_template_dimension($tpl_type, $key, $new, $config_key, $vars, $expected)
|
||||
{
|
||||
global $user;
|
||||
global $user, $phpbb_dispatcher;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user->lang = new phpbb_mock_lang();
|
||||
|
||||
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
|
||||
@@ -106,8 +108,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
||||
*/
|
||||
public function test_build_cfg_template_textarea($tpl_type, $key, $new, $config_key, $vars, $expected)
|
||||
{
|
||||
global $user;
|
||||
global $user, $phpbb_dispatcher;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user->lang = new phpbb_mock_lang();
|
||||
|
||||
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
|
||||
@@ -156,8 +159,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
||||
*/
|
||||
public function test_build_cfg_template_radio($tpl_type, $key, $new, $config_key, $vars, $expected)
|
||||
{
|
||||
global $user;
|
||||
global $user, $phpbb_dispatcher;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user->lang = new phpbb_mock_lang();
|
||||
|
||||
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
|
||||
@@ -182,8 +186,9 @@ class phpbb_functions_acp_build_cfg_template_test extends phpbb_test_case
|
||||
*/
|
||||
public function test_build_cfg_template_append($tpl_type, $key, $new, $config_key, $vars, $expected)
|
||||
{
|
||||
global $user;
|
||||
global $user, $phpbb_dispatcher;
|
||||
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$user->lang = new phpbb_mock_lang();
|
||||
|
||||
$this->assertEquals($expected, build_cfg_template($tpl_type, $key, $new, $config_key, $vars));
|
||||
|
@@ -121,7 +121,7 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface
|
||||
public function sql_load($query)
|
||||
{
|
||||
}
|
||||
public function sql_save($query, &$query_result, $ttl)
|
||||
public function sql_save($query, $query_result, $ttl)
|
||||
{
|
||||
}
|
||||
public function sql_exists($query_id)
|
||||
|
16
tests/mock/event_dispatcher.php
Normal file
16
tests/mock/event_dispatcher.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_mock_event_dispatcher
|
||||
{
|
||||
public function trigger_event($eventName, $data)
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
@@ -197,13 +197,11 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
|
||||
$this->do_request('create_table', $data);
|
||||
|
||||
$this->do_request('config_file', $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");
|
||||
|
||||
$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)
|
||||
|
Reference in New Issue
Block a user