aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/namespaces.php2
-rw-r--r--phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html2
-rw-r--r--tests/functional/search/base.php95
-rw-r--r--tests/functional/search/mysql_test.php23
-rw-r--r--tests/functional/search/native_test.php23
-rw-r--r--tests/functional/search/postgres_test.php23
-rw-r--r--tests/functional/search/sphinx_test.php23
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php5
9 files changed, 194 insertions, 4 deletions
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 70138f35fd..4458dde6a3 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -237,7 +237,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size'
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'phpbb\search\fulltext_native');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', '\phpbb\search\fulltext_native');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1');
diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php
index 9b182f88b8..f74ecbd874 100644
--- a/phpBB/phpbb/db/migration/data/v310/namespaces.php
+++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php
@@ -23,7 +23,7 @@ class namespaces extends \phpbb\db\migration\migration
return array(
array('if', array(
(preg_match('#^phpbb_search_#', $this->config['search_type'])),
- array('config.update', array('search_type', str_replace('phpbb_search_', 'phpbb\\search\\', $this->config['search_type']))),
+ array('config.update', array('search_type', str_replace('phpbb_search_', '\\phpbb\\search\\', $this->config['search_type']))),
)),
);
}
diff --git a/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html b/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html
index a6c19508e2..d8a78b8c6d 100644
--- a/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html
+++ b/phpBB/styles/prosilver/template/ucp_profile_autologin_keys.html
@@ -6,7 +6,6 @@
<div class="panel">
<div class="inner">
- <fieldset>
<!-- IF .errors -->
<p class="error">
<!-- BEGIN errors -->
@@ -38,7 +37,6 @@
<!-- END sessions -->
</tbody>
</table>
- </fieldset>
</div>
</div>
diff --git a/tests/functional/search/base.php b/tests/functional/search/base.php
new file mode 100644
index 0000000000..28327da914
--- /dev/null
+++ b/tests/functional/search/base.php
@@ -0,0 +1,95 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+abstract class phpbb_functional_search_base extends phpbb_functional_test_case
+{
+ protected function assert_search_found($keywords)
+ {
+ $crawler = self::request('GET', 'search.php?keywords=' . $keywords);
+ $this->assertEquals(1, $crawler->filter('.postbody')->count());
+ $this->assertEquals(3, $crawler->filter('.posthilit')->count());
+ }
+
+ protected function assert_search_not_found($keywords)
+ {
+ $crawler = self::request('GET', 'search.php?keywords=' . $keywords);
+ $this->assertEquals(0, $crawler->filter('.postbody')->count());
+ $split_keywords_string = str_replace(array('+', '-'), ' ', $keywords);
+ $this->assertEquals($split_keywords_string, $crawler->filter('#keywords')->attr('value'));
+ }
+
+ public function test_search_backend()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=settings&sid=' . $this->sid);
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ if ($values["config[search_type]"] != $this->search_backend)
+ {
+ $values["config[search_type]"] = $this->search_backend;
+ $form->setValues($values);
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Yes')->form();
+ $values = $form->getValues();
+ $crawler = self::submit($form);
+
+ // check if search backend is not supported
+ if ($crawler->filter('.errorbox')->count() > 0)
+ {
+ $this->markTestSkipped("Search backend is not supported/running");
+ }
+ $this->create_search_index();
+ }
+
+ $this->logout();
+ $this->assert_search_found('phpbb3+installation');
+ $this->assert_search_not_found('loremipsumdedo');
+
+ $this->login();
+ $this->admin_login();
+ $this->delete_search_index();
+ }
+
+ protected function create_search_index()
+ {
+ $this->add_lang('acp/search');
+ $crawler = self::request(
+ 'POST',
+ 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid,
+ array(
+ 'search_type' => $this->search_backend,
+ 'action' => 'create',
+ 'submit' => true,
+ )
+ );
+ $this->assertContainsLang('SEARCH_INDEX_CREATED', $crawler->text());
+ }
+
+ protected function delete_search_index()
+ {
+ $this->add_lang('acp/search');
+ $crawler = self::request(
+ 'POST',
+ 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid,
+ array(
+ 'search_type' => $this->search_backend,
+ 'action' => 'delete',
+ 'submit' => true,
+ )
+ );
+ $this->assertContainsLang('SEARCH_INDEX_REMOVED', $crawler->text());
+ }
+}
diff --git a/tests/functional/search/mysql_test.php b/tests/functional/search/mysql_test.php
new file mode 100644
index 0000000000..7af8051417
--- /dev/null
+++ b/tests/functional/search/mysql_test.php
@@ -0,0 +1,23 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/base.php';
+
+/**
+* @group functional
+*/
+class phpbb_functional_search_mysql_test extends phpbb_functional_search_base
+{
+ protected $search_backend = '\phpbb\search\fulltext_mysql';
+
+ protected function assert_search_not_found($keywords)
+ {
+ $this->markTestIncomplete('MySQL search when fails doesn\'t show the search query');
+ }
+}
diff --git a/tests/functional/search/native_test.php b/tests/functional/search/native_test.php
new file mode 100644
index 0000000000..ce568df616
--- /dev/null
+++ b/tests/functional/search/native_test.php
@@ -0,0 +1,23 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/base.php';
+
+/**
+* @group functional
+*/
+class phpbb_functional_search_native_test extends phpbb_functional_search_base
+{
+ protected $search_backend = '\phpbb\search\fulltext_native';
+
+ protected function assert_search_not_found($keywords)
+ {
+ $this->markTestIncomplete('Native search when fails doesn\'t show the search query');
+ }
+}
diff --git a/tests/functional/search/postgres_test.php b/tests/functional/search/postgres_test.php
new file mode 100644
index 0000000000..487b8aeebb
--- /dev/null
+++ b/tests/functional/search/postgres_test.php
@@ -0,0 +1,23 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/base.php';
+
+/**
+* @group functional
+*/
+class phpbb_functional_search_postgres_test extends phpbb_functional_search_base
+{
+ protected $search_backend = '\phpbb\search\fulltext_postgres';
+
+ protected function assert_search_not_found($keywords)
+ {
+ $this->markTestIncomplete('Postgres search when fails doesn\'t show the search query');
+ }
+}
diff --git a/tests/functional/search/sphinx_test.php b/tests/functional/search/sphinx_test.php
new file mode 100644
index 0000000000..ef2522f9ed
--- /dev/null
+++ b/tests/functional/search/sphinx_test.php
@@ -0,0 +1,23 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/base.php';
+
+/**
+* @group functional
+*/
+class phpbb_functional_search_sphinx_test extends phpbb_functional_search_base
+{
+ protected $search_backend = '\phpbb\search\fulltext_sphinx';
+
+ public function test_search_backend()
+ {
+ $this->markTestIncomplete('Sphinx Tests are not supported');
+ }
+}
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 351a3a9594..2f225fe7af 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -158,6 +158,11 @@ class phpbb_test_case_helpers
{
$config['redis_port'] = $phpbb_redis_port;
}
+
+ if (isset($fulltext_sphinx_id))
+ {
+ $config['fulltext_sphinx_id'] = $fulltext_sphinx_id;
+ }
}
if (isset($_SERVER['PHPBB_TEST_DBMS']))