Skip to content

Commit d0692e4

Browse files
committed
Fix tests
1 parent e26ef0e commit d0692e4

File tree

2 files changed

+50
-20
lines changed

2 files changed

+50
-20
lines changed

includes/class-admin.php

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public static function meta_boxes( $object, $box ) {
6363
/**
6464
* Add comment-type as column in WP-Admin
6565
*
66-
* @param array $column the column to implement
67-
* @param int $comment_id the comment id
66+
* @param array $column The column to implement.
67+
* @param int $comment_id The comment id.
6868
*/
6969
public static function manage_comments_custom_column( $column, $comment_id ) {
7070
if ( 'comment_type' !== $column ) {
@@ -74,16 +74,25 @@ public static function manage_comments_custom_column( $column, $comment_id ) {
7474
}
7575

7676
/**
77-
* Add bulk option to bulk comment handler
77+
* Add bulk option to bulk comment handler.
78+
*
79+
* @param array $bulk_actions The bulk actions.
80+
*
81+
* @return array The bulk actions.
7882
*/
7983
public static function bulk_comment_actions( $bulk_actions ) {
8084
$bulk_actions['refresh_webmention'] = __( 'Refresh Webmention', 'webmention' );
8185
return $bulk_actions;
8286
}
8387

8488
/**
85-
* Add bulk action handler to comments
89+
* Add bulk action handler to comments.
90+
*
91+
* @param string $redirect_to The redirect URL.
92+
* @param string $doaction The action to perform.
93+
* @param array $comment_ids The comment IDs.
8694
*
95+
* @return string The redirect URL.
8796
*/
8897
public static function bulk_comment_action_handler( $redirect_to, $doaction, $comment_ids ) {
8998
if ( 'refresh_webmention' !== $doaction ) {
@@ -98,12 +107,12 @@ public static function bulk_comment_action_handler( $redirect_to, $doaction, $co
98107
}
99108

100109
/**
101-
* Add an action link
110+
* Add an action link.
102111
*
103-
* @param array $links the settings links
104-
* @param string $file the plugin filename
112+
* @param array $links The settings links.
113+
* @param string $file The plugin filename.
105114
*
106-
* @return array the filtered array
115+
* @return array The filtered array.
107116
*/
108117
public static function plugin_action_links( $links, $file ) {
109118
if ( stripos( $file, 'webmention' ) === false || ! function_exists( 'admin_url' ) ) {
@@ -120,12 +129,12 @@ public static function plugin_action_links( $links, $file ) {
120129
}
121130

122131
/**
123-
* Add a plugin meta link
132+
* Add a plugin meta link.
124133
*
125-
* @param array $links the settings links
126-
* @param string $file the plugin filename
134+
* @param array $links The settings links.
135+
* @param string $file The plugin filename.
127136
*
128-
* @return array the filtered array
137+
* @return array The filtered array.
129138
*/
130139
public static function plugin_row_meta( $links, $file ) {
131140
if ( stripos( $file, 'webmention' ) === false || ! function_exists( 'admin_url' ) ) {
@@ -175,16 +184,26 @@ public static function comment_types_dropdown( $types ) {
175184
}
176185

177186
/**
178-
* Add comment-type as column in WP-Admin
187+
* Add comment-type as column in WP-Admin.
188+
*
189+
* @param array $columns The list of column names.
179190
*
180-
* @param array $columns the list of column names
191+
* @return array The filtered columns.
181192
*/
182193
public static function comment_columns( $columns ) {
183194
$columns['comment_type'] = esc_html__( 'Comment-Type', 'webmention' );
184195

185196
return $columns;
186197
}
187198

199+
/**
200+
* Add comment-type as column in WP-Admin.
201+
*
202+
* @param array $actions The actions.
203+
* @param object $comment The comment object.
204+
*
205+
* @return array The filtered actions.
206+
*/
188207
public static function comment_row_actions( $actions, $comment ) {
189208
$query = array(
190209
'_wpnonce' => wp_create_nonce( "approve-comment_$comment->comment_ID" ),
@@ -213,6 +232,11 @@ public static function comment_row_actions( $actions, $comment ) {
213232
return $actions;
214233
}
215234

235+
/**
236+
* Add a webmention approve domain.
237+
*
238+
* @param string $host The host.
239+
*/
216240
public static function add_webmention_approve_domain( $host ) {
217241
$approvelist = get_webmention_approve_domains();
218242
$approvelist[] = $host;
@@ -221,6 +245,11 @@ public static function add_webmention_approve_domain( $host ) {
221245
update_option( 'webmention_approve_domains', $approvelist );
222246
}
223247

248+
/**
249+
* Transition to approve list.
250+
*
251+
* @param object $comment The comment object.
252+
*/
224253
public static function transition_to_approvelist( $comment ) {
225254
if ( ! current_user_can( 'moderate_comments' ) ) {
226255
return;
@@ -267,9 +296,7 @@ public static function admin_menu() {
267296
* Load settings page
268297
*/
269298
public static function settings_page() {
270-
require_once __DIR__ . '/class-upgrade.php';
271-
\Webmention\Upgrade::maybe_upgrade();
272-
\Webmention\remove_semantic_linkbacks();
299+
Upgrade::maybe_upgrade();
273300

274301
add_thickbox();
275302
wp_enqueue_script( 'plugin-install' );
@@ -326,6 +353,9 @@ public static function add_help_tab() {
326353
);
327354
}
328355

356+
/**
357+
* Register settings.
358+
*/
329359
public static function register_settings() {
330360
register_setting(
331361
'webmention',
@@ -450,7 +480,7 @@ public static function register_settings() {
450480
}
451481

452482
/**
453-
* Add recommended privacy content
483+
* Add recommended privacy content.
454484
*/
455485
public static function add_privacy_policy_content() {
456486
$content =

tests/test-db.php renamed to tests/test-upgrade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
2-
class DB_Test extends WP_UnitTestCase {
2+
class Upgrade_Test extends WP_UnitTestCase {
33
public function test_update_database() {
4-
require_once( dirname( __FILE__ ) . '/../includes/class-db.php' );
4+
require_once( dirname( __FILE__ ) . '/../includes/class-upgrade.php' );
55

66
$comment_id = wp_insert_comment(
77
array(

0 commit comments

Comments
 (0)