Skip to content

Commit

Permalink
#481 Removed extracted code from the test
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Glushko committed Mar 16, 2019
1 parent b93da7a commit 3d421d4
Showing 1 changed file with 0 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,63 +126,6 @@ public function testGuestCustomerAttemptToChangeCustomerCart()
$this->graphQlQuery($query);
}

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
*/
public function testRemoveCoupon()
{
$couponCode = '2?ds5!2d';

/* Apply coupon to the quote */
$this->quoteResource->load(
$this->quote,
'test_order_with_simple_product_without_address',
'reserved_order_id'
);
$maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
$this->quoteResource->load(
$this->quote,
'test_order_with_simple_product_without_address',
'reserved_order_id'
);
$query = $this->prepareAddCouponRequestQuery($maskedQuoteId, $couponCode);
$this->graphQlQuery($query);

/* Remove coupon from quote */
$query = $this->prepareRemoveCouponRequestQuery($maskedQuoteId);
$response = $this->graphQlQuery($query);

self::assertArrayHasKey('removeCouponFromCart', $response);
self::assertNull($response['removeCouponFromCart']['cart']['applied_coupon']['code']);
}

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_code_with_wildcard.php
* @magentoApiDataFixture Magento/Customer/_files/customer.php
*/
public function testRemoveCouponFromCustomerCartByGuest()
{
$this->quoteResource->load(
$this->quote,
'test_order_with_simple_product_without_address',
'reserved_order_id'
);
$maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
$this->quoteResource->load(
$this->quote,
'test_order_with_simple_product_without_address',
'reserved_order_id'
);
$this->quote->setCustomerId(1);
$this->quoteResource->save($this->quote);
$query = $this->prepareRemoveCouponRequestQuery($maskedQuoteId);

self::expectExceptionMessage('The current user cannot perform operations on cart "' . $maskedQuoteId . '"');
$this->graphQlQuery($query);
}

/**
* @param string $maskedQuoteId
* @param string $couponCode
Expand All @@ -200,26 +143,6 @@ private function prepareAddCouponRequestQuery(string $maskedQuoteId, string $cou
}
}
}
QUERY;
}

/**
* @param string $maskedQuoteId
* @return string
*/
private function prepareRemoveCouponRequestQuery(string $maskedQuoteId): string
{
return <<<QUERY
mutation {
removeCouponFromCart(input: {cart_id: "$maskedQuoteId"}) {
cart {
applied_coupon {
code
}
}
}
}
QUERY;
}
}

0 comments on commit 3d421d4

Please sign in to comment.