Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit a48877f

Browse files
committed
PHPCBF changes for tests
1 parent 7e6da5c commit a48877f

File tree

2 files changed

+47
-28
lines changed

2 files changed

+47
-28
lines changed

tests/test-microformats.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public function test_interpreter( $path ) {
77
$comment = Linkbacks_MF2_Handler::generate_commentdata(
88
array(
99
'remote_source_original' => file_get_contents( $path ),
10-
'comment_author_url' => 'http://example.com/webmention/target/placeholder',
11-
'target' => 'http://example.com/webmention/target/placeholder',
12-
'comment_type' => 'webmention',
13-
'comment_author' => basename( $path, '.html' ),
10+
'comment_author_url' => 'http://example.com/webmention/target/placeholder',
11+
'target' => 'http://example.com/webmention/target/placeholder',
12+
'comment_type' => 'webmention',
13+
'comment_author' => basename( $path, '.html' ),
1414
)
1515
);
1616

@@ -19,7 +19,10 @@ public function test_interpreter( $path ) {
1919
}
2020

2121
public function templateProvider() {
22-
return array_map( function( $path ) { return array( $path ); },
23-
glob( dirname( __FILE__ ) . '/templates/*.html' ) );
22+
return array_map(
23+
function( $path ) {
24+
return array( $path ); },
25+
glob( dirname( __FILE__ ) . '/templates/*.html' )
26+
);
2427
}
2528
}

tests/test-rendering.php

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)