10
10
use Magento \TestFramework \Helper \Bootstrap ;
11
11
use Magento \TestFramework \Quote \Model \GetQuoteByReservedOrderId ;
12
12
use Magento \Catalog \Api \TierPriceStorageInterface ;
13
- use Magento \Catalog \Api \Data \TierPriceInterface ;
13
+ use Magento \Catalog \Api \Data \TierPriceInterfaceFactory ;
14
14
use PHPUnit \Framework \TestCase ;
15
15
16
16
/**
@@ -29,9 +29,9 @@ class UpdateQuoteTest extends TestCase
29
29
private $ tierPriceStorage ;
30
30
31
31
/**
32
- * @var TierPriceInterface
32
+ * @var TierPriceInterfaceFactory
33
33
*/
34
- private $ tierPrice ;
34
+ private $ tierPriceFactory ;
35
35
36
36
/**
37
37
* @inheritdoc
@@ -43,7 +43,7 @@ protected function setUp(): void
43
43
$ objectManager = Bootstrap::getObjectManager ();
44
44
$ this ->getQuoteByReservedOrderId = $ objectManager ->get (GetQuoteByReservedOrderId::class);
45
45
$ this ->tierPriceStorage = $ objectManager ->get (TierPriceStorageInterface::class);
46
- $ this ->tierPrice = $ objectManager ->get (TierPriceInterface ::class);
46
+ $ this ->tierPriceFactory = $ objectManager ->get (TierPriceInterfaceFactory ::class);
47
47
}
48
48
49
49
/**
@@ -62,28 +62,17 @@ public function testUpdateQuoteRecollectAfterChangeProductPrice(): void
62
62
$ quoteItem = current ($ quote ->getItems ());
63
63
$ product = $ quoteItem ->getProduct ();
64
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 ]);
65
+ $ tierPrice = $ this ->tierPriceFactory ->create ();
66
+ $ tierPrice ->setPrice ($ product ->getPrice ());
67
+ $ tierPrice ->setPriceType ('fixed ' );
68
+ $ tierPrice ->setWebsiteId (0 );
69
+ $ tierPrice ->setSku ($ product ->getSku ());
70
+ $ tierPrice ->setCustomerGroup ('ALL GROUPS ' );
71
+ $ tierPrice ->setQuantity (1 );
72
+ $ this ->tierPriceStorage ->update ([$ tierPrice ]);
72
73
73
- /** @var QuoteResource $quoteResource */
74
- $ quoteResource = $ quote ->getResource ();
75
- /** @var AdapterInterface $connection */
76
- $ connection = $ quoteResource ->getConnection ();
77
- $ select = $ connection ->select ()
78
- ->from (
79
- $ quoteResource ->getTable ('quote ' ),
80
- ['trigger_recollect ' ]
81
- )->where (
82
- "reserved_order_id = 'test_order_with_simple_product_without_address' "
83
- );
84
-
85
- $ quoteRow = $ connection ->fetchRow ($ select );
86
- $ this ->assertNotEmpty ($ quoteRow );
87
- $ this ->assertTrue ((bool )$ quoteRow ['trigger_recollect ' ]);
74
+ $ quote = $ this ->getQuoteByReservedOrderId ->execute ($ quoteId );
75
+ $ this ->assertNotEmpty ($ quote ->getTriggerRecollect ());
76
+ $ this ->assertTrue ((bool )$ quote ->getTriggerRecollect ());
88
77
}
89
78
}
0 commit comments