mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.1.x' into 3.2.x
* 3.1.x: [ticket/14802] Add test for empty/blank lines in poll options [ticket/14802] Empty/blank lines should not be additional poll options
This commit is contained in:
commit
7bb4e88acd
2 changed files with 17 additions and 1 deletions
|
@ -1860,7 +1860,7 @@ class parse_message extends bbcode_firstpass
|
||||||
// Parse Poll Option text
|
// Parse Poll Option text
|
||||||
$tmp_message = $this->message;
|
$tmp_message = $this->message;
|
||||||
|
|
||||||
$poll['poll_options'] = explode("\n", trim($poll['poll_option_text']));
|
$poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text']));
|
||||||
$poll['poll_options_size'] = sizeof($poll['poll_options']);
|
$poll['poll_options_size'] = sizeof($poll['poll_options']);
|
||||||
|
|
||||||
foreach ($poll['poll_options'] as &$poll_option)
|
foreach ($poll['poll_options'] as &$poll_option)
|
||||||
|
|
|
@ -159,6 +159,22 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_post_poll()
|
||||||
|
{
|
||||||
|
$this->login();
|
||||||
|
|
||||||
|
$post = $this->create_topic(
|
||||||
|
2,
|
||||||
|
'[ticket/14802] Test Poll Option Spacing',
|
||||||
|
'Empty/blank lines should not be additional poll options.',
|
||||||
|
array('poll_title' => 'Poll Title', 'poll_option_text' => "\n A \nB\n\nC \n D\nE\n\n \n")
|
||||||
|
);
|
||||||
|
|
||||||
|
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
|
||||||
|
$this->assertEquals('Poll Title', $crawler->filter('.poll-title')->text());
|
||||||
|
$this->assertEquals(5, $crawler->filter('*[data-poll-option-id]')->count());
|
||||||
|
}
|
||||||
|
|
||||||
protected function set_quote_depth($depth)
|
protected function set_quote_depth($depth)
|
||||||
{
|
{
|
||||||
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
$crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post');
|
||||||
|
|
Loading…
Add table
Reference in a new issue