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

AxeWP / wp-graphql-rank-math / 15507492505

07 Jun 2025 11:44AM UTC coverage: 86.429% (-2.0%) from 88.44%
15507492505

push

github

web-flow
dev: add support for lazy-loading `description`/`deprecationReason` config values (#121)

* chore: update strauss and deps

* dev: use callable descriptions/deprecations

* fix: dont prefix `NodeWithRankMathSeo`

* chore: fix backcompat on connections

* chore: update dep

* chore: update deps

* tests: ensure schema can build

* chore: update and cleanup

* fix: regenerate autoloader

357 of 367 new or added lines in 66 files covered. (97.28%)

60 existing lines in 60 files now uncovered.

2541 of 2940 relevant lines covered (86.43%)

11.49 hits per line

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

83.61
/src/Type/WPInterface/Seo.php
1
<?php
2
/**
3
 * The shared SEO fields interface.
4
 *
5
 * @package WPGraphQL\RankMath\Type\WPInterface
6
 * @since 0.0.8
7
 */
8

9
declare( strict_types = 1 );
10

11
namespace WPGraphQL\RankMath\Type\WPInterface;
12

13
use RankMath\Helper;
14
use WPGraphQL\RankMath\Model\ContentNodeSeo;
15
use WPGraphQL\RankMath\Model\ContentTypeSeo;
16
use WPGraphQL\RankMath\Model\TermNodeSeo;
17
use WPGraphQL\RankMath\Model\UserSeo;
18
use WPGraphQL\RankMath\Type\WPObject\Breadcrumbs;
19
use WPGraphQL\RankMath\Type\WPObject\JsonLd;
20
use WPGraphQL\RankMath\Type\WPObject\OpenGraphMeta;
21
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Abstracts\InterfaceType;
22
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Traits\TypeResolverTrait;
23

24
/**
25
 * Class - Seo
26
 */
27
class Seo extends InterfaceType {
28
        use TypeResolverTrait;
29

30
        /**
31
         * {@inheritDoc}
32
         */
33
        protected static function type_name(): string {
34
                return 'Seo';
20✔
35
        }
36

37
        /**
38
         * {@inheritDoc}
39
         */
40
        public static function get_description(): string {
UNCOV
41
                return __( 'Base SEO fields shared across WP types.', 'wp-graphql-rank-math' );
×
42
        }
43

44
        /**
45
         * {@inheritDoc}
46
         */
47
        public static function get_fields(): array {
48
                $fields = [
20✔
49
                        'title'           => [
20✔
50
                                'type'        => 'String',
20✔
51
                                'description' => static fn () => __( 'The title.', 'wp-graphql-rank-math' ),
20✔
52
                        ],
20✔
53
                        'description'     => [
20✔
54
                                'type'        => 'String',
20✔
55
                                'description' => static fn () => __( 'The meta description.', 'wp-graphql-rank-math' ),
20✔
56
                        ],
20✔
57
                        'robots'          => [
20✔
58
                                'type'        => [ 'list_of' => 'String' ],
20✔
59
                                'description' => static fn () => __( 'A list of the robots meta properties to output.', 'wp-graphql-rank-math' ),
20✔
60
                        ],
20✔
61
                        'focusKeywords'   => [
20✔
62
                                'type'        => [ 'list_of' => 'String' ],
20✔
63
                                'description' => static fn () => __( 'The focus keywords you want to rank for', 'wp-graphql-rank-math' ),
20✔
64
                        ],
20✔
65
                        'canonicalUrl'    => [
20✔
66
                                'type'        => 'String',
20✔
67
                                'description' => static fn () => __( 'The canonical url.', 'wp-graphql-rank-math' ),
20✔
68
                        ],
20✔
69
                        'breadcrumbTitle' => [
20✔
70
                                'type'        => 'String',
20✔
71
                                'description' => static fn () => __( 'The title to use in the breadcrumbs for this post', 'wp-graphql-rank-math' ),
20✔
72
                        ],
20✔
73
                        'fullHead'        => [
20✔
74
                                'type'        => 'String',
20✔
75
                                'description' => static fn () => __( 'The fully-rendered `head` tag for the given item', 'wp-graphql-rank-math' ),
20✔
76
                        ],
20✔
77
                        'jsonLd'          => [
20✔
78
                                'type'        => JsonLd::get_type_name(),
20✔
79
                                'description' => static fn () => __( 'The JSON+LD data', 'wp-graphql-rank-math' ),
20✔
80
                        ],
20✔
81
                        'openGraph'       => [
20✔
82
                                'type'        => OpenGraphMeta::get_type_name(),
20✔
83
                                'description' => static fn () => __( 'The open graph meta properties.', 'wp-graphql-rank-math' ),
20✔
84
                        ],
20✔
85

86
                ];
20✔
87

88
                // Add breadcrumbs field.
89
                if ( Helper::is_breadcrumbs_enabled() ) {
20✔
90
                        $fields['breadcrumbs'] = [
7✔
91
                                'type'        => [ 'list_of' => Breadcrumbs::get_type_name() ],
7✔
92
                                'description' => static fn () => __( 'The breadcrumbs trail for the given object', 'wp-graphql-rank-math' ),
7✔
93
                        ];
7✔
94
                }
95

96
                return $fields;
20✔
97
        }
98

99
        /**
100
         * {@inheritDoc}
101
         *
102
         * @param \WPGraphQL\Model\Model $value The value from the resolver of the parent field.
103
         */
104
        public static function get_resolved_type_name( $value ): ?string {
105
                switch ( true ) {
106
                        case $value instanceof ContentNodeSeo:
1✔
107
                                $type_name = 'RankMath' . graphql_format_type_name( $value->get_object_type() . 'ObjectSeo' );
×
108
                                break;
×
109
                        case $value instanceof ContentTypeSeo:
1✔
110
                                $type_name = 'RankMath' . graphql_format_type_name( $value->get_object_type() . 'TypeSeo' );
1✔
111
                                break;
1✔
112
                        case $value instanceof TermNodeSeo:
×
113
                                $type_name = 'RankMath' . graphql_format_type_name( $value->get_object_type() . 'TermSeo' );
×
114
                                break;
×
115
                        case $value instanceof UserSeo:
×
116
                                $type_name = graphql_format_type_name( 'RankMathUserSeo' );
×
117
                                break;
×
118
                        default:
119
                                $type_name = null;
×
120
                }
121

122
                /**
123
                 * Filters the GraphQL Object type name for the given SEO model.
124
                 *
125
                 * @param string|null $type_name The GraphQL type name for the SEO Object.
126
                 * @param \WPGraphQL\Model\Model $model The SEO model for the type.
127
                 */
128
                $type_name = apply_filters( 'graphql_seo_resolved_type_name', $type_name, $value );
1✔
129

130
                return $type_name;
1✔
131
        }
132
}
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