Skip to content

Commit 6ac0135

Browse files
authored
Merge pull request #457 from wp-graphql/bugfix/product-reviews-connections
Bugfix/product reviews connections
2 parents c1a0d2e + c264114 commit 6ac0135

File tree

7 files changed

+36
-19
lines changed

7 files changed

+36
-19
lines changed

.github/workflows/continous-integration.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
matrix:
2525
php: ['7.4', '7.3', '7.2', '7.1']
2626
wordpress: ['5.6', '5.0']
27-
debug: ['--ext DotReporter']
2827
include:
2928
- php: '7.4'
3029
wordpress: '5.6'

composer.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@
3131
"firebase/php-jwt": "^5.0"
3232
},
3333
"require-dev": {
34-
"composer/installers": "^1.9",
35-
"lucatume/wp-browser": "^2.6.",
36-
"wp-graphql/wp-graphql-testcase": "^1.0.1",
3734
"codeception/module-asserts": "^1.0",
38-
"codeception/util-universalframework": "^1.0",
3935
"codeception/module-rest": "^1.2",
36+
"codeception/util-universalframework": "^1.0",
37+
"composer/installers": "^1.9",
38+
"johnpbloch/wordpress": "^5.7",
39+
"lucatume/wp-browser": "^2.6.",
40+
"phpunit/phpunit": "<=9.4.4",
4041
"simpod/php-coveralls-mirror": "^3.0",
42+
"squizlabs/php_codesniffer": "^3.5",
4143
"stripe/stripe-php": "^7.75",
4244
"wp-coding-standards/wpcs": "^2.3",
43-
"johnpbloch/wordpress": "~5.3",
4445
"wp-graphql/wp-graphql-jwt-authentication": "^0.4.1",
45-
"wpackagist-plugin/wp-graphql": "^1.1.8",
46-
"wpackagist-plugin/woocommerce": "^5.0",
46+
"wp-graphql/wp-graphql-testcase": "^1.0.1",
47+
"wpackagist-plugin/woocommerce": "^5.1.0",
4748
"wpackagist-plugin/woocommerce-gateway-stripe": "^4.5",
48-
"wpackagist-theme/twentytwentyone": "^1.0",
49-
"phpunit/phpunit": "<=9.4.4",
50-
"squizlabs/php_codesniffer": "^3.5"
49+
"wpackagist-plugin/wp-graphql": "^1.2.6",
50+
"wpackagist-theme/twentytwentyone": "^1.0"
5151
},
5252
"config": {
5353
"optimize-autoloader": true,

includes/connection/class-comments.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ public static function register_connections() {
5454
},
5555
),
5656
),
57+
'resolve' => function( $source, array $args, AppContext $context, ResolveInfo $info ) {
58+
$resolver = new \WPGraphQL\Data\Connection\CommentConnectionResolver( $source, $args, $context, $info );
59+
60+
$resolver->set_query_arg( 'post_type', 'product' );
61+
$resolver->set_query_arg( 'post_id', $source->ID );
62+
63+
return $resolver->get_connection();
64+
},
5765
)
5866
)
5967
);

includes/data/loader/class-wc-db-loader.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ public function loadKeys( array $keys ) {
6767
$loader = array( $this, 'load_tax_rate_from_id' );
6868
break;
6969
default:
70-
$loader = apply_filters( 'woographql_db_loader_func', null );
70+
/**
71+
* For adding custom key types to this loader
72+
*
73+
* @param callable|null $loader Callback that gets entry from key.
74+
* @param string $loader_type Used to determine loader being used for this instance of the loader.
75+
*/
76+
$loader = apply_filters( 'woographql_db_loader_func', null, $this->loader_type );
77+
7178
if ( empty( $loader ) ) {
7279
throw new \Exception(
7380
/* translators: %s: Loader Type */

tests/wpunit/CartQueriesTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public function testCartItemPagination() {
365365
*
366366
* Tests "first" parameter.
367367
*/
368-
$variables = array( 'first' => 2 );
368+
$variables = array( 'first' => 2, 'after' => '' );
369369
$response = $this->graphql( compact( 'query', 'variables' ) );
370370

371371
$expected = array_merge(
@@ -419,8 +419,11 @@ public function testCartItemPagination() {
419419

420420
$this->assertQuerySuccessful(
421421
$response,
422-
// Only check the edges.
423-
array_map( $expected_edge_mapper, array_slice( $cart_items, 0, 4 ), range( 0, 3 ) )
422+
array_map( // Only check the edges.
423+
$expected_edge_mapper,
424+
array_slice( $cart_items, 0, 4 ),
425+
range( 3, 0, -1 ) // Reverse
426+
)
424427
);
425428
}
426429
}

vendor/composer/InstalledVersions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class InstalledVersions
2929
'aliases' =>
3030
array (
3131
),
32-
'reference' => 'dc14001926d81c1bdc5e4047723ce57e84cc5520',
32+
'reference' => 'cb0e6f83f07b623f260809556e194b132a9fefd8',
3333
'name' => 'wp-graphql/wp-graphql-woocommerce',
3434
),
3535
'versions' =>
@@ -50,7 +50,7 @@ class InstalledVersions
5050
'aliases' =>
5151
array (
5252
),
53-
'reference' => 'dc14001926d81c1bdc5e4047723ce57e84cc5520',
53+
'reference' => 'cb0e6f83f07b623f260809556e194b132a9fefd8',
5454
),
5555
),
5656
);

vendor/composer/installed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'aliases' =>
77
array (
88
),
9-
'reference' => 'dc14001926d81c1bdc5e4047723ce57e84cc5520',
9+
'reference' => 'cb0e6f83f07b623f260809556e194b132a9fefd8',
1010
'name' => 'wp-graphql/wp-graphql-woocommerce',
1111
),
1212
'versions' =>
@@ -27,7 +27,7 @@
2727
'aliases' =>
2828
array (
2929
),
30-
'reference' => 'dc14001926d81c1bdc5e4047723ce57e84cc5520',
30+
'reference' => 'cb0e6f83f07b623f260809556e194b132a9fefd8',
3131
),
3232
),
3333
);

0 commit comments

Comments
 (0)