1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/10620] Implemented quote improvements

PHPBB3-10620
This commit is contained in:
JoshyPHP
2015-06-16 08:16:56 +02:00
parent 8747c7a2c1
commit f02cc27014
12 changed files with 248 additions and 31 deletions

View File

@@ -75,7 +75,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
public function test_quote()
{
$text = 'Test post </textarea>"\' &&amp;amp;';
$expected = '[quote="admin"]' . $text . '[/quote]';
$expected = '([quote="admin"[^]]*\\]' . preg_quote($text) . '\\[/quote\\])';
$this->login();
$topic = $this->create_topic(2, 'Test Topic 1', 'Test topic');
@@ -83,7 +83,7 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$crawler = self::request('GET', "posting.php?mode=quote&f=2&t={$post['topic_id']}&p={$post['post_id']}&sid={$this->sid}");
$this->assertContains($expected, $crawler->filter('textarea#message')->text());
$this->assertRegexp($expected, $crawler->filter('textarea#message')->text());
}
/**
@@ -93,10 +93,10 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
{
$text = '0[quote]1[quote]2[/quote]1[/quote]0';
$expected = array(
0 => '[quote="admin"]0[quote]1[quote]2[/quote]1[/quote]0[/quote]',
1 => '[quote="admin"]00[/quote]',
2 => '[quote="admin"]0[quote]11[/quote]0[/quote]',
3 => '[quote="admin"]0[quote]1[quote]2[/quote]1[/quote]0[/quote]',
0 => '0[quote]1[quote]2[/quote]1[/quote]0',
1 => '00',
2 => '0[quote]11[/quote]0',
3 => '0[quote]1[quote]2[/quote]1[/quote]0',
);
$this->login();
@@ -109,7 +109,10 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
{
$this->set_quote_depth($quote_depth);
$crawler = self::request('GET', $quote_url);
$this->assertContains($expected_text, $crawler->filter('textarea#message')->text());
$this->assertRegexp(
'(\\[quote="admin"[^]]*\\]' . preg_quote($expected_text) . '\\[/quote\\])',
$crawler->filter('textarea#message')->text()
);
}
}

View File

@@ -69,16 +69,30 @@ class phpbb_functional_private_messages_test extends phpbb_functional_test_case
public function test_quote_post()
{
$text = 'Test post';
$expected = '[quote="admin"]' . $text . '[/quote]';
$text = 'Test post';
$this->login();
$topic = $this->create_topic(2, 'Test Topic 1', 'Test topic');
$post = $this->create_post(2, $topic['topic_id'], 'Re: Test Topic 1', $text);
$expected = '(\\[quote="admin" post_id="' . $post['post_id'] . '" time="\\d+" user_id="2"\\]' . $text . '\\[/quote\\])';
$crawler = self::request('GET', 'ucp.php?i=pm&mode=compose&action=quotepost&p=' . $post['post_id'] . '&sid=' . $this->sid);
$this->assertContains($expected, $crawler->filter('textarea#message')->text());
$this->assertRegexp($expected, $crawler->filter('textarea#message')->text());
}
public function test_quote_pm()
{
$text = 'This is a test private message sent by the testing framework.';
$expected = '(\\[quote="admin" time="\\d+" user_id="2"\\]' . $text . '\\[/quote\\])';
$this->login();
$message_id = $this->create_private_message('Test', $text, array(2));
$crawler = self::request('GET', 'ucp.php?i=pm&mode=compose&action=quote&p=' . $message_id . '&sid=' . $this->sid);
$this->assertRegexp($expected, $crawler->filter('textarea#message')->text());
}
public function test_quote_forward()