mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-21 00:02:18 +02:00
[ticket/11174] Eliminate search wrapper copy pasting.
PHPBB3-11174
This commit is contained in:
parent
a5900a6b11
commit
4d1486b08c
@ -7,23 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
function phpbb_search_wrapper($class)
|
||||
{
|
||||
$wrapped = $class . '_wrapper';
|
||||
if (!class_exists($wrapped))
|
||||
{
|
||||
$code = "
|
||||
class $wrapped extends $class
|
||||
{
|
||||
public function get_split_words() { return \$this->split_words; }
|
||||
}
|
||||
";
|
||||
eval($code);
|
||||
}
|
||||
return $wrapped;
|
||||
}
|
||||
require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php';
|
||||
|
||||
class phpbb_search_mysql_test extends phpbb_database_test_case
|
||||
class phpbb_search_mysql_test extends phpbb_search_test_case
|
||||
{
|
||||
protected $db;
|
||||
protected $search;
|
||||
@ -48,7 +34,7 @@ class phpbb_search_mysql_test extends phpbb_database_test_case
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$error = null;
|
||||
$class = phpbb_search_wrapper('phpbb_search_fulltext_mysql');
|
||||
$class = self::get_search_wrapper('phpbb_search_fulltext_mysql');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class phpbb_search_postgres_test extends phpbb_database_test_case
|
||||
require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php';
|
||||
|
||||
class phpbb_search_postgres_test extends phpbb_search_test_case
|
||||
{
|
||||
protected $db;
|
||||
protected $search;
|
||||
@ -30,14 +32,9 @@ class phpbb_search_postgres_test extends phpbb_database_test_case
|
||||
$config['fulltext_postgres_min_word_len'] = 4;
|
||||
$config['fulltext_postgres_max_word_len'] = 254;
|
||||
|
||||
if(!function_exists('phpbb_search_wrapper'))
|
||||
{
|
||||
include('mysql_test.' . $phpEx);
|
||||
}
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$error = null;
|
||||
$class = phpbb_search_wrapper('phpbb_search_fulltext_postgres');
|
||||
$class = self::get_search_wrapper('phpbb_search_fulltext_postgres');
|
||||
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ class $wrapped extends $class
|
||||
{
|
||||
public function get_must_contain_ids() { return \$this->must_contain_ids; }
|
||||
public function get_must_not_contain_ids() { return \$this->must_not_contain_ids; }
|
||||
public function get_split_words() { return \$this->split_words; }
|
||||
}
|
||||
";
|
||||
eval($code);
|
||||
|
Loading…
x
Reference in New Issue
Block a user