mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 03:04:09 +02:00
[ticket/15540] Refactor search backend classes to Symfony services
PHPBB3-15540
This commit is contained in:
@@ -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\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\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\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\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\fulltext_sphinx';
|
||||
protected $search_backend = '\phpbb\search\backend\fulltext_sphinx';
|
||||
|
||||
public function test_search_backend()
|
||||
{
|
||||
|
@@ -33,7 +33,7 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
|
||||
|
||||
$config = new \phpbb\config\config(array(
|
||||
'load_online_time' => 5,
|
||||
'search_type' => '\phpbb\search\fulltext_mysql',
|
||||
'search_type' => '\phpbb\search\backend\fulltext_mysql',
|
||||
));
|
||||
$cache = new phpbb_mock_null_cache();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
|
@@ -13,15 +13,78 @@
|
||||
|
||||
/**
|
||||
*/
|
||||
class phpbb_mock_search
|
||||
class phpbb_mock_search implements \phpbb\search\backend\search_backend_interface
|
||||
{
|
||||
|
||||
public function __construct($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
|
||||
public function __construct($auth, $config, $db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx)
|
||||
{
|
||||
}
|
||||
|
||||
public function index_remove($post_ids, $poster_ids, $forum_ids)
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -37,8 +37,7 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$error = null;
|
||||
$class = self::get_search_wrapper('\phpbb\search\fulltext_mysql');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_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);
|
||||
}
|
||||
}
|
||||
|
@@ -33,11 +33,10 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$error = null;
|
||||
$class = self::get_search_wrapper('\phpbb\search\fulltext_native');
|
||||
$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($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_dispatcher);
|
||||
$this->search = new $class($auth, $config, $this->db, $phpbb_dispatcher, $user, $phpbb_root_path, $phpEx);
|
||||
}
|
||||
|
||||
public function keywords()
|
||||
|
@@ -37,8 +37,7 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$error = null;
|
||||
$class = self::get_search_wrapper('\phpbb\search\fulltext_postgres');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user, $phpbb_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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user