mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-24 09:30:34 +01:00
[ticket/16902] Make flood interval control in tests consistent
Also remove crawler dumping tool PHPBB3-16902
This commit is contained in:
parent
6846eeaa48
commit
5e43f6195c
@ -868,24 +868,6 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
||||
$this->set_flood_interval(15);
|
||||
}
|
||||
|
||||
protected function set_flood_interval($flood_interval)
|
||||
{
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
|
||||
$values['config[flood_interval]'] = $flood_interval;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
self::assertGreaterThan(0, $crawler->filter('.successbox')->count());
|
||||
|
||||
$this->logout();
|
||||
}
|
||||
|
||||
public function test_feeds_unapproved_topic_admin()
|
||||
{
|
||||
$this->load_ids(array(
|
||||
|
@ -22,13 +22,7 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case
|
||||
$this->login();
|
||||
$this->admin_login();
|
||||
|
||||
// Disable flood interval to post >1 of topics
|
||||
$crawler = self::request('GET', "adm/index.php?i=acp_board&mode=post&sid={$this->sid}");
|
||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form([
|
||||
'config[flood_interval]' => 0,
|
||||
]);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
$this->set_flood_interval(0);
|
||||
|
||||
// Create a forum to move topics around
|
||||
$forum_name = 'MCP Test #1';
|
||||
@ -54,6 +48,8 @@ class phpbb_functional_mcp_main_test extends phpbb_functional_test_case
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$post[1]['topic_id']}&sid={$this->sid}");
|
||||
$this->assertStringContainsString('Testing merge topics moderation actions from MCP/View forum page.', $crawler->filter('html')->text());
|
||||
|
||||
$this->set_flood_interval(15);
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
||||
$searchforauthoruser_id = $this->create_user('searchforauthoruser');
|
||||
}
|
||||
$this->remove_user_group('NEWLY_REGISTERED', ['searchforauthoruser']);
|
||||
$this->disable_flood_interval();
|
||||
$this->set_flood_interval(0);
|
||||
$this->login('searchforauthoruser');
|
||||
$topic_by_author = $this->create_topic(2, 'Test Topic from searchforauthoruser', 'This is a test topic posted by searchforauthoruser to test searching by author.');
|
||||
$this->create_post(2, $topic_by_author['topic_id'], 'Re: Test Topic from searchforauthoruser', 'This is a test post posted by searchforauthoruser');
|
||||
@ -86,6 +86,7 @@ abstract class phpbb_functional_search_base extends phpbb_functional_test_case
|
||||
$this->create_search_index('\phpbb\search\fulltext_native');
|
||||
|
||||
$post = $this->create_topic(2, 'Test Topic 1 foosubject', 'This is a test topic posted by the barsearch testing framework.');
|
||||
$this->set_flood_interval(15);
|
||||
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_search&mode=settings&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
|
||||
|
@ -255,19 +255,6 @@ class phpbb_functional_visibility_disapprove_test extends phpbb_functional_test_
|
||||
$this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}");
|
||||
}
|
||||
|
||||
protected function set_flood_interval($flood_interval)
|
||||
{
|
||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
|
||||
$values["config[flood_interval]"] = $flood_interval;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertGreaterThan(0, $crawler->filter('.successbox')->count());
|
||||
}
|
||||
|
||||
protected function load_ids($data)
|
||||
{
|
||||
$this->db = $this->get_db();
|
||||
|
@ -351,19 +351,6 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
|
||||
$this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}");
|
||||
}
|
||||
|
||||
protected function set_flood_interval($flood_interval)
|
||||
{
|
||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
|
||||
$values["config[flood_interval]"] = $flood_interval;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertGreaterThan(0, $crawler->filter('.successbox')->count());
|
||||
}
|
||||
|
||||
protected function load_ids($data)
|
||||
{
|
||||
$this->db = $this->get_db();
|
||||
|
@ -268,19 +268,6 @@ class phpbb_functional_visibility_unapproved_test extends phpbb_functional_test_
|
||||
$this->assertEquals($details, $data, "Forum {$forum_id} does not match expected {$additional_error_message}");
|
||||
}
|
||||
|
||||
protected function set_flood_interval($flood_interval)
|
||||
{
|
||||
$crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=post");
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form();
|
||||
$values = $form->getValues();
|
||||
|
||||
$values['config[flood_interval]'] = $flood_interval;
|
||||
$form->setValues($values);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertGreaterThan(0, $crawler->filter('.successbox')->count());
|
||||
}
|
||||
|
||||
protected function load_ids($data)
|
||||
{
|
||||
$this->db = $this->get_db();
|
||||
|
@ -1438,31 +1438,6 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
return $file_form_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML of the crawler
|
||||
* See https://symfony.com/doc/current/components/dom_crawler.html#component-dom-crawler-dumping
|
||||
*
|
||||
* @param Symfony\Component\DomCrawler\Crawler $crawler Crawler instance
|
||||
* @param string $url Request URL
|
||||
*
|
||||
* @return array Hidden form fields array
|
||||
*/
|
||||
protected function dump_crawler($crawler)
|
||||
{
|
||||
if (!$crawler)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$html = '';
|
||||
foreach ($crawler as $domElement)
|
||||
{
|
||||
$html .= $domElement->ownerDocument->saveHTML($domElement);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get username of currently logged in user
|
||||
*
|
||||
@ -1481,9 +1456,9 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable posting flood control
|
||||
* Posting flood control
|
||||
*/
|
||||
protected function disable_flood_interval()
|
||||
protected function set_flood_interval($flood_interval)
|
||||
{
|
||||
$relogin_back = false;
|
||||
$logged_in_username = $this->get_logged_in_user();
|
||||
@ -1502,7 +1477,7 @@ class phpbb_functional_test_case extends phpbb_test_case
|
||||
$this->add_lang('acp/common');
|
||||
$crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=post&sid=' . $this->sid);
|
||||
$form = $crawler->selectButton('submit')->form([
|
||||
'config[flood_interval]' => 0,
|
||||
'config[flood_interval]' => $flood_interval,
|
||||
]);
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
|
||||
|
Loading…
x
Reference in New Issue
Block a user