mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-19 07:00:14 +01:00
[ticket/15540] Fix tests
PHPBB3-15540
This commit is contained in:
parent
ee9ea98a01
commit
1bc9cbefb2
@ -4,7 +4,6 @@ services:
|
||||
search.fulltext.native:
|
||||
class: phpbb\search\backend\fulltext_native
|
||||
arguments:
|
||||
- '@auth'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@dispatcher'
|
||||
@ -17,7 +16,6 @@ services:
|
||||
search.fulltext.mysql:
|
||||
class: phpbb\search\backend\fulltext_mysql
|
||||
arguments:
|
||||
- '@auth'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@dispatcher'
|
||||
@ -30,7 +28,6 @@ services:
|
||||
search.fulltext.postgres:
|
||||
class: phpbb\search\backend\fulltext_postgres
|
||||
arguments:
|
||||
- '@auth'
|
||||
- '@config'
|
||||
- '@dbal.conn'
|
||||
- '@dispatcher'
|
||||
|
@ -1330,7 +1330,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||
*/
|
||||
function mcp_fork_topic($topic_ids)
|
||||
{
|
||||
global $auth, $user, $db, $template, $config;
|
||||
global $auth, $user, $db, $template, $config, $phpbb_container;
|
||||
global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher;
|
||||
|
||||
if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
|
||||
|
@ -428,7 +428,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||
*/
|
||||
function split_topic($action, $topic_id, $to_forum_id, $subject)
|
||||
{
|
||||
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log, $request;
|
||||
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log, $request, $phpbb_container;
|
||||
|
||||
$post_id_list = $request->variable('post_id_list', array(0));
|
||||
$forum_id = $request->variable('forum_id', 0);
|
||||
|
@ -78,16 +78,14 @@ class fulltext_mysql extends base implements search_backend_interface
|
||||
* Constructor
|
||||
* Creates a new \phpbb\search\backend\fulltext_mysql, which is used as a search backend
|
||||
*
|
||||
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
|
||||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\db\driver\driver_interface $db Database object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $phpEx PHP file extension
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
public function __construct($config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
|
@ -13,6 +13,11 @@
|
||||
|
||||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
use phpbb\user;
|
||||
|
||||
/**
|
||||
* phpBB's own db driven fulltext search, version 2
|
||||
*/
|
||||
@ -83,41 +88,39 @@ class fulltext_native extends base implements search_backend_interface
|
||||
|
||||
/**
|
||||
* Config object
|
||||
* @var \phpbb\config\config
|
||||
* @var config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Database connection
|
||||
* @var \phpbb\db\driver\driver_interface
|
||||
* @var driver_interface
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* phpBB event dispatcher object
|
||||
* @var \phpbb\event\dispatcher_interface
|
||||
* @var dispatcher_interface
|
||||
*/
|
||||
protected $phpbb_dispatcher;
|
||||
|
||||
/**
|
||||
* User object
|
||||
* @var \phpbb\user
|
||||
* @var user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* Initialises the fulltext_native search backend with min/max word length
|
||||
*
|
||||
* @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\db\driver\driver_interface $db Database object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
* Initialises the fulltext_native search backend with min/max word length
|
||||
*
|
||||
* @param config $config Config object
|
||||
* @param driver_interface $db Database object
|
||||
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
* @param user $user User object
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx PHP file extension
|
||||
*/
|
||||
public function __construct($config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
|
@ -13,6 +13,11 @@
|
||||
|
||||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\config\config;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
use phpbb\user;
|
||||
|
||||
/**
|
||||
* Fulltext search for PostgreSQL
|
||||
*/
|
||||
@ -45,7 +50,7 @@ class fulltext_postgres extends base implements search_backend_interface
|
||||
|
||||
/**
|
||||
* Config object
|
||||
* @var \phpbb\config\config
|
||||
* @var config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
@ -57,13 +62,13 @@ class fulltext_postgres extends base implements search_backend_interface
|
||||
|
||||
/**
|
||||
* phpBB event dispatcher object
|
||||
* @var \phpbb\event\dispatcher_interface
|
||||
* @var dispatcher_interface
|
||||
*/
|
||||
protected $phpbb_dispatcher;
|
||||
|
||||
/**
|
||||
* User object
|
||||
* @var \phpbb\user
|
||||
* @var user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
@ -91,16 +96,14 @@ class fulltext_postgres extends base implements search_backend_interface
|
||||
* Constructor
|
||||
* Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend
|
||||
*
|
||||
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
|
||||
* @param config $config Config object
|
||||
* @param driver_interface $db Database object
|
||||
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
* @param user $user User object
|
||||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\db\driver\driver_interface Database object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
public function __construct($config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->db = $db;
|
||||
|
@ -13,6 +13,11 @@
|
||||
|
||||
namespace phpbb\search\backend;
|
||||
|
||||
use phpbb\auth\auth;
|
||||
use phpbb\config\config;
|
||||
use phpbb\event\dispatcher_interface;
|
||||
use phpbb\user;
|
||||
|
||||
define('SPHINX_MAX_MATCHES', 20000);
|
||||
define('SPHINX_CONNECT_RETRIES', 3);
|
||||
define('SPHINX_CONNECT_WAIT_TIME', 300);
|
||||
@ -67,13 +72,13 @@ class fulltext_sphinx implements search_backend_interface
|
||||
|
||||
/**
|
||||
* Auth object
|
||||
* @var \phpbb\auth\auth
|
||||
* @var auth
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Config object
|
||||
* @var \phpbb\config\config
|
||||
* @var config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
@ -97,13 +102,13 @@ class fulltext_sphinx implements search_backend_interface
|
||||
|
||||
/**
|
||||
* phpBB event dispatcher object
|
||||
* @var \phpbb\event\dispatcher_interface
|
||||
* @var dispatcher_interface
|
||||
*/
|
||||
protected $phpbb_dispatcher;
|
||||
|
||||
/**
|
||||
* User object
|
||||
* @var \phpbb\user
|
||||
* @var user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
@ -124,14 +129,14 @@ class fulltext_sphinx implements search_backend_interface
|
||||
* Constructor
|
||||
* Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend
|
||||
*
|
||||
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
|
||||
* @param auth $auth Auth object
|
||||
* @param config $config Config object
|
||||
* @param $db
|
||||
* @param dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
* @param user $user User object
|
||||
* @param string $phpbb_root_path Relative path to phpBB root
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\db\driver\driver_interface Database object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($auth, $config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||
$config = new \phpbb\config\config(array(
|
||||
'num_posts' => 3,
|
||||
'num_topics' => 1,
|
||||
'search_type' => 'phpbb_mock_search',
|
||||
'search_type' => 'foo',
|
||||
));
|
||||
$cache = new phpbb_mock_cache;
|
||||
$db = $this->new_dbal();
|
||||
|
@ -38,7 +38,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$this->create_search_index('\phpbb\search\backend\fulltext_native');
|
||||
$this->create_search_index('phpbb\search\backend\fulltext_native');
|
||||
|
||||
$post = $this->create_topic(2, 'Test Topic 1 foosubject', 'This is a test topic posted by the barsearch testing framework.');
|
||||
|
||||
|
@ -18,7 +18,7 @@ require_once __DIR__ . '/base.php';
|
||||
*/
|
||||
class phpbb_functional_search_mysql_test extends phpbb_functional_search_base
|
||||
{
|
||||
protected $search_backend = '\phpbb\search\backend\fulltext_mysql';
|
||||
protected $search_backend = 'phpbb\search\backend\fulltext_mysql';
|
||||
|
||||
protected function create_search_index($backend = null)
|
||||
{
|
||||
|
@ -18,5 +18,5 @@ require_once __DIR__ . '/base.php';
|
||||
*/
|
||||
class phpbb_functional_search_native_test extends phpbb_functional_search_base
|
||||
{
|
||||
protected $search_backend = '\phpbb\search\backend\fulltext_native';
|
||||
protected $search_backend = 'phpbb\search\backend\fulltext_native';
|
||||
}
|
||||
|
@ -18,6 +18,6 @@ require_once __DIR__ . '/base.php';
|
||||
*/
|
||||
class phpbb_functional_search_postgres_test extends phpbb_functional_search_base
|
||||
{
|
||||
protected $search_backend = '\phpbb\search\backend\fulltext_postgres';
|
||||
protected $search_backend = 'phpbb\search\backend\fulltext_postgres';
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ require_once __DIR__ . '/base.php';
|
||||
*/
|
||||
class phpbb_functional_search_sphinx_test extends phpbb_functional_search_base
|
||||
{
|
||||
protected $search_backend = '\phpbb\search\backend\fulltext_sphinx';
|
||||
protected $search_backend = 'phpbb\search\backend\fulltext_sphinx';
|
||||
|
||||
public function test_search_backend()
|
||||
{
|
||||
|
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
class phpbb_mock_search implements \phpbb\search\backend\search_backend_interface
|
||||
{
|
||||
|
||||
public function __construct($auth, $config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
}
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_search_query()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_common_words()
|
||||
{
|
||||
}
|
||||
|
||||
public function get_word_length()
|
||||
{
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
public function split_keywords(&$keywords, $terms)
|
||||
{
|
||||
}
|
||||
|
||||
public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
|
||||
{
|
||||
}
|
||||
|
||||
public function author_search($type, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page)
|
||||
{
|
||||
}
|
||||
|
||||
public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id)
|
||||
{
|
||||
}
|
||||
|
||||
public function index_remove($post_ids, $author_ids, $forum_ids)
|
||||
{
|
||||
}
|
||||
|
||||
public function tidy()
|
||||
{
|
||||
}
|
||||
|
||||
public function create_index($acp_module, $u_action)
|
||||
{
|
||||
}
|
||||
|
||||
public function delete_index($acp_module, $u_action)
|
||||
{
|
||||
}
|
||||
|
||||
public function index_created()
|
||||
{
|
||||
}
|
||||
|
||||
public function index_stats()
|
||||
{
|
||||
}
|
||||
|
||||
protected function get_stats()
|
||||
{
|
||||
}
|
||||
|
||||
public function acp()
|
||||
{
|
||||
}
|
||||
}
|
@ -38,6 +38,6 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
|
||||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_mysql');
|
||||
$this->search = new $class($auth, $config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native');
|
||||
$config['fulltext_native_min_chars'] = 2;
|
||||
$config['fulltext_native_max_chars'] = 14;
|
||||
$this->search = new $class($auth, $config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
|
||||
public function keywords()
|
||||
|
@ -38,6 +38,6 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
|
||||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_postgres');
|
||||
$this->search = new $class($auth, $config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
$this->search = new $class($config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user