mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/12013] Fix functional tests and sniffer issue.
PHPBB3-12013
This commit is contained in:
parent
ddf3ab323b
commit
d95c97c3b4
7 changed files with 42 additions and 65 deletions
|
@ -531,7 +531,7 @@ $s_quickmod_action = append_sid(
|
||||||
'start' => $start,
|
'start' => $start,
|
||||||
'quickmod' => 1,
|
'quickmod' => 1,
|
||||||
'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)),
|
'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)),
|
||||||
),
|
),
|
||||||
true,
|
true,
|
||||||
$user->session_id
|
$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');
|
$this->add_lang('posting');
|
||||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
$crawler = $this->get_quickmod_page($this->data['topics']['Download Topic #1'], 'DELETE_TOPIC');
|
||||||
$form['action']->select('delete_topic');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$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');
|
$this->add_lang('posting');
|
||||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
$crawler = $this->get_quickmod_page($this->data['topics']['Feeds #1 - Topic #2'], 'DELETE_TOPIC');
|
||||||
$form['action']->select('delete_topic');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$this->add_lang('mcp');
|
||||||
|
|
|
@ -20,18 +20,16 @@ class phpbb_functional_jumpbox_test extends phpbb_functional_test_case
|
||||||
{
|
{
|
||||||
$this->login();
|
$this->login();
|
||||||
|
|
||||||
$crawler = self::request('GET', "viewtopic.php?t=1&sid={$this->sid}");
|
$this->crawler = $this->get_quickmod_page(1, 'MERGE_TOPIC');
|
||||||
$form = $crawler->filter('#quickmodform')->selectButton($this->lang('GO'))->form(array(
|
$this->check_valid_jump('Your first forum');
|
||||||
'action' => 'merge_topic',
|
|
||||||
));
|
|
||||||
|
|
||||||
$crawler = self::submit($form);
|
$link = $this->crawler->filter('#jumpbox')->selectLink('Your first category')->link()->getUri();
|
||||||
$this->assertContains($this->lang('FORUM') . ': Your first forum', $crawler->filter('#cp-main h2')->text());
|
$this->crawler = self::request('GET', substr($link, strpos($link, 'mcp.')));
|
||||||
$form = $crawler->filter('#jumpbox')->selectButton($this->lang('GO'))->form(array(
|
$this->check_valid_jump('Your first category');
|
||||||
'f' => 1,
|
}
|
||||||
));
|
|
||||||
|
|
||||||
$crawler = self::submit($form);
|
protected function check_valid_jump($forum)
|
||||||
$this->assertContains($this->lang('FORUM') . ': Your first category', $crawler->filter('#cp-main h2')->text());
|
{
|
||||||
|
$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)
|
public function test_handle_quickmod($crawler)
|
||||||
{
|
{
|
||||||
// Test moving a post
|
// Test moving a post
|
||||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
return $this->get_quickmod_page(0, 'MERGE_POSTS', $crawler);
|
||||||
$form['action']->select('merge');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
|
|
||||||
return $crawler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -186,11 +186,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||||
'forum_last_post_id' => 0,
|
'forum_last_post_id' => 0,
|
||||||
), 'before moving #2');
|
), 'before moving #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'], 'MOVE_TOPIC');
|
||||||
|
|
||||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
|
||||||
$form['action']->select('move');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$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'],
|
'forum_last_post_id' => $this->data['posts']['Soft Delete Topic #1'],
|
||||||
), 'before softdeleting #2');
|
), 'before softdeleting #2');
|
||||||
|
|
||||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
|
||||||
|
|
||||||
$this->add_lang('posting');
|
$this->add_lang('posting');
|
||||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'DELETE_TOPIC');
|
||||||
$form['action']->select('delete_topic');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$this->add_lang('mcp');
|
||||||
|
@ -336,11 +328,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||||
'forum_last_post_id' => 0,
|
'forum_last_post_id' => 0,
|
||||||
), 'before moving #2');
|
), 'before moving #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'], 'MOVE_TOPIC');
|
||||||
|
|
||||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
|
||||||
$form['action']->select('move');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
$this->assertContainsLang('SELECT_DESTINATION_FORUM', $crawler->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$this->add_lang('mcp');
|
||||||
|
@ -484,12 +472,9 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_
|
||||||
'forum_last_post_id' => 0,
|
'forum_last_post_id' => 0,
|
||||||
), 'before splitting #2');
|
), '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');
|
$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());
|
$this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text());
|
||||||
|
|
||||||
$form = $crawler->selectButton('Submit')->form(array(
|
$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}");
|
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MOVE_TOPIC');
|
||||||
|
|
||||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
|
||||||
$form['action']->select('move');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
|
|
||||||
$form = $crawler->selectButton('Yes')->form();
|
$form = $crawler->selectButton('Yes')->form();
|
||||||
$form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
|
$form['to_forum_id']->select($this->data['forums']['Soft Delete #1']);
|
||||||
$crawler = self::submit($form);
|
$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->assertContainsLang('BOOKMARK_ADDED', $crawler_bookmark->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$this->add_lang('mcp');
|
||||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MERGE_TOPIC', $crawler);
|
||||||
$form['action']->select('merge_topic');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('SELECT_MERGE', $crawler->text());
|
$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']}");
|
$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,
|
'forum_last_post_id' => 0,
|
||||||
), 'before forking #2');
|
), 'before forking #2');
|
||||||
|
|
||||||
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #1']}&sid={$this->sid}");
|
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$this->add_lang('mcp');
|
||||||
$form = $crawler->selectButton('Go')->eq(2)->form();
|
$crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #1'], 'FORK_TOPIC');
|
||||||
$form['action']->select('fork');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('FORK_TOPIC', $crawler->text());
|
$this->assertContainsLang('FORK_TOPIC', $crawler->text());
|
||||||
|
|
||||||
$form = $crawler->selectButton('Yes')->form();
|
$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)
|
public function delete_topic($topic_id)
|
||||||
{
|
{
|
||||||
$crawler = self::request('GET', "viewtopic.php?t={$topic_id}&sid={$this->sid}");
|
|
||||||
|
|
||||||
$this->add_lang('posting');
|
$this->add_lang('posting');
|
||||||
$form = $crawler->selectButton('Go')->eq(1)->form();
|
$crawler = $this->get_quickmod_page($topic_id, 'DELETE_TOPIC');
|
||||||
$form['action']->select('delete_topic');
|
|
||||||
$crawler = self::submit($form);
|
|
||||||
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
$this->assertContainsLang('DELETE_PERMANENTLY', $crawler->text());
|
||||||
|
|
||||||
$this->add_lang('mcp');
|
$this->add_lang('mcp');
|
||||||
|
@ -1067,4 +1063,25 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
|
||||||
|
|
||||||
return $manager;
|
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…
Add table
Reference in a new issue