Skip to content

Commit

Permalink
Added test for setting shipping methods as guest for a customer cart
Browse files Browse the repository at this point in the history
  • Loading branch information
rogyar committed Nov 8, 2018
1 parent c3b4a80 commit c713b67
Showing 1 changed file with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,35 @@ public function testSetShippingMethodWithNonExistingAddress()
$this->sendRequestWithToken($query);
}

// TODO: TBD - add check for guest with attempt to set shipping method to the customer's shopping cart
/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
*/
public function testSetShippingMethodByGuestToCustomerCart()
{
$shippingCarrierCode = 'flatrate';
$shippingMethodCode = 'flatrate';
$this->quoteResource->load(
$this->quote,
'test_order_1',
'reserved_order_id'
);
$shippingAddress = $this->quote->getShippingAddress();
$shippingAddressId = $shippingAddress->getId();
$maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());

$query = $this->prepareMutationQuery(
$maskedQuoteId,
$shippingMethodCode,
$shippingCarrierCode,
$shippingAddressId
);

self::expectExceptionMessage(
"The current user cannot perform operations on cart \"$maskedQuoteId\""
);

$this->graphQlQuery($query);
}

/**
* Generates query for setting the specified shipping method on cart
Expand Down

0 comments on commit c713b67

Please sign in to comment.