aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-11-27 08:18:39 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-11-27 08:49:06 -0500
commita5900a6b1120a3d062e6d51579872bf940b13dcb (patch)
tree61f20effd8c0b6330bf7cdbc1d093aa9d215a65b /tests
parent04480ec4ae8435db37072cd976e7591a3abaafb9 (diff)
downloadforums-a5900a6b1120a3d062e6d51579872bf940b13dcb.tar
forums-a5900a6b1120a3d062e6d51579872bf940b13dcb.tar.gz
forums-a5900a6b1120a3d062e6d51579872bf940b13dcb.tar.bz2
forums-a5900a6b1120a3d062e6d51579872bf940b13dcb.tar.xz
forums-a5900a6b1120a3d062e6d51579872bf940b13dcb.zip
[ticket/11174] Extract phpbb_search_test_case.
PHPBB3-11174
Diffstat (limited to 'tests')
-rw-r--r--tests/search/native_test.php21
-rw-r--r--tests/test_framework/phpbb_search_test_case.php28
2 files changed, 31 insertions, 18 deletions
diff --git a/tests/search/native_test.php b/tests/search/native_test.php
index 21cbde496a..544ab7ca17 100644
--- a/tests/search/native_test.php
+++ b/tests/search/native_test.php
@@ -7,24 +7,9 @@
*
*/
-function phpbb_native_search_wrapper($class)
-{
- $wrapped = $class . '_wrapper';
- if (!class_exists($wrapped))
- {
- $code = "
-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; }
-}
- ";
- eval($code);
- }
- return $wrapped;
-}
+require_once dirname(__FILE__) . '/../test_framework/phpbb_search_test_case.php';
-class phpbb_search_native_test extends phpbb_database_test_case
+class phpbb_search_native_test extends phpbb_search_test_case
{
protected $db;
protected $search;
@@ -45,7 +30,7 @@ class phpbb_search_native_test extends phpbb_database_test_case
$this->db = $this->new_dbal();
$error = null;
- $class = phpbb_native_search_wrapper('phpbb_search_fulltext_native');
+ $class = self::get_search_wrapper('phpbb_search_fulltext_native');
$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
new file mode 100644
index 0000000000..8b378186df
--- /dev/null
+++ b/tests/test_framework/phpbb_search_test_case.php
@@ -0,0 +1,28 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+abstract class phpbb_search_test_case extends phpbb_database_test_case
+{
+ static protected function get_search_wrapper($class)
+ {
+ $wrapped = $class . '_wrapper';
+ if (!class_exists($wrapped))
+ {
+ $code = "
+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; }
+}
+ ";
+ eval($code);
+ }
+ return $wrapped;
+ }
+}