@@ -222,6 +222,7 @@ public function testProductsQueryAndWhereArgs() {
222222 $featured: Boolean,
223223 $maxPrice: Float,
224224 $orderby: [WCConnectionOrderbyInput]
225+ $taxonomyFilter: [ProductTaxonomyFilterRelationInput]
225226 ){
226227 products( where: {
227228 slug: $slug,
@@ -238,6 +239,7 @@ public function testProductsQueryAndWhereArgs() {
238239 featured: $featured,
239240 maxPrice: $maxPrice,
240241 orderby: $orderby
242+ taxonomyFilter: $taxonomyFilter
241243 } ) {
242244 nodes {
243245 id
@@ -483,7 +485,7 @@ public function testProductsQueryAndWhereArgs() {
483485 /**
484486 * Assertion Ten
485487 *
486- * tests "categoryName " where argument
488+ * tests "category " where argument
487489 */
488490 $ variables = array ( 'category ' => 'category-three ' );
489491 $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
@@ -511,7 +513,7 @@ public function testProductsQueryAndWhereArgs() {
511513 /**
512514 * Assertion Eleven
513515 *
514- * tests "categoryName " where argument
516+ * tests "categoryIn " where argument
515517 */
516518 $ variables = array ( 'categoryIn ' => array ( 'category-three ' ) );
517519 $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
@@ -539,7 +541,7 @@ public function testProductsQueryAndWhereArgs() {
539541 /**
540542 * Assertion Twelve
541543 *
542- * tests "categoryName " where argument
544+ * tests "categoryNotIn " where argument
543545 */
544546 $ variables = array ( 'categoryNotIn ' => array ( 'category-four ' ) );
545547 $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
@@ -567,7 +569,7 @@ public function testProductsQueryAndWhereArgs() {
567569 /**
568570 * Assertion Thirteen
569571 *
570- * tests "categoryName " where argument
572+ * tests "categoryId " where argument
571573 */
572574 $ variables = array ( 'categoryId ' => $ category_3 );
573575 $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
@@ -595,7 +597,7 @@ public function testProductsQueryAndWhereArgs() {
595597 /**
596598 * Assertion Fourteen
597599 *
598- * tests "categoryName " where argument
600+ * tests "categoryIdIn " where argument
599601 */
600602 $ variables = array ( 'categoryIdIn ' => array ( $ category_3 ) );
601603 $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
@@ -623,7 +625,7 @@ public function testProductsQueryAndWhereArgs() {
623625 /**
624626 * Assertion Fifteen
625627 *
626- * tests "categoryName " where argument
628+ * tests "categoryIdNotIn " where argument
627629 */
628630 $ variables = array ( 'categoryIdNotIn ' => array ( $ category_4 ) );
629631 $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
@@ -647,6 +649,51 @@ public function testProductsQueryAndWhereArgs() {
647649 codecept_debug ( $ actual );
648650
649651 $ this ->assertEquals ( $ expected , $ actual );
652+
653+ /**
654+ * Assertion Sixteen
655+ *
656+ * tests "taxonomyFilter" where argument
657+ */
658+ $ variables = array (
659+ 'taxonomyFilter ' => array (
660+ array (
661+ 'and ' => array (
662+ array (
663+ 'taxonomy ' => 'CATEGORY ' ,
664+ 'terms ' => array ( 'category-three ' ),
665+ ),
666+ array (
667+ 'taxonomy ' => 'CATEGORY ' ,
668+ 'terms ' => array ( 'category-four ' ),
669+ 'operator ' => 'NOT_IN '
670+ ),
671+ )
672+ )
673+ ),
674+ );
675+ $ actual = do_graphql_request ( $ query , 'ProductsQuery ' , $ variables );
676+ $ expected = array (
677+ 'data ' => array (
678+ 'products ' => array (
679+ 'nodes ' => $ this ->helper ->print_nodes (
680+ $ products ,
681+ array (
682+ 'filter ' => function ( $ id ) use ( $ category_4 , $ category_3 ) {
683+ $ product = \wc_get_product ( $ id );
684+ return ! in_array ( $ category_4 , $ product ->get_category_ids () )
685+ && in_array ( $ category_3 , $ product ->get_category_ids () );
686+ },
687+ )
688+ ),
689+ ),
690+ ),
691+ );
692+
693+ // use --debug flag to view.
694+ codecept_debug ( $ actual );
695+
696+ $ this ->assertEquals ( $ expected , $ actual );
650697 }
651698
652699 public function testProductToTermConnection () {
0 commit comments