1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 16:36:47 +02:00

Support smart quotes in mentions format

This commit is contained in:
SychO9
2021-05-24 21:49:31 +01:00
parent a311edf106
commit cc62044e6f
3 changed files with 34 additions and 3 deletions

View File

@@ -156,6 +156,37 @@ class UserMentionsTest extends TestCase
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
}
/**
* @test
*/
public function mentioning_a_valid_user_with_new_format_with_smart_quotes_works()
{
$response = $this->send(
$this->request('POST', '/api/posts', [
'authenticatedAs' => 1,
'json' => [
'data' => [
'attributes' => [
'content' => '@“POTATO$”#3',
],
'relationships' => [
'discussion' => ['data' => ['id' => 2]],
],
],
],
])
);
$this->assertEquals(201, $response->getStatusCode());
$response = json_decode($response->getBody(), true);
$this->assertStringContainsString('@POTATO$', $response['data']['attributes']['contentHtml']);
$this->assertStringContainsString('@"POTATO$"#3', $response['data']['attributes']['content']);
$this->assertStringContainsString('UserMention', $response['data']['attributes']['contentHtml']);
$this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsUsers->find(3));
}
/**
* @test
*/