aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/functional/posting_test.php43
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php7
2 files changed, 19 insertions, 31 deletions
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index 430a6496a0..b0a2f069e1 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -43,35 +43,18 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$this->add_lang('posting');
- $crawler = self::request('GET', "posting.php?mode=reply&f=2&t=1&sid={$this->sid}");
-
- $form = $crawler->selectButton('Submit')->form();
-
- $hidden_fields = array(
- $crawler->filter('[type="hidden"]')->each(function ($node, $i) {
- return array('name' => $node->attr('name'), 'value' => $node->attr('value'));
- }),
- );
-
- foreach ($hidden_fields as $fields)
- {
- foreach($fields as $field)
- {
- $form_data[$field['name']] = $field['value'];
- }
- }
-
- // Bypass time restriction that said that if the lastclick time (i.e. time when the form was opened)
- // is not at least 2 seconds before submission, cancel the form
- $form_data['lastclick'] = 0;
-
- $form_data += array(
- 'subject' => 'Unsupported characters',
- 'message' => 'This is a test with these weird characters: 👅👅👅',
- 'post' => true,
- );
- $crawler = self::request('POST', "posting.php?mode=reply&f=2&t=1&sid={$this->sid}", $form_data);
-
- $this->assertContains('Your message contains the following unsupported characters', $crawler->text());
+ 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(),
+ 'Your subject contains the following unsupported characters');
}
}
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 182ffaaaf7..c0127c50c9 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -996,11 +996,16 @@ class phpbb_functional_test_case extends phpbb_test_case
// Instead, I send it as a request with the submit button "post" set to true.
$crawler = self::request('POST', $posting_url, $form_data);
- if ($expected !== '')
+ if ($expected !== '' && isset($this->lang[$expected]))
{
$this->assertContainsLang($expected, $crawler->filter('html')->text());
return null;
}
+ else if ($expected !== '')
+ {
+ $this->assertContains($expected, $crawler->filter('html')->text());
+ return null;
+ }
$url = $crawler->selectLink($form_data['subject'])->link()->getUri();
return array(