mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-22 18:08:54 +00:00
Compare commits
2 commits
2968c2859a
...
28e39fb7b8
Author | SHA1 | Date | |
---|---|---|---|
|
28e39fb7b8 | ||
|
f92fce1622 |
1 changed files with 7 additions and 13 deletions
|
@ -223,12 +223,6 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
|
||||
public function test_caching_search_results()
|
||||
{
|
||||
// Sphinx search doesn't use phpBB search results caching
|
||||
if (strpos($this->search_backend, 'fulltext_sphinx'))
|
||||
{
|
||||
$this->markTestSkipped("Sphinx search doesn't use phpBB search results caching");
|
||||
}
|
||||
|
||||
$this->purge_cache();
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
@ -241,7 +235,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
$posts_count = (int) $matches[1];
|
||||
|
||||
$this->assertStringContainsString("Search found $posts_count matches", $posts_found_text, $this->search_backend);
|
||||
|
||||
|
||||
// Set this value to cache less results than total count
|
||||
$sql = 'UPDATE ' . CONFIG_TABLE . '
|
||||
SET config_value = ' . floor($posts_count / 3) . "
|
||||
|
@ -256,7 +250,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
$values['config[posts_per_page]'] = floor($posts_count / 10);
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count(), $this->search_backend);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count());
|
||||
|
||||
// Now actually test caching search results
|
||||
$this->purge_cache();
|
||||
|
@ -339,10 +333,10 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
$post_ids_cached_backup = $post_ids_cached;
|
||||
|
||||
// Cached data still should have initial 'd' sort direction
|
||||
$this->assertTrue($post_ids_cached[-2] === 'd', $this->search_backend);
|
||||
$this->assertTrue($post_ids_cached[-2] === 'd');
|
||||
|
||||
// Cached search results count should be more than or equal to displayed one
|
||||
$this->assertGreaterThanOrEqual($posts_count, $post_ids_cached[-1], $this->search_backend);
|
||||
$this->assertGreaterThanOrEqual($posts_count, $post_ids_cached[-1]);
|
||||
|
||||
/* Check post ids cached data. Array shouldn't change after removing duplicates and re-sorting.
|
||||
* That means it shouldn't have any duplicates and it should be properly ordered already
|
||||
|
@ -351,7 +345,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
unset($post_ids_cached_backup[-2], $post_ids_cached_backup[-1]);
|
||||
$post_ids_cached = array_unique($post_ids_cached);
|
||||
rsort($post_ids_cached);
|
||||
$this->assertEquals($post_ids_cached_backup, $post_ids_cached, $this->search_backend);
|
||||
$this->assertEquals($post_ids_cached_backup, $post_ids_cached);
|
||||
|
||||
// Restore this value to default
|
||||
$sql = 'UPDATE ' . CONFIG_TABLE . '
|
||||
|
@ -359,7 +353,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
WHERE config_name = '" . $this->db->sql_escape('search_block_size') . "'";
|
||||
$this->db->sql_query($sql);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count(), $this->search_backend);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count());
|
||||
|
||||
// Restore posts_per_page value
|
||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||
|
@ -368,7 +362,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
|||
$values['config[posts_per_page]'] = $current_posts_per_page;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count(), $this->search_backend);
|
||||
$this->assertEquals(1, $crawler->filter('.successbox')->count());
|
||||
}
|
||||
|
||||
protected function create_search_index($backend = null)
|
||||
|
|
Loading…
Add table
Reference in a new issue