aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-11-27 08:22:43 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-11-27 08:49:06 -0500
commit4d1486b08cd2f1e75527ed3b54664361934258a7 (patch)
tree1fc8d1640d2e8f47f5acddb08f49357b83e28eb0
parenta5900a6b1120a3d062e6d51579872bf940b13dcb (diff)
downloadforums-4d1486b08cd2f1e75527ed3b54664361934258a7.tar
forums-4d1486b08cd2f1e75527ed3b54664361934258a7.tar.gz
forums-4d1486b08cd2f1e75527ed3b54664361934258a7.tar.bz2
forums-4d1486b08cd2f1e75527ed3b54664361934258a7.tar.xz
forums-4d1486b08cd2f1e75527ed3b54664361934258a7.zip
[ticket/11174] Eliminate search wrapper copy pasting.
PHPBB3-11174
-rw-r--r--tests/search/mysql_test.php20
-rw-r--r--tests/search/postgres_test.php11
-rw-r--r--tests/test_framework/phpbb_search_test_case.php1
3 files changed, 8 insertions, 24 deletions
diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php
index 5e5d5c9846..cf89facc83 100644
--- a/tests/search/mysql_test.php
+++ b/tests/search/mysql_test.php
@@ -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);
}
diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php
index d3172c6457..211755c7db 100644
--- a/tests/search/postgres_test.php
+++ b/tests/search/postgres_test.php
@@ -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);
}
diff --git a/tests/test_framework/phpbb_search_test_case.php b/tests/test_framework/phpbb_search_test_case.php
index 8b378186df..418d352c17 100644
--- a/tests/test_framework/phpbb_search_test_case.php
+++ b/tests/test_framework/phpbb_search_test_case.php
@@ -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);