File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
dev/tests/integration/testsuite/Magento/Checkout/Controller/Cart/Index Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
namespace Magento \Checkout \Controller \Cart \Index ;
8
8
9
+ use Magento \Framework \App \Request \Http as HttpRequest ;
10
+
9
11
/**
10
12
* @magentoDbIsolation enabled
11
13
*/
@@ -36,4 +38,35 @@ public function testExecute()
36
38
\Magento \Framework \Message \MessageInterface::TYPE_ERROR
37
39
);
38
40
}
41
+
42
+ /**
43
+ * Testing by adding a valid coupon to cart
44
+ *
45
+ * @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php
46
+ * @magentoDataFixture Magento/Usps/Fixtures/cart_rule_coupon_free_shipping.php
47
+ * @return void
48
+ */
49
+ public function testAddingValidCoupon ()
50
+ {
51
+ /** @var $session \Magento\Checkout\Model\Session */
52
+ $ session = $ this ->_objectManager ->create (\Magento \Checkout \Model \Session::class);
53
+ $ quote = $ session ->getQuote ();
54
+ $ quote ->setData ('trigger_recollect ' , 1 )->setTotalsCollectedFlag (true );
55
+
56
+ $ couponCode = 'IMPHBR852R61 ' ;
57
+ $ inputData = [
58
+ 'remove ' => 0 ,
59
+ 'coupon_code ' => $ couponCode
60
+ ];
61
+ $ this ->getRequest ()->setMethod (HttpRequest::METHOD_POST );
62
+ $ this ->getRequest ()->setPostValue ($ inputData );
63
+ $ this ->dispatch (
64
+ 'checkout/cart/couponPost/ '
65
+ );
66
+
67
+ $ this ->assertSessionMessages (
68
+ $ this ->equalTo (['You used coupon code " ' . $ couponCode . '". ' ]),
69
+ \Magento \Framework \Message \MessageInterface::TYPE_SUCCESS
70
+ );
71
+ }
39
72
}
You can’t perform that action at this time.
0 commit comments