Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Feb 21, 2025
1 parent b75ed3f commit b25da21
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3656,9 +3656,13 @@ public function site_status_tests( $tests ) {
'test' => array( $this, 'friend_roles_test' ),
);
$tests['direct']['friends-cron'] = array(
'label' => __( 'Friend cron job is enabled', 'friends' ),
'label' => __( 'Friends cron job is enabled', 'friends' ),
'test' => array( $this, 'friends_cron_test' ),
);
$tests['direct']['friends-delete-cron'] = array(
'label' => __( 'Friends delete old posts cron job is enabled', 'friends' ),
'test' => array( $this, 'friends_cron_delete_test' ),
);
return $tests;
}

Expand Down Expand Up @@ -3727,7 +3731,7 @@ public function friend_roles_test() {

public function friends_cron_test() {
$result = array(
'label' => __( 'The friend cron job is enabled', 'friends' ),
'label' => __( 'The refresh cron job is enabled', 'friends' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Friends', 'friends' ),
Expand All @@ -3739,9 +3743,8 @@ public function friends_cron_test() {
'</p>',
'test' => 'friends-cron',
);

if ( ! wp_next_scheduled( 'cron_friends_refresh_feeds' ) ) {
$result['label'] = __( 'The friends cron job is not enabled', 'friends' );
$result['label'] = __( 'The refresh cron job is not enabled', 'friends' );
$result['badge']['color'] = 'red';
$result['status'] = 'critical';
$result['description'] .= '<p>';
Expand All @@ -3755,10 +3758,28 @@ public function friends_cron_test() {
$result['description'] .= '</p>';
}

return $result;
}

public function friends_cron_delete_test() {
$result = array(
'label' => __( 'The cron job to delete old posts is enabled', 'friends' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Friends', 'friends' ),
'color' => 'green',
),
'description' =>
'<p>' .
__( 'The Friends Plugin uses a cron job to delete old posts your friends.', 'friends' ) .
'</p>',
'test' => 'friends-delete-cron',
);

if ( ! wp_next_scheduled( 'cron_friends_delete_old_posts' ) ) {
$result['label'] = __( 'The friends delete old posts cron job is not enabled', 'friends' );
$result['badge']['color'] = 'yellow';
$result['status'] = 'warning';
$result['label'] = __( 'The cron job to delete old posts is not enabled', 'friends' );
$result['badge']['color'] = 'orange';
$result['status'] = 'recommended';
$result['description'] .= '<p>';
$result['description'] .= wp_kses_post(
sprintf(
Expand Down

0 comments on commit b25da21

Please sign in to comment.