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

wp-graphql / wp-graphql-woocommerce / 9122745284

17 May 2024 04:03AM UTC coverage: 85.048% (+0.4%) from 84.647%
9122745284

push

github

web-flow
feat: Queries and mutations for shipping zones, tax classes, and tax rates. (#856)

* fix: General bugfixes and improvements

* devops: New mutations and types tested and compliance with Linter and PHPStan

* chore: hooks added to the mutation resolvers

* feat: permission checks added

* chore: Linter and compliance met

* chore: Linter and compliance met

1252 of 1399 new or added lines in 39 files covered. (89.49%)

9 existing lines in 2 files now uncovered.

12423 of 14607 relevant lines covered (85.05%)

70.56 hits per line

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

96.77
/includes/type/object/class-tax-class-type.php
1
<?php
2
/**
3
 * WPObject Type - Tax_Class_Type
4
 *
5
 * Registers TaxClass WPObject type
6
 *
7
 * @package WPGraphQL\WooCommerce\Type\WPObject
8
 * @since   TBD
9
 */
10

11
namespace WPGraphQL\WooCommerce\Type\WPObject;
12

13
/**
14
 * Class Tax_Class_Type
15
 */
16
class Tax_Class_Type {
17
        /**
18
         * Registers tax class type
19
         *
20
         * @return void
21
         */
22
        public static function register() {
23
                register_graphql_object_type(
138✔
24
                        'TaxClass',
138✔
25
                        [
138✔
26
                                'eagerlyLoadType' => true,
138✔
27
                                'description'     => __( 'A Tax class object', 'wp-graphql-woocommerce' ),
138✔
28
                                'interfaces'      => [ 'Node' ],
138✔
29
                                'fields'          => [
138✔
30
                                        'id'   => [
138✔
31
                                                'type'        => [ 'non_null' => 'ID' ],
138✔
32
                                                'description' => __( 'The globally unique identifier for the tax class.', 'wp-graphql-woocommerce' ),
138✔
33
                                                'resolve'     => static function ( $source, array $args, $context, $info ) {
138✔
NEW
34
                                                        return ! empty( $source['slug'] ) ? \GraphQLRelay\Relay::toGlobalId( 'tax_class', $source['slug'] ) : null;
×
35
                                                },
138✔
36
                                        ],
138✔
37
                                        'slug' => [
138✔
38
                                                'type'        => 'String',
138✔
39
                                                'description' => __( 'The globally unique identifier for the tax class.', 'wp-graphql-woocommerce' ),
138✔
40
                                                'resolve'     => static function ( $source, array $args, $context, $info ) {
138✔
41
                                                        return ! empty( $source['slug'] ) ? $source['slug'] : null;
3✔
42
                                                },
138✔
43
                                        ],
138✔
44
                                        'name' => [
138✔
45
                                                'type'        => 'String',
138✔
46
                                                'description' => __( 'Tax class name.', 'wp-graphql-woocommerce' ),
138✔
47
                                                'resolve'     => static function ( $source, array $args, $context, $info ) {
138✔
48
                                                        return ! empty( $source['name'] ) ? $source['name'] : null;
3✔
49
                                                },
138✔
50
                                        ],
138✔
51
                                ],
138✔
52
                        ]
138✔
53
                );
138✔
54
        }
55
}
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