1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-19 23:20:22 +01:00

[ticket/16902] Add search index deleted assertion to test

PHPBB3-16902
This commit is contained in:
rxu 2021-11-26 11:34:52 +07:00
parent ba487a24dc
commit b602b57b02
No known key found for this signature in database
GPG Key ID: 955F0567380E586A

View File

@ -52,7 +52,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
protected function assert_search_not_found($keywords)
{
$crawler = self::request('GET', 'search.php?keywords=' . $keywords);
$this->assertEquals(0, $crawler->filter('.postbody')->count(),$this->search_backend);
$this->assertEquals(0, $crawler->filter('.postbody')->count(), $this->search_backend);
$split_keywords_string = str_replace('+', ' ', $keywords);
$this->assertEquals($split_keywords_string, $crawler->filter('#keywords')->attr('value'), $this->search_backend);
}
@ -66,6 +66,8 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
public function test_search_backend()
{
$this->add_lang('common');
// Create a new standard user if needed, topic and post to test searh for author
if (!$this->user_exists('searchforauthoruser'))
{
@ -85,9 +87,8 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
$post = $this->create_topic(2, 'Test Topic 1 foosubject', 'This is a test topic posted by the barsearch testing framework.');
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=settings&sid=' . $this->sid);
$form = $crawler->selectButton('Submit')->form();
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$values = $form->getValues();
if ($values["config[search_type]"] != $this->search_backend)
@ -96,7 +97,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
$form->setValues($values);
$crawler = self::submit($form);
$form = $crawler->selectButton('Yes')->form();
$form = $crawler->selectButton($this->lang('YES'))->form();
$values = $form->getValues();
$crawler = self::submit($form);
@ -141,13 +142,13 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
{
$this->add_lang('acp/search');
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid);
$form = $crawler->selectButton('Create index')->form();
$form = $crawler->selectButton($this->lang('CREATE_INDEX'))->form();
$form_values = $form->getValues();
$form_values = array_merge($form_values,
array(
[
'search_type' => ( ($backend === null) ? $this->search_backend : $backend ),
'action' => 'create',
)
]
);
$form->setValues($form_values);
$crawler = self::submit($form);
@ -158,16 +159,21 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
{
$this->add_lang('acp/search');
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid);
$form = $crawler->selectButton('Delete index')->form();
$form = $crawler->selectButton($this->lang('DELETE_INDEX'))->form();
$form_values = $form->getValues();
$form_values = array_merge($form_values,
array(
[
'search_type' => $this->search_backend,
'action' => 'delete',
)
]
);
$form->setValues($form_values);
$crawler = self::submit($form);
$this->assertContainsLang('SEARCH_INDEX_REMOVED', $crawler->text());
// Ensure search index has been actually removed
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=index&sid=' . $this->sid);
$posts_indexed = (int) $crawler->filter('#acp_search_index_' . $this->search_backend . ' td')->eq(1)->text();
$this->assertEquals(0, $posts_indexed);
}
}