From b0a301229a97f87f54f2ba2da50c705e418164f0 Mon Sep 17 00:00:00 2001 From: SychO9 Date: Tue, 25 May 2021 00:15:10 +0100 Subject: [PATCH] Tweak test name and add posts mention equivalent test --- .../integration/api/PostMentionsTest.php | 31 +++++++++++++++++++ .../integration/api/UserMentionsTest.php | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/extensions/mentions/tests/integration/api/PostMentionsTest.php b/extensions/mentions/tests/integration/api/PostMentionsTest.php index 46346a7cb..3457b1d19 100644 --- a/extensions/mentions/tests/integration/api/PostMentionsTest.php +++ b/extensions/mentions/tests/integration/api/PostMentionsTest.php @@ -126,6 +126,37 @@ class PostMentionsTest extends TestCase $this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(4)); } + /** + * @test + */ + public function mentioning_a_valid_post_with_new_format_with_smart_quotes_works_and_falls_back_to_normal_quotes() + { + $response = $this->send( + $this->request('POST', '/api/posts', [ + 'authenticatedAs' => 1, + 'json' => [ + 'data' => [ + 'attributes' => [ + 'content' => '@“POTATO$”#p4', + ], + 'relationships' => [ + 'discussion' => ['data' => ['id' => 2]], + ], + ], + ], + ]) + ); + + $this->assertEquals(201, $response->getStatusCode()); + + $response = json_decode($response->getBody(), true); + + $this->assertStringContainsString('POTATO$', $response['data']['attributes']['contentHtml']); + $this->assertEquals('@"POTATO$"#p4', $response['data']['attributes']['content']); + $this->assertStringContainsString('PostMention', $response['data']['attributes']['contentHtml']); + $this->assertNotNull(CommentPost::find($response['data']['id'])->mentionsPosts->find(4)); + } + /** * @test */ diff --git a/extensions/mentions/tests/integration/api/UserMentionsTest.php b/extensions/mentions/tests/integration/api/UserMentionsTest.php index c0443c0c9..c04a2c5e7 100644 --- a/extensions/mentions/tests/integration/api/UserMentionsTest.php +++ b/extensions/mentions/tests/integration/api/UserMentionsTest.php @@ -159,7 +159,7 @@ class UserMentionsTest extends TestCase /** * @test */ - public function mentioning_a_valid_user_with_new_format_with_smart_quotes_works() + public function mentioning_a_valid_user_with_new_format_with_smart_quotes_works_and_falls_back_to_normal_quotes() { $response = $this->send( $this->request('POST', '/api/posts', [