@@ -3,17 +3,23 @@ class RenderingTest extends WP_UnitTestCase {
33 public function setUp () {
44 parent ::setUp ();
55 update_option ( 'semantic_linkbacks_facepiles_fold_limit ' , 2 );
6- add_filter ( 'comment_flood_filter ' , function () { return false ; } );
6+ add_filter (
7+ 'comment_flood_filter ' , function () {
8+ return false ;
9+ }
10+ );
711 }
812
913 public function make_comments ( $ num , $ semantic_linkbacks_type = 'like ' ) {
1014 $ comments = array ();
1115 for ( $ i = 0 ; $ i < $ num ; $ i ++ ) {
12- $ id = wp_new_comment ( array (
13- 'comment_author_url ' => 'http://example.com/person ' . $ i ,
14- 'comment_author ' => 'Person ' . $ i ,
15- 'comment_type ' => 'webmention ' ,
16- ) );
16+ $ id = wp_new_comment (
17+ array (
18+ 'comment_author_url ' => 'http://example.com/person ' . $ i ,
19+ 'comment_author ' => 'Person ' . $ i ,
20+ 'comment_type ' => 'webmention ' ,
21+ )
22+ );
1723 add_comment_meta ( $ id , 'semantic_linkbacks_type ' , $ semantic_linkbacks_type );
1824 add_comment_meta ( $ id , 'semantic_linkbacks_avatar ' , 'http://example.com/photo ' );
1925 $ comments [] = get_comment ( $ id );
@@ -23,23 +29,29 @@ public function make_comments( $num, $semantic_linkbacks_type = 'like' ) {
2329
2430 public function test_facepile_markup () {
2531 $ comments = $ this ->make_comments ( 1 );
26- $ this ->assertStringMatchesFormat ( '<ul class="mention-list"><li class="single-mention h-cite" id="comment-2">
32+ $ this ->assertStringMatchesFormat (
33+ '<ul class="mention-list"><li class="single-mention h-cite" id="comment-2">
2734 <span class="p-author h-card">
2835 <a class="u-url" title="Person 0 liked this Article on example.com." href="http://example.com/person0"><img alt= \'\' src= \'http://example.com/photo \' srcset= \'http://example.com/photo 2x \' class= \'avatar avatar-64 photo avatar-default u-photo avatar-semantic-linkbacks \' height= \'64 \' width= \'64 \' /> </a>
2936 <span class="hide-name p-name">Person 0</span>
3037 </span>
3138 <a class="u-url" href=""></a>
32- </li></ul> ' , list_linkbacks ( array ( 'echo ' => false ), $ comments ) );
39+ </li></ul> ' , list_linkbacks ( array ( 'echo ' => false ), $ comments )
40+ );
3341 }
3442
3543 public function test_facepile_converts_default_gravatar_to_mystery_man () {
3644 update_option ( 'avatar_default ' , 'blank ' );
3745
38- $ comment = get_comment ( wp_new_comment ( array (
39- 'comment_author_url ' => 'http://example.com/person ' ,
40- 'comment_author ' => 'Person ' ,
41- 'comment_type ' => 'webmention ' ,
42- ) ) );
46+ $ comment = get_comment (
47+ wp_new_comment (
48+ array (
49+ 'comment_author_url ' => 'http://example.com/person ' ,
50+ 'comment_author ' => 'Person ' ,
51+ 'comment_type ' => 'webmention ' ,
52+ )
53+ )
54+ );
4355 $ this ->assertContains ( 'gravatar.com/avatar/?s=96&d=blank ' , get_avatar_url ( $ comment , array ( 'size ' => 96 ) ) );
4456
4557 update_option ( 'semantic_linkbacks_facepile_like ' , 1 );
@@ -52,7 +64,7 @@ public function test_facepile_converts_default_gravatar_to_mystery_man() {
5264
5365 public function test_facepile_fold () {
5466 $ comments = $ this ->make_comments ( 3 );
55- $ html = list_linkbacks ( array ( 'echo ' => false ), $ comments );
67+ $ html = list_linkbacks ( array ( 'echo ' => false ), $ comments );
5668 $ person_0 = strpos ( $ html , '<a class="u-url" title="Person 0 liked this Article on example.com." ' );
5769 $ person_1 = strpos ( $ html , '<a class="u-url" title="Person 1 liked this Article on example.com." ' );
5870 $ person_2 = strpos ( $ html , 'additional-facepile ' );
@@ -74,12 +86,14 @@ public function test_facepile_no_fold() {
7486 }
7587
7688 public function test_reactions () {
77- $ id = wp_new_comment ( array (
78- 'comment_author_url ' => 'http://example.com/person ' ,
79- 'comment_author ' => 'Person ' ,
80- 'comment_type ' => '' ,
81- 'comment_content ' => '😢 ' , // 'crying face' emoji
82- ) );
89+ $ id = wp_new_comment (
90+ array (
91+ 'comment_author_url ' => 'http://example.com/person ' ,
92+ 'comment_author ' => 'Person ' ,
93+ 'comment_type ' => '' ,
94+ 'comment_content ' => '😢 ' , // 'crying face' emoji
95+ )
96+ );
8397 add_comment_meta ( $ id , 'semantic_linkbacks_avatar ' , 'http://example.com/photo ' );
8498 Semantic_Linkbacks_Walker_Comment::$ reactions = array ( get_comment ( $ id ) );
8599
@@ -88,13 +102,15 @@ public function test_reactions() {
88102 $ html = ob_get_contents ();
89103 ob_end_clean ();
90104
91- $ this ->assertStringMatchesFormat ( '<div class="reactions">
105+ $ this ->assertStringMatchesFormat (
106+ '<div class="reactions">
92107 <ul class="mention-list"><li class="single-mention p-reply emoji-reaction h-cite" id="comment-%d">
93108 <span class="p-author h-card">
94109 <a class="u-url" title="Person 😢 on example.com." href="http://example.com/person"><img alt= \'\' src= \'http://example.com/photo \' srcset= \'http://example.com/photo 2x \' class= \'avatar avatar-64 photo avatar-default u-photo avatar-semantic-linkbacks \' height= \'64 \' width= \'64 \' /> <span class="emoji-overlay">😢</span></a>
95110 <span class="hide-name p-name">Person</span>
96111 </span>
97112 <a class="u-url" href=""></a>
98- </li></ul></div> ' , trim ( $ html ) );
113+ </li></ul></div> ' , trim ( $ html )
114+ );
99115 }
100116}
0 commit comments