7
7
8
8
namespace Magento \Quote \Model \Product \Plugin ;
9
9
10
- use Magento \Quote \Model \ResourceModel \Quote as QuoteResource ;
11
10
use Magento \TestFramework \Helper \Bootstrap ;
12
11
use Magento \TestFramework \Quote \Model \GetQuoteByReservedOrderId ;
12
+ use Magento \Catalog \Api \TierPriceStorageInterface ;
13
+ use Magento \Catalog \Api \Data \TierPriceInterface ;
13
14
use PHPUnit \Framework \TestCase ;
14
15
15
16
/**
16
17
* Tests for update quote plugin.
17
- *
18
- * @magentoAppArea adminhtml
19
18
*/
20
19
class UpdateQuoteTest extends TestCase
21
20
{
@@ -24,6 +23,16 @@ class UpdateQuoteTest extends TestCase
24
23
*/
25
24
private $ getQuoteByReservedOrderId ;
26
25
26
+ /**
27
+ * @var TierPriceStorageInterface
28
+ */
29
+ private $ tierPriceStorage ;
30
+
31
+ /**
32
+ * @var TierPriceInterface
33
+ */
34
+ private $ tierPrice ;
35
+
27
36
/**
28
37
* @inheritdoc
29
38
*/
@@ -33,6 +42,8 @@ protected function setUp(): void
33
42
34
43
$ objectManager = Bootstrap::getObjectManager ();
35
44
$ this ->getQuoteByReservedOrderId = $ objectManager ->get (GetQuoteByReservedOrderId::class);
45
+ $ this ->tierPriceStorage = $ objectManager ->get (TierPriceStorageInterface::class);
46
+ $ this ->tierPrice = $ objectManager ->get (TierPriceInterface::class);
36
47
}
37
48
38
49
/**
@@ -43,16 +54,24 @@ protected function setUp(): void
43
54
*/
44
55
public function testUpdateQuoteRecollectAfterChangeProductPrice (): void
45
56
{
46
- $ quote = $ this ->getQuoteByReservedOrderId ->execute ('test_order_with_simple_product_without_address ' );
57
+ $ quoteId = 'test_order_with_simple_product_without_address ' ;
58
+ $ quote = $ this ->getQuoteByReservedOrderId ->execute ($ quoteId );
47
59
$ this ->assertNotNull ($ quote );
48
60
$ this ->assertFalse ((bool )$ quote ->getTriggerRecollect ());
49
61
$ this ->assertNotEmpty ($ quote ->getItems ());
50
62
$ quoteItem = current ($ quote ->getItems ());
51
63
$ product = $ quoteItem ->getProduct ();
52
64
65
+ $ this ->tierPrice ->setPrice ($ product ->getPrice ());
66
+ $ this ->tierPrice ->setPriceType ('fixed ' );
67
+ $ this ->tierPrice ->setWebsiteId (0 );
68
+ $ this ->tierPrice ->setSku ($ product ->getSku ());
69
+ $ this ->tierPrice ->setCustomerGroup ('ALL GROUPS ' );
70
+ $ this ->tierPrice ->setQuantity (1 );
71
+ $ this ->tierPriceStorage ->update ([$ this ->tierPrice ]);
72
+
53
73
/** @var QuoteResource $quoteResource */
54
74
$ quoteResource = $ quote ->getResource ();
55
- $ quoteResource ->markQuotesRecollect ($ product ->getId ());
56
75
/** @var AdapterInterface $connection */
57
76
$ connection = $ quoteResource ->getConnection ();
58
77
$ select = $ connection ->select ()
0 commit comments