Skip to content

Commit 83d5246

Browse files
committed
magento/graphql-ce#746: Failed testApplyExpiredCoupon tests on Jenkins
1 parent a734b1b commit 83d5246

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

dev/tests/integration/testsuite/Magento/GraphQl/Quote/_files/make_coupon_expired.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@
1616

1717
$coupon = $couponFactory->create();
1818
$coupon->loadByCode('2?ds5!2d');
19-
$yesterday = new \DateTime();
20-
$yesterday->add(\DateInterval::createFromDateString('-1 day'));
21-
$coupon->setExpirationDate($yesterday->format('Y-m-d'));
19+
$coupon->setExpirationDate('2016-08-06');
2220
$couponResource->save($coupon);

dev/tests/integration/testsuite/Magento/SalesRule/_files/cart_rule_100_percent_off_rollback.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
declare(strict_types=1);
77

8+
use Magento\Framework\Exception\NoSuchEntityException;
89
use Magento\Framework\Registry;
910
use Magento\SalesRule\Api\RuleRepositoryInterface;
1011
use Magento\TestFramework\Helper\Bootstrap;
@@ -19,5 +20,12 @@
1920
$ruleId = $registry->registry('Magento/SalesRule/_files/cart_rule_100_percent_off');
2021

2122
if ($ruleId) {
22-
$ruleRepository->deleteById($ruleId);
23+
try {
24+
$ruleRepository->deleteById($ruleId);
25+
// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
26+
} catch (NoSuchEntityException $e) {
27+
/**
28+
* Tests which are wrapped with MySQL transaction clear all data by transaction rollback.
29+
*/
30+
}
2331
}

0 commit comments

Comments
 (0)