Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Fixed coupon fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
rogyar committed Sep 19, 2018
1 parent 2f4767d commit 343e463
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected function setUp()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
*/
public function testApplyCouponToGuestCartWithItems()
{
Expand All @@ -64,7 +64,7 @@ public function testApplyCouponToGuestCartWithItems()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
*/
public function testApplyCouponTwice()
{
Expand All @@ -88,7 +88,7 @@ public function testApplyCouponTwice()

/**
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
*/
public function testApplyCouponToCartWithNoItems()
{
Expand All @@ -104,7 +104,7 @@ public function testApplyCouponToCartWithNoItems()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
* @magentoApiDataFixture Magento/Customer/_files/customer.php
*/
public function testGuestCustomerAttemptToChangeCustomerCart()
Expand All @@ -127,7 +127,7 @@ public function testGuestCustomerAttemptToChangeCustomerCart()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
*/
public function testRemoveCoupon()
{
Expand Down Expand Up @@ -158,7 +158,7 @@ public function testRemoveCoupon()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/SalesRule/_files/cart_rule_40_percent_off.php
* @magentoApiDataFixture Magento/SalesRule/_files/coupon_cart_fixed_discount.php
* @magentoApiDataFixture Magento/Customer/_files/customer.php
*/
public function testRemoveCouponFromCustomerCartByGuest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@
->setCode('CART_FIXED_DISCOUNT_15')
->setType(0);
$objectManager->get(CouponRepositoryInterface::class)->save($coupon);

/** @var Magento\Framework\Registry $registry */
$registry = $objectManager->get(\Magento\Framework\Registry::class);

$registry->unregister('cart_rule_fixed_discount_coupon');
$registry->register('cart_rule_fixed_discount_coupon', $salesRule);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

use Magento\TestFramework\Helper\Bootstrap;

/** @var Magento\Framework\Registry $registry */
$registry = Bootstrap::getObjectManager()->get(\Magento\Framework\Registry::class);

/** @var Magento\SalesRule\Model\Rule $rule */
$rule = $registry->registry('cart_rule_fixed_discount_coupon');
if ($rule) {
$rule->delete();
}

0 comments on commit 343e463

Please sign in to comment.