mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
docs: More docs drafted. (#774)
* docs: Pro docs drafted. * feat: billingEmail added to OrderConnectionWhereArgs * feat: More drafts added. * docs: More documentation introduced. * docs: page meta added to each new section * chore: Linter compliance met * docs: page meta added to each new section * docs: Some revision and screenshots added. * docs: More revisions * feat: more revisions and images added. * updated docs after proofreading * chore: HPOS compatibility declared. * docs: Some word consistency issues fixed. * docs: Introductions and conclusions added. * chore: Linter compliance met --------- Co-authored-by: Craig Wilcox <craig@simplur.com>
This commit is contained in:
co-authored by
Craig Wilcox
parent
18ec202538
commit
dedecd04de
@@ -283,7 +283,9 @@ class OrderQueriesTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLT
|
||||
$product = $this->factory->product->createSimple();
|
||||
$orders = [
|
||||
$this->factory->order->createNew(
|
||||
[],
|
||||
[
|
||||
'billing_email' => 'test@example.com'
|
||||
],
|
||||
[
|
||||
'line_items' => [
|
||||
[
|
||||
@@ -310,16 +312,20 @@ class OrderQueriesTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLT
|
||||
];
|
||||
|
||||
$query = '
|
||||
query ($statuses: [OrderStatusEnum], $customerId: Int, $customersIn: [Int] $productId: Int) {
|
||||
query ($statuses: [OrderStatusEnum], $customerId: Int, $customersIn: [Int], $billingEmail: String, $productId: Int) {
|
||||
orders(where: {
|
||||
statuses: $statuses,
|
||||
customerId: $customerId,
|
||||
customersIn: $customersIn,
|
||||
billingEmail: $billingEmail,
|
||||
productId: $productId,
|
||||
orderby: { field: MENU_ORDER, order: ASC }
|
||||
}) {
|
||||
nodes {
|
||||
id
|
||||
billing {
|
||||
email
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,9 +351,9 @@ class OrderQueriesTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLT
|
||||
$this->loginAsShopManager();
|
||||
$response = $this->graphql( compact( 'query' ) );
|
||||
$expected = [
|
||||
$this->expectedNode( 'orders.nodes', [ 'id' => $this->toRelayId( 'order', $orders[0] ) ] ),
|
||||
$this->expectedNode( 'orders.nodes', [ 'id' => $this->toRelayId( 'order', $orders[1] ) ] ),
|
||||
$this->not()->expectedNode( 'orders.nodes', [ 'id' => $this->toRelayId( 'order', $old_orders[0] ) ] ),
|
||||
$this->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $orders[0] ) ),
|
||||
$this->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $orders[1] ) ),
|
||||
$this->not()->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $old_orders[0]->get_id() ) ),
|
||||
];
|
||||
|
||||
$this->assertQuerySuccessful( $response, $expected );
|
||||
@@ -361,7 +367,7 @@ class OrderQueriesTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLT
|
||||
$variables = [ 'statuses' => [ 'COMPLETED' ] ];
|
||||
$response = $this->graphql( compact( 'query', 'variables' ) );
|
||||
$expected = [
|
||||
$this->expectedNode( 'orders.nodes', [ 'id' => $this->toRelayId( 'order', $orders[1] ) ] ),
|
||||
$this->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $orders[1] ) ),
|
||||
];
|
||||
|
||||
$this->assertQuerySuccessful( $response, $expected );
|
||||
@@ -392,6 +398,24 @@ class OrderQueriesTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLT
|
||||
/**
|
||||
* Assertion Six
|
||||
*
|
||||
* Tests "billingEmail" where argument
|
||||
*/
|
||||
$variables = [ 'billingEmail' => 'test@example.com' ];
|
||||
$response = $this->graphql( compact( 'query', 'variables' ) );
|
||||
|
||||
$this->assertQuerySuccessful(
|
||||
$response,
|
||||
[
|
||||
$this->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $orders[0] ) ),
|
||||
$this->not()->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $orders[1] ) ),
|
||||
$this->not()->expectedField( 'orders.nodes.#.id', $this->toRelayId( 'order', $old_orders[0] ) ),
|
||||
]
|
||||
);
|
||||
$this->clearLoaderCache( 'wc_post' );
|
||||
|
||||
/**
|
||||
* Assertion Seven
|
||||
*
|
||||
* Tests "productId" where argument
|
||||
*/
|
||||
$variables = [ 'productId' => $product ];
|
||||
@@ -401,7 +425,7 @@ class OrderQueriesTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLT
|
||||
$this->clearLoaderCache( 'wc_post' );
|
||||
|
||||
/**
|
||||
* Assertion Seven
|
||||
* Assertion Eight
|
||||
*
|
||||
* Tests `orders` query as existing customer, should return customer's
|
||||
* orders only
|
||||
|
||||
Reference in New Issue
Block a user