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

Yoast / wordpress-seo / 8218b111533b92ec47f94130a94bcd0102263a45

01 Dec 2025 09:48AM UTC coverage: 53.092%. First build
8218b111533b92ec47f94130a94bcd0102263a45

push

github

web-flow
Merge pull request #22759 from Yoast/feature/task-list

Feature/task list

8697 of 16050 branches covered (54.19%)

Branch coverage included in aggregate %.

98 of 605 new or added lines in 51 files covered. (16.2%)

32413 of 61381 relevant lines covered (52.81%)

46976.02 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
         */
NEW
42
        public function get_is_completed(): bool {
×
NEW
43
                $post = \get_post( 1 );
×
NEW
44
                if ( $post instanceof WP_Post === false || $post->post_status !== 'publish' ) {
×
NEW
45
                        return true;
×
46
                }
47

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

51
        /**
52
         * Returns the task's link.
53
         *
54
         * @return string|null
55
         */
NEW
56
        public function get_link(): ?string {
×
NEW
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
         */
NEW
67
        public function complete_task(): void {
×
NEW
68
                $post = \get_post( 1 );
×
69

NEW
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
         */
NEW
84
        public function get_call_to_action(): Call_To_Action_Entry {
×
NEW
85
                return new Call_To_Action_Entry(
×
NEW
86
                        \__( 'Delete for me', 'wordpress-seo' ),
×
NEW
87
                        'delete',
×
NEW
88
                        $this->get_link()
×
NEW
89
                );
×
90
        }
91

92
        /**
93
         * Returns the task's copy set.
94
         *
95
         * @return string|null
96
         */
NEW
97
        public function get_copy_set(): Copy_Set {
×
NEW
98
                return new Copy_Set(
×
NEW
99
                        \__( 'Remove the “Hello World” post', 'wordpress-seo' ),
×
NEW
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' ),
×
NEW
101
                        null
×
NEW
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

© 2025 Coveralls, Inc