• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / f25d8d99516e47a441deba0dccbae3df95436b6e

24 Nov 2025 12:51PM UTC coverage: 52.655% (-0.5%) from 53.157%
f25d8d99516e47a441deba0dccbae3df95436b6e

push

github

web-flow
Merge pull request #22742 from Yoast/865-backend-error-handling

Adds error handling in backend endpoints

8307 of 15571 branches covered (53.35%)

Branch coverage included in aggregate %.

0 of 17 new or added lines in 6 files covered. (0.0%)

1 existing line in 1 file now uncovered.

31812 of 60621 relevant lines covered (52.48%)

47564.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/task-list/application/tasks/delete-hello-world.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Task_List\Application\Tasks;
4

5
use WP_Post;
6
use Yoast\WP\SEO\Task_List\Domain\Components\Call_To_Action_Entry;
7
use Yoast\WP\SEO\Task_List\Domain\Components\Copy_Set;
8
use Yoast\WP\SEO\Task_List\Domain\Exceptions\Complete_Hello_World_Task_Exception;
9
use Yoast\WP\SEO\Task_List\Domain\Tasks\Abstract_Completeable_Task;
10

11
/**
12
 * Represents the task for deleting the Hello World post.
13
 */
14
class Delete_Hello_World extends Abstract_Completeable_Task {
15

16
        /**
17
         * Holds the id.
18
         *
19
         * @var string
20
         */
21
        protected $id = 'delete-hello-world';
22

23
        /**
24
         * Holds the priority.
25
         *
26
         * @var string
27
         */
28
        protected $priority = 'medium';
29

30
        /**
31
         * Holds the duration.
32
         *
33
         * @var int
34
         */
35
        protected $duration = 1;
36

37
        /**
38
         * Returns whether this task is completed.
39
         *
40
         * @return bool Whether this task is completed.
41
         */
42
        public function get_is_completed(): bool {
×
43
                $post = \get_post( 1 );
×
44
                if ( $post instanceof WP_Post === false || $post->post_status !== 'publish' ) {
×
45
                        return true;
×
46
                }
47

48
                return $post->post_date !== $post->post_modified;
×
49
        }
50

51
        /**
52
         * Returns the task's link.
53
         *
54
         * @return string|null
55
         */
56
        public function get_link(): ?string {
×
57
                return null;
×
58
        }
59

60
        /**
61
         * Completes a task.
62
         *
63
         * @return void
64
         *
65
         * @throws Complete_Hello_World_Task_Exception If the Hello World post could not be deleted.
66
         */
67
        public function complete_task(): void {
×
UNCOV
68
                $post = \get_post( 1 );
×
69

70
                if ( $post instanceof WP_Post ) {
×
NEW
71
                        $result = \wp_delete_post( $post->ID, true );
×
72

NEW
73
                        if ( ! $result ) {
×
NEW
74
                                throw new Complete_Hello_World_Task_Exception();
×
75
                        }
76
                }
77
        }
78

79
        /**
80
         * Returns the task's call to action entry.
81
         *
82
         * @return string|null
83
         */
84
        public function get_call_to_action(): Call_To_Action_Entry {
×
85
                return new Call_To_Action_Entry(
×
86
                        \__( 'Delete for me', 'wordpress-seo' ),
×
87
                        'delete',
×
88
                        $this->get_link()
×
89
                );
×
90
        }
91

92
        /**
93
         * Returns the task's copy set.
94
         *
95
         * @return string|null
96
         */
97
        public function get_copy_set(): Copy_Set {
×
98
                return new Copy_Set(
×
99
                        \__( 'Remove the “Hello World” post', 'wordpress-seo' ),
×
100
                        \__( 'Leaving placeholder content makes your site look unfinished and untrustworthy. Removing it keeps your site clean and professional for visitors and search engines.', 'wordpress-seo' ),
×
101
                        null
×
102
                );
×
103
        }
104
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc