diff options
Diffstat (limited to 'tests/functional/posting_test.php')
-rw-r--r-- | tests/functional/posting_test.php | 78 |
1 files changed, 70 insertions, 8 deletions
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index 33632a01e1..ccfeb10deb 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -45,14 +45,6 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case self::create_post(2, 1, - 'Unsupported characters', - "This is a test with these weird characters: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6", - array(), - 'Your message contains the following unsupported characters' - ); - - self::create_post(2, - 1, "Unsupported: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6", 'This is a test with emoji characters in the topic title.', array(), @@ -60,6 +52,40 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case ); } + public function test_supported_unicode_characters() + { + $this->login(); + + $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); + $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', "This is a test with these weird characters: \xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6"); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains("\xF0\x9F\x88\xB3 \xF0\x9F\x9A\xB6", $crawler->text()); + } + + public function test_html_entities() + { + $this->login(); + + $post = $this->create_topic(2, 'Test Topic 1', 'This is a test topic posted by the testing framework.'); + $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', '😀'); + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertContains('😀', $crawler->text()); + } + + public function test_quote() + { + $text = 'Test post </textarea>"\' &&amp;'; + $expected = '[quote="admin"]' . $text . '[/quote]'; + + $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); + + $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()); + } + /** * @testdox max_quote_depth is applied to the text populating the posting form */ @@ -140,4 +166,40 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case $crawler = self::submit($form); $this->assertEquals(1, $crawler->filter('.successbox')->count()); } + + public function test_ticket_8420() + { + $text = '[b][url=http://example.org] :arrow: here[/url][/b]'; + + $this->login(); + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => $text + )); + $crawler = self::submit($form); + $this->assertEquals($text, $crawler->filter('#message')->text()); + } + + public function test_old_signature_in_preview() + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_sig = '[b:2u8sdcwb]My signature[/b:2u8sdcwb]', + user_sig_bbcode_uid = '2u8sdcwb', + user_sig_bbcode_bitfield = 'QA==' + WHERE user_id = 2"; + $this->get_db()->sql_query($sql); + + $this->login(); + $crawler = self::request('GET', 'posting.php?mode=post&f=2'); + $form = $crawler->selectButton('Preview')->form(array( + 'subject' => 'Test subject', + 'message' => 'My post', + )); + $crawler = self::submit($form); + $this->assertContains( + '<span style="font-weight: bold">My signature</span>', + $crawler->filter('#preview .signature')->html() + ); + } } |