mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-21 00:02:18 +02:00
[ticket/12013] Fix functional tests and sniffer issue.
PHPBB3-12013
This commit is contained in:
parent
ddf3ab323b
commit
d95c97c3b4
@ -531,7 +531,7 @@ $s_quickmod_action = append_sid(
|
||||
'start' => $start,
|
||||
'quickmod' => 1,
|
||||
'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)),
|
||||
),
|
||||
),
|
||||
true,
|
||||
$user->session_id
|
||||
);
|
||||
|
@ -205,12 +205,8 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
|
||||
),
|
||||
));
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Download Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('posting');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('delete_topic');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Download Topic #1'], 'DELETE_TOPIC');
|
||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
|
@ -619,12 +619,8 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
|
||||
),
|
||||
));
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Feeds #1 - Topic #2']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('posting');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('delete_topic');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Feeds #1 - Topic #2'], 'DELETE_TOPIC');
|
||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
|
@ -20,18 +20,16 @@ class phpbb_functional_jumpbox_test extends phpbb_functional_test_case
|
||||
{
|
||||
$this->login();
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}");
|
||||
$form = $crawler->filter('#quickmodform')->selectButton($this->lang('GO'))->form(array(
|
||||
'action' => 'merge_topic',
|
||||
));
|
||||
$this->crawler = $this->get_quickmod_page(1, 'MERGE_TOPIC');
|
||||
$this->check_valid_jump('Your first forum');
|
||||
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($this->lang('FORUM') . ': Your first forum', $crawler->filter('#cp-main h2')->text());
|
||||
$form = $crawler->filter('#jumpbox')->selectButton($this->lang('GO'))->form(array(
|
||||
'f' => 1,
|
||||
));
|
||||
$link = $this->crawler->filter('#jumpbox')->selectLink('Your first category')->link()->getUri();
|
||||
$this->crawler = self::request('GET', substr($link, strpos($link, 'mcp.')));
|
||||
$this->check_valid_jump('Your first category');
|
||||
}
|
||||
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContains($this->lang('FORUM') . ': Your first category', $crawler->filter('#cp-main h2')->text());
|
||||
protected function check_valid_jump($forum)
|
||||
{
|
||||
$this->assertContains($this->lang('FORUM') . ": $forum", $this->crawler->filter('#cp-main h2')->text(), $this->crawler->text());
|
||||
}
|
||||
}
|
||||
|
@ -35,11 +35,7 @@ class phpbb_functional_mcp_test extends phpbb_functional_test_case
|
||||
public function test_handle_quickmod($crawler)
|
||||
{
|
||||
// Test moving a post
|
||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
||||
$form['action']->select('merge');
|
||||
$crawler = self::submit($form);
|
||||
|
||||
return $crawler;
|
||||
return $this->get_quickmod_page(0, 'MERGE_POSTS', $crawler);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,11 +186,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before moving #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('move');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'MOVE_TOPIC');
|
||||
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
@ -261,12 +257,8 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||
), 'before softdeleting #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('posting');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('delete_topic');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'DELETE_TOPIC');
|
||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
@ -336,11 +328,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before moving #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('move');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'MOVE_TOPIC');
|
||||
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
@ -484,12 +472,9 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before splitting #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'SPLIT_TOPIC');
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('split');
|
||||
$crawler = self::submit($form);
|
||||
$this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Submit')->form(array(
|
||||
@ -546,12 +531,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
),
|
||||
));
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}");
|
||||
|
||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
||||
$form['action']->select('move');
|
||||
$crawler = self::submit($form);
|
||||
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MOVE_TOPIC');
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
|
||||
$crawler = self::submit($form);
|
||||
@ -605,9 +585,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
$this->assertContainsLang('BOOKMARK_ADDED', $crawler_bookmark->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
||||
$form['action']->select('merge_topic');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MERGE_TOPIC', $crawler);
|
||||
$this->assertContainsLang('SELECT_MERGE', $crawler->text());
|
||||
|
||||
$crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}");
|
||||
@ -670,12 +648,8 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||
'forum_last_post_id' => 0,
|
||||
), 'before forking #2');
|
||||
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('mcp');
|
||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
||||
$form['action']->select('fork');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'FORK_TOPIC');
|
||||
$this->assertContainsLang('FORK_TOPIC', $crawler->text());
|
||||
|
||||
$form = $crawler->selectButton('Yes')->form();
|
||||
|
@ -971,12 +971,8 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
|
||||
*/
|
||||
public function delete_topic($topic_id)
|
||||
{
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$topic_id}&sid={$this->sid}");
|
||||
|
||||
$this->add_lang('posting');
|
||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
||||
$form['action']->select('delete_topic');
|
||||
$crawler = self::submit($form);
|
||||
$crawler = $this->get_quickmod_page($topic_id, 'DELETE_TOPIC');
|
||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||
|
||||
$this->add_lang('mcp');
|
||||
@ -1067,4 +1063,25 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
|
||||
|
||||
return $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quickmod page
|
||||
*
|
||||
* @param int $topic_id
|
||||
* @param string $action Language key for the quickmod action
|
||||
* @param Symfony\Component\DomCrawler\Crawler Optional crawler object to use instead of creating new one.
|
||||
* @return Symfony\Component\DomCrawler\Crawler
|
||||
*/
|
||||
public function get_quickmod_page($topic_id, $action, $crawler = false)
|
||||
{
|
||||
$this->add_lang('viewtopic');
|
||||
|
||||
if ($crawler === false)
|
||||
{
|
||||
$crawler = self::request('GET', "viewtopic.php?t={$topic_id}&sid={$this->sid}");
|
||||
}
|
||||
$link = $crawler->filter('#quickmod')->selectLink($this->lang($action))->link()->getUri();
|
||||
|
||||
return self::request('GET', substr($link, strpos($link, 'mcp.')));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user