mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-05 05:55:15 +02:00
[ticket/15540] Fix tests
PHPBB3-15540
This commit is contained in:
parent
16220058d3
commit
5c67eabeed
@ -78,7 +78,8 @@ class acp_search
|
||||
foreach ($search_types as $search)
|
||||
{
|
||||
// Only show available search backends
|
||||
if($search->is_available()) {
|
||||
if ($search->is_available())
|
||||
{
|
||||
|
||||
$name = $search->get_name();
|
||||
|
||||
@ -88,16 +89,20 @@ class acp_search
|
||||
$identifier = substr($type, strrpos($type, '\\') + 1);
|
||||
$search_options .= "<option value=\"$type\"$selected data-toggle-setting=\"#search_{$identifier}_settings\">$name</option>";
|
||||
|
||||
if (method_exists($search, 'acp')) {
|
||||
if (method_exists($search, 'acp'))
|
||||
{
|
||||
$vars = $search->acp();
|
||||
|
||||
if (!$submit) {
|
||||
if (!$submit)
|
||||
{
|
||||
$template->assign_block_vars('backend', array(
|
||||
'NAME' => $name,
|
||||
'SETTINGS' => $vars['tpl'],
|
||||
'IDENTIFIER' => $identifier,
|
||||
));
|
||||
} else if (is_array($vars['config'])) {
|
||||
}
|
||||
else if (is_array($vars['config']))
|
||||
{
|
||||
$settings = array_merge($settings, $vars['config']);
|
||||
}
|
||||
}
|
||||
|
@ -1404,11 +1404,6 @@ function mcp_fork_topic($topic_ids)
|
||||
$search_backend_factory = $phpbb_container->get('search.backend_factory');
|
||||
$search = $search_backend_factory->get_active();
|
||||
$search_mode = 'post';
|
||||
|
||||
if ($error)
|
||||
{
|
||||
trigger_error($error);
|
||||
}
|
||||
}
|
||||
else if (!isset($search_type) && !$topic_row['enable_indexing'])
|
||||
{
|
||||
|
@ -296,6 +296,11 @@ abstract class base implements search_backend_interface
|
||||
{
|
||||
$rows = $this->get_posts_between($post_counter + 1, $post_counter + self::BATCH_SIZE);
|
||||
|
||||
if ($this->db->sql_buffer_nested_transactions())
|
||||
{
|
||||
$rows = iterator_to_array($rows);
|
||||
}
|
||||
|
||||
foreach ($rows as $row)
|
||||
{
|
||||
// Indexing enabled for this forum
|
||||
@ -415,7 +420,7 @@ abstract class base implements search_backend_interface
|
||||
AND post_id <= ' . $final_id;
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
while($row = $this->db->sql_fetchrow($result))
|
||||
while ($row = $this->db->sql_fetchrow($result))
|
||||
{
|
||||
yield $row;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ class fulltext_mysql extends base implements search_backend_interface
|
||||
public function is_available(): bool
|
||||
{
|
||||
// Check if we are using mysql
|
||||
if($this->db->get_sql_layer() != 'mysqli')
|
||||
if ($this->db->get_sql_layer() != 'mysqli')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -649,7 +649,8 @@ class fulltext_sphinx implements search_backend_interface
|
||||
*/
|
||||
public function delete_index(int &$post_counter = null): ?array
|
||||
{
|
||||
if ($this->index_created()) {
|
||||
if ($this->index_created())
|
||||
{
|
||||
$this->db_tools->sql_table_drop(SPHINX_TABLE);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_admin.php';
|
||||
require_once __DIR__ . '/../../phpBB/includes/functions_posting.php';
|
||||
require_once __DIR__ . '/../mock/search.php';
|
||||
|
||||
class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
|
||||
{
|
||||
|
@ -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\backend\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.');
|
||||
|
||||
@ -49,18 +49,28 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
||||
if ($values["config[search_type]"] != $this->search_backend)
|
||||
{
|
||||
$values["config[search_type]"] = $this->search_backend;
|
||||
$form->setValues($values);
|
||||
|
||||
try
|
||||
{
|
||||
$form->setValues($values);
|
||||
}
|
||||
catch(\InvalidArgumentException $e)
|
||||
{
|
||||
// Search backed is not supported because don't appear in the select
|
||||
$this->delete_topic($post['topic_id']);
|
||||
$this->markTestSkipped("Search backend is not supported/running");
|
||||
}
|
||||
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$values = $form->getValues();
|
||||
$crawler = self::submit($form);
|
||||
|
||||
// check if search backend is not supported
|
||||
// Unknown error selecting search backend
|
||||
if ($crawler->filter('.errorbox')->count() > 0)
|
||||
{
|
||||
$this->delete_topic($post['topic_id']);
|
||||
$this->markTestSkipped("Search backend is not supported/running");
|
||||
$this->fail('Error when trying to select available search backend');
|
||||
}
|
||||
|
||||
$this->create_search_index();
|
||||
|
@ -26,7 +26,7 @@ class phpbb_mock_user
|
||||
public $lang = [];
|
||||
|
||||
private $options = array();
|
||||
public function optionget($item)
|
||||
public function optionget($item, $data = false)
|
||||
{
|
||||
if (!isset($this->options[$item]))
|
||||
{
|
||||
@ -36,7 +36,7 @@ class phpbb_mock_user
|
||||
return $this->options[$item];
|
||||
}
|
||||
|
||||
public function optionset($item, $value)
|
||||
public function optionset($item, $value, $data = false)
|
||||
{
|
||||
$this->options[$item] = $value;
|
||||
}
|
||||
|
@ -24,13 +24,15 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $config, $user, $cache;
|
||||
global $phpbb_root_path, $phpEx, $config, $cache;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// dbal uses cache
|
||||
$cache = new phpbb_mock_cache();
|
||||
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
|
||||
// set config values
|
||||
$config['fulltext_mysql_min_word_len'] = 4;
|
||||
$config['fulltext_mysql_max_word_len'] = 254;
|
||||
|
@ -24,13 +24,15 @@ class phpbb_search_native_test extends phpbb_search_test_case
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $config, $user, $cache;
|
||||
global $phpbb_root_path, $phpEx, $config, $cache;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// dbal uses cache
|
||||
$cache = new phpbb_mock_cache();
|
||||
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
|
||||
$this->db = $this->new_dbal();
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native');
|
||||
|
@ -24,13 +24,15 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
global $phpbb_root_path, $phpEx, $config, $user, $cache;
|
||||
global $phpbb_root_path, $phpEx, $config, $cache;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
// dbal uses cache
|
||||
$cache = new phpbb_mock_cache();
|
||||
|
||||
$user = $this->createMock('\phpbb\user');
|
||||
|
||||
// set config values
|
||||
$config['fulltext_postgres_min_word_len'] = 4;
|
||||
$config['fulltext_postgres_max_word_len'] = 254;
|
||||
|
Loading…
x
Reference in New Issue
Block a user