11<?php
22
33class CartMutationsTest extends \Codeception \TestCase \WPTestCase {
4+ private $ shop_manager ;
45 private $ customer ;
56 private $ coupon ;
67 private $ product ;
@@ -10,11 +11,12 @@ class CartMutationsTest extends \Codeception\TestCase\WPTestCase {
1011 public function setUp () {
1112 parent ::setUp ();
1213
13- $ this ->customer = $ this ->getModule ('\Helper\Wpunit ' )->customer ();
14- $ this ->coupon = $ this ->getModule ('\Helper\Wpunit ' )->coupon ();
15- $ this ->product = $ this ->getModule ('\Helper\Wpunit ' )->product ();
16- $ this ->variation = $ this ->getModule ('\Helper\Wpunit ' )->product_variation ();
17- $ this ->cart = $ this ->getModule ('\Helper\Wpunit ' )->cart ();
14+ $ this ->shop_manager = $ this ->factory ->user ->create ( array ( 'role ' => 'shop_manager ' ) );
15+ $ this ->customer = $ this ->getModule ('\Helper\Wpunit ' )->customer ();
16+ $ this ->coupon = $ this ->getModule ('\Helper\Wpunit ' )->coupon ();
17+ $ this ->product = $ this ->getModule ('\Helper\Wpunit ' )->product ();
18+ $ this ->variation = $ this ->getModule ('\Helper\Wpunit ' )->product_variation ();
19+ $ this ->cart = $ this ->getModule ('\Helper\Wpunit ' )->cart ();
1820 }
1921
2022 public function tearDown () {
@@ -899,6 +901,20 @@ public function testAddFeeMutation() {
899901 // use --debug flag to view.
900902 codecept_debug ( $ actual );
901903
904+ $ this ->assertArrayHasKey ('errors ' , $ actual );
905+
906+ wp_set_current_user ( $ this ->shop_manager );
907+ $ actual = graphql (
908+ array (
909+ 'query ' => $ mutation ,
910+ 'operation_name ' => 'addFee ' ,
911+ 'variables ' => $ variables ,
912+ )
913+ );
914+
915+ // use --debug flag to view.
916+ codecept_debug ( $ actual );
917+
902918 $ expected = array (
903919 'data ' => array (
904920 'addFee ' => array (
0 commit comments