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

Yoast / wordpress-seo / 5272b836dbc490e59498d667bfcf48eca0c036f2

21 Nov 2025 01:42PM UTC coverage: 52.666% (-0.003%) from 52.669%
5272b836dbc490e59498d667bfcf48eca0c036f2

Pull #22742

github

web-flow
Merge 09b5db01e into bd8c0cc11
Pull Request #22742: Throw exception when failing to enable the llms.txt option

8307 of 15569 branches covered (53.36%)

Branch coverage included in aggregate %.

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

36 existing lines in 4 files now uncovered.

31811 of 60605 relevant lines covered (52.49%)

47577.04 hits per line

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

0.0
/src/task-list/application/tasks/enable-llms-txt.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 Yoast\WP\SEO\Helpers\Options_Helper;
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\Tasks\Abstract_Completeable_Task;
9

10
/**
11
 * Represents the task for the enabling the llms.txt file.
12
 */
13
class Enable_Llms_Txt extends Abstract_Completeable_Task {
14

15
        /**
16
         * Holds the id.
17
         *
18
         * @var string
19
         */
20
        protected $id = 'enable-llms-txt';
21

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

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

36
        /**
37
         * Holds the options helper.
38
         *
39
         * @var Options_Helper
40
         */
41
        private $options_helper;
42

43
        /**
44
         * Constructs the task.
45
         *
46
         * @param Options_Helper $options_helper The options helper.
47
         */
UNCOV
48
        public function __construct( Options_Helper $options_helper ) {
×
49
                $this->options_helper = $options_helper;
×
50
        }
51

52
        /**
53
         * Returns whether this task is completed.
54
         *
55
         * @return bool Whether this task is completed.
56
         */
UNCOV
57
        public function get_is_completed(): bool {
×
58
                return $this->options_helper->get( 'enable_llms_txt', false );
×
59
        }
60

61
        /**
62
         * Returns the task's link.
63
         *
64
         * @return string|null
65
         */
UNCOV
66
        public function get_link(): ?string {
×
67
                return null;
×
68
        }
69

70
        /**
71
         * Completes a task.
72
         *
73
         * @return void
74
         *
75
         * @throws \RuntimeException If the option could not be set.
76
         */
77
        public function complete_task(): void {
×
NEW
78
                $result = $this->options_helper->set( 'enable_llms_txt', true );
×
79

NEW
80
                if ( ! $result ) {
×
NEW
81
                        throw new \RuntimeException( __( 'Failed to enable llms.txt option.', 'wordpress-seo' ) );
×
82
                }
83
        }
84

85
        /**
86
         * Returns the task's call to action entry.
87
         *
88
         * @return string|null
89
         */
UNCOV
90
        public function get_call_to_action(): Call_To_Action_Entry {
×
91
                return new Call_To_Action_Entry(
×
92
                        \__( 'Enable llms.txt', 'wordpress-seo' ),
×
93
                        'default',
×
94
                        $this->get_link()
×
95
                );
×
96
        }
97

98
        /**
99
         * Returns the task's copy set.
100
         *
101
         * @return string|null
102
         */
UNCOV
103
        public function get_copy_set(): Copy_Set {
×
104
                return new Copy_Set(
×
105
                        \__( 'Create an llms.txt file', 'wordpress-seo' ),
×
106
                        \__( 'Without llms.txt, AI crawlers may not know how to treat your content. Publishing it helps communicate your preferences in a clearer way to AI tools.', 'wordpress-seo' )
×
107
                );
×
108
        }
109
}
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