File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
extensions/mentions/tests/integration/api Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 11
11
12
12
use Carbon \Carbon ;
13
13
use Flarum \Extend ;
14
+ use Flarum \Formatter \Formatter ;
15
+ use Flarum \Post \Post ;
14
16
use Flarum \Post \CommentPost ;
15
17
use Flarum \Testing \integration \RetrievesAuthorizedUsers ;
16
18
use Flarum \Testing \integration \TestCase ;
@@ -538,6 +540,41 @@ public function editing_a_post_with_a_mention_of_a_post_with_deleted_author_work
538
540
$ this ->assertStringContainsString ('PostMention ' , $ response ['data ' ]['attributes ' ]['contentHtml ' ]);
539
541
$ this ->assertNotNull (CommentPost::find ($ response ['data ' ]['id ' ])->mentionsPosts ->find (11 ));
540
542
}
543
+
544
+ /**
545
+ * @test
546
+ */
547
+ public function rendering_post_mention_with_a_post_context_works ()
548
+ {
549
+ /** @var Formatter $formatter */
550
+ $ formatter = $ this ->app ()->getContainer ()->make (Formatter::class);
551
+
552
+ $ post = Post::find (4 );
553
+ $ user = User::find (1 );
554
+
555
+ $ xml = $ formatter ->parse ($ post ->content , $ post , $ user );
556
+ $ renderedHtml = $ formatter ->render ($ xml , $ post );
557
+
558
+ $ this ->assertStringContainsString ('TOBY$ ' , $ renderedHtml );
559
+ }
560
+
561
+ /**
562
+ * @test
563
+ */
564
+ public function rendering_post_mention_without_a_context_works ()
565
+ {
566
+ /** @var Formatter $formatter */
567
+ $ formatter = $ this ->app ()->getContainer ()->make (Formatter::class);
568
+
569
+ $ post = Post::find (4 );
570
+ $ user = User::find (1 );
571
+
572
+ $ xml = $ formatter ->parse ($ post ->content , null , $ user );
573
+ $ renderedHtml = $ formatter ->render ($ xml );
574
+
575
+ $ this ->assertStringContainsString ('TOBY$ ' , $ renderedHtml );
576
+ }
577
+
541
578
}
542
579
543
580
class CustomOtherDisplayNameDriver implements DriverInterface
You can’t perform that action at this time.
0 commit comments