Skip to content

Commit 888ac96

Browse files
committed
autoloader files rebuilt
1 parent a51cb59 commit 888ac96

15 files changed

+472
-8015
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
"require-dev": {
3535
"composer/installers": "^1.9",
3636
"lucatume/wp-browser": "^2.6.",
37-
"wp-graphql/wp-graphql-testcase": "^1.0",
37+
"wp-graphql/wp-graphql-testcase": "^1.0.1",
3838
"codeception/module-asserts": "^1.0",
3939
"codeception/util-universalframework": "^1.0",
4040
"codeception/module-rest": "^1.2",
4141
"simpod/php-coveralls-mirror": "^3.0",
4242
"stripe/stripe-php": "^7.28",
4343
"wp-coding-standards/wpcs": "^2.3",
4444
"johnpbloch/wordpress": "~5.3",
45-
"wp-graphql/wp-graphql": "^1.1.4",
4645
"wp-graphql/wp-graphql-jwt-authentication": "^0.4.1",
46+
"wpackagist-plugin/wp-graphql": "^1.1.8",
4747
"wpackagist-plugin/woocommerce": "^4.4",
4848
"wpackagist-plugin/woocommerce-gateway-stripe": "^4.5",
4949
"wpackagist-theme/twentytwentyone": "^1.0",

includes/model/class-product.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ protected function init() {
329329
return ! is_null( $this->wc_data->is_sold_individually() ) ? $this->wc_data->is_sold_individually() : null;
330330
},
331331
'weight' => function() {
332-
return ! is_null( $this->wc_data->get_weight() ) ? $this->wc_data->get_weight() : null;
332+
return ! empty( $this->wc_data->get_weight() ) ? $this->wc_data->get_weight() : null;
333333
},
334334
'length' => function() {
335-
return ! is_null( $this->wc_data->get_length() ) ? $this->wc_data->get_length() : null;
335+
return ! empty( $this->wc_data->get_length() ) ? $this->wc_data->get_length() : null;
336336
},
337337
'width' => function() {
338-
return ! is_null( $this->wc_data->get_width() ) ? $this->wc_data->get_width() : null;
338+
return ! empty( $this->wc_data->get_width() ) ? $this->wc_data->get_width() : null;
339339
},
340340
'height' => function() {
341-
return ! is_null( $this->wc_data->get_height() ) ? $this->wc_data->get_height() : null;
341+
return ! empty( $this->wc_data->get_height() ) ? $this->wc_data->get_height() : null;
342342
},
343343
'shippingClassId' => function () {
344344
return ! empty( $this->wc_data->get_image_id() ) ? $this->wc_data->get_shipping_class_id() : null;

phpcs.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@
4949
<file>includes/</file>
5050
<exclude-pattern>/vendor/</exclude-pattern>
5151
<exclude-pattern>/node_modules/</exclude-pattern>
52+
<exclude-pattern>local/*</exclude-pattern>
5253
<exclude-pattern>/tests/</exclude-pattern>
5354
</ruleset>

tests/wpunit/CartMutationsTest.php

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public function testEmptyCartMutation() {
352352
$product_id = $this->factory->product->createSimple();
353353
$cart = \WC()->cart;
354354
$cart_item_key = $cart->add_to_cart( $product_id, 1 );
355-
$cart_item = \WC()->cart->get_cart_item( $cart_item_key );
355+
$cart_item = $cart->get_cart_item( $cart_item_key );
356356

357357
$query = '
358358
mutation( $input: EmptyCartInput! ) {
@@ -402,6 +402,7 @@ public function testEmptyCartMutation() {
402402
'id' => $this->toRelayId( 'product', $cart_item['product_id'] ),
403403
),
404404
),
405+
'variation' => null,
405406
'quantity' => $cart_item['quantity'],
406407
'subtotal' => wc_graphql_price( $cart_item['line_subtotal'] ),
407408
'subtotalTax' => wc_graphql_price( $cart_item['line_subtotal_tax'] ),
@@ -474,14 +475,14 @@ public function testApplyCouponMutation() {
474475
$response = $this->graphql( compact( 'query', 'variables' ) );
475476

476477
// Get updated cart item.
477-
$cart_item = \WC()->cart->get_cart_item( $cart_item_key );
478+
$cart_item = $cart->get_cart_item( $cart_item_key );
478479

479480
$this->assertQuerySuccessful(
480481
$response,
481482
array(
482483
$this->expectedObject( 'applyCoupon.clientMutationId', 'someId' ),
483484
$this->expectedNode(
484-
'applyCoupon.cart.appliedCoupons.nodes',
485+
'applyCoupon.cart.appliedCoupons',
485486
array(
486487
'code' => $coupon_code,
487488
)
@@ -659,7 +660,7 @@ public function testRemoveCouponMutation() {
659660
$response,
660661
array(
661662
$this->expectedObject( 'removeCoupons.clientMutationId', 'someId' ),
662-
$this->expectedObject( 'removeCoupons.cart.appliedCoupons.0.code', $coupon_code ),
663+
$this->expectedObject( 'removeCoupons.cart.appliedCoupons', 'null' ),
663664
$this->expectedNode(
664665
'removeCoupons.cart.contents.nodes',
665666
array(
@@ -775,12 +776,12 @@ public function testAddToCartMutationErrors() {
775776
cartItem {
776777
key
777778
product {
778-
nodes {
779+
node {
779780
id
780781
}
781782
}
782783
variation {
783-
nodes {
784+
node {
784785
id
785786
}
786787
}
@@ -820,9 +821,9 @@ public function testAddToCartMutationErrors() {
820821

821822
public function testAddCartItemsMutationAndErrors() {
822823
// Create variable product for later use.
823-
$variation_ids = $this->variation->create( $this->product->create_variable() );
824-
$product = \wc_get_product( $variation_ids['product'] );
825-
$attribute = new WC_Product_Attribute();
824+
$variation_ids = $this->factory->product_variation->createSome();
825+
$product = \wc_get_product( $variation_ids['product'] );
826+
$attribute = new WC_Product_Attribute();
826827
$attribute->set_id( 0 );
827828
$attribute->set_name( 'test' );
828829
$attribute->set_options( array( 'yes', 'no' ) );
@@ -834,7 +835,7 @@ public function testAddCartItemsMutationAndErrors() {
834835
$product->set_attributes( $attributes );
835836
$product->save();
836837

837-
$product_one = $this->product->create_simple();
838+
$product_one = $this->factory->product->createSimple();
838839
$invalid_product = 1000;
839840

840841
$query = '
@@ -892,6 +893,10 @@ public function testAddCartItemsMutationAndErrors() {
892893
'attributeName' => 'test',
893894
'attributeValue' => 'yes',
894895
),
896+
array(
897+
'attributeName' => 'color',
898+
'attributeValue' => 'green',
899+
),
895900
)
896901
)
897902
),
@@ -930,7 +935,7 @@ public function testAddCartItemsMutationAndErrors() {
930935
'addCartItems.cartErrors',
931936
array(
932937
'type' => 'INVALID_CART_ITEM',
933-
'reasons' => array( 'test is a required field' ),
938+
'reasons' => array( 'color and test are required fields' ),
934939
'productId' => $variation_ids['product'],
935940
'quantity' => 5,
936941
'variationId' => $variation_ids['variations'][0],
@@ -956,24 +961,20 @@ public function testAddCartItemsMutationAndErrors() {
956961

957962
public function testFillCartMutationAndErrors() {
958963
// Create products.
959-
$product_one = $this->product->create_simple(
960-
array( 'regular_price' => 100 )
961-
);
962-
$product_two = $this->product->create_simple(
963-
array( 'regular_price' => 40 )
964-
);
964+
$product_one = $this->factory->product->createSimple( array( 'regular_price' => 100 ) );
965+
$product_two = $this->factory->product->createSimple( array( 'regular_price' => 40 ) );
965966

966967
// Create coupons.
967968
$coupon_code_one = wc_get_coupon_code_by_id(
968-
$this->coupon->create(
969-
array(
970-
'amount' => 0.5,
971-
'product_ids' => array( $product_one )
972-
)
973-
)
974-
);
969+
$this->factory->coupon->create(
970+
array(
971+
'amount' => 0.5,
972+
'product_ids' => array( $product_one )
973+
)
974+
)
975+
);
975976
$coupon_code_two = wc_get_coupon_code_by_id(
976-
$this->coupon->create(
977+
$this->factory->coupon->create(
977978
array(
978979
'amount' => 0.2,
979980
'product_ids' => array( $product_two )
@@ -1058,7 +1059,7 @@ public function testFillCartMutationAndErrors() {
10581059
$response,
10591060
array(
10601061
$this->expectedObject( 'fillCart.clientMutationId', 'someId' ),
1061-
$this->expectedNode( 'fillCart.cart.chosenShippingMethod', 'legacy_flat_rate' ),
1062+
$this->expectedNode( 'fillCart.cart.chosenShippingMethods', 'legacy_flat_rate' ),
10621063
$this->expectedNode(
10631064
'fillCart.cart.contents.nodes',
10641065
array(
@@ -1124,8 +1125,8 @@ public function testFillCartMutationAndErrors() {
11241125
'fillCart.cartErrors',
11251126
array(
11261127
'type' => 'INVALID_SHIPPING_METHOD',
1128+
'chosenMethod' => $invalid_shipping_method,
11271129
'package' => 1,
1128-
'chosenMethod' => $invalid_shipping_method
11291130
)
11301131
),
11311132
)

tests/wpunit/CartQueriesTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ public function getExpectedCartItemData( $path, $cart_item_key ) {
3131
$item = $cart->get_cart_item( $cart_item_key );
3232
return array(
3333
$this->expectedObject( "{$path}.key", $item['key'] ),
34-
$this->expectedObject( "{$path}.product.id", $this->toRelayId( 'product', $item['product_id'] ) ),
35-
$this->expectedObject( "{$path}.product.databaseId", $item['product_id'] ),
34+
$this->expectedObject( "{$path}.product.node.id", $this->toRelayId( 'product', $item['product_id'] ) ),
35+
$this->expectedObject( "{$path}.product.node.databaseId", $item['product_id'] ),
3636
$this->expectedObject(
37-
"{$path}.variation.id",
37+
"{$path}.variation.node.id",
3838
! empty( $item['variation_id'] )
3939
? $this->toRelayId( 'product_variation', $item['variation_id'] )
4040
: 'NULL'
4141
),
4242
$this->expectedObject(
43-
"{$path}.variation.databaseId",
43+
"{$path}.variation.node.databaseId",
4444
! empty( $item['variation_id'] ) ? $item['variation_id'] : 'NULL'
4545
),
4646
$this->expectedObject( "{$path}.quantity", $item['quantity'] ),

tests/wpunit/ProductQueriesTest.php

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function getExpectedProductData( $product_id ) {
2929

3030
return array(
3131
$this->expectedObject( 'product.id', $this->toRelayId( 'product', $product_id ) ),
32-
$this->expectedObject( 'product.productId', $product->get_id() ),
32+
$this->expectedObject( 'product.databaseId', $product->get_id() ),
3333
$this->expectedObject( 'product.name', $product->get_name() ),
3434
$this->expectedObject( 'product.slug', $product->get_slug() ),
3535
$this->expectedObject( 'product.date', $product->get_date_created()->__toString() ),
@@ -371,8 +371,11 @@ public function testProductTaxonomies() {
371371
$this->expectedNode(
372372
'product.productCategories.nodes',
373373
array(
374-
'name' => 'category-five',
375-
'children' => array(
374+
'name' => 'category-five',
375+
'image' => null,
376+
'display' => 'DEFAULT',
377+
'menuOrder' => 0,
378+
'children' => array(
376379
'nodes' => array(
377380
array( 'name' => 'category-six' ),
378381
),
@@ -1241,7 +1244,7 @@ public function testProductGalleryImagesConnection() {
12411244
'post_content' => 'Lorem ipsum dolor...',
12421245
)
12431246
);
1244-
$product_id = $this->helper->create_simple(
1247+
$product_id = $this->factory->product->createSimple(
12451248
array( 'gallery_image_ids' => array( $image_id ) )
12461249
);
12471250

@@ -1257,23 +1260,16 @@ public function testProductGalleryImagesConnection() {
12571260
}
12581261
';
12591262

1260-
$variables = array( 'id' => $this->helper->to_relay_id( $product_id ) );
1261-
$actual = graphql( array( 'query' => $query, 'variables' => $variables ) );
1262-
$expected = array(
1263-
'data' => array(
1264-
'product' => array (
1265-
'galleryImages' => array(
1266-
'nodes' => array(
1267-
array( 'id' => \GraphQLRelay\Relay::toGlobalId( 'post', $image_id ) )
1268-
)
1269-
)
1270-
),
1271-
),
1263+
$variables = array( 'id' => $this->toRelayId( 'product', $product_id ) );
1264+
$response = $this->graphql( compact( 'query', 'variables' ) );
1265+
$this->assertQuerySuccessful(
1266+
$response,
1267+
array(
1268+
$this->expectedNode(
1269+
'product.galleryImages.nodes',
1270+
array( 'id' => $this->toRelayId( 'post', $image_id ) )
1271+
)
1272+
)
12721273
);
1273-
1274-
// use --debug flag to view.
1275-
codecept_debug( $actual );
1276-
1277-
$this->assertEquals( $expected, $actual );
12781274
}
12791275
}

vendor/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
require_once __DIR__ . '/composer/autoload_real.php';
66

7-
return ComposerAutoloaderInit5eacf0c3882a5724168d223c2be9fedf::getLoader();
7+
return ComposerAutoloaderInit648341988a21d33ec51fdb8a740ccacb::getLoader();

vendor/composer/InstalledVersions.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class InstalledVersions
2929
'aliases' =>
3030
array (
3131
),
32-
'reference' => 'd7379a41e679eef76f221638e568076932e62ed9',
32+
'reference' => 'a6f2c9f49b99ff4f8a13707bba2c21861e9c0813',
3333
'name' => 'wp-graphql/wp-graphql-woocommerce',
3434
),
3535
'versions' =>
@@ -43,14 +43,23 @@ class InstalledVersions
4343
),
4444
'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
4545
),
46+
'webonyx/graphql-php' =>
47+
array (
48+
'pretty_version' => 'v14.4.0',
49+
'version' => '14.4.0.0',
50+
'aliases' =>
51+
array (
52+
),
53+
'reference' => 'aab3d49181467db064b41429cde117a7589625fc',
54+
),
4655
'wp-graphql/wp-graphql-woocommerce' =>
4756
array (
4857
'pretty_version' => 'dev-develop',
4958
'version' => 'dev-develop',
5059
'aliases' =>
5160
array (
5261
),
53-
'reference' => 'd7379a41e679eef76f221638e568076932e62ed9',
62+
'reference' => 'a6f2c9f49b99ff4f8a13707bba2c21861e9c0813',
5463
),
5564
),
5665
);

0 commit comments

Comments
 (0)