File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
dev/tests/integration/testsuite/Magento/Quote/Model Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -449,4 +449,26 @@ public function testAddedProductToQuoteIsSalable()
449
449
$ quote = $ objectManager ->create (\Magento \Quote \Model \Quote::class);
450
450
$ quote ->addProduct ($ product );
451
451
}
452
+
453
+ /**
454
+ * @magentoDataFixture Magento/Sales/_files/quote.php
455
+ * @magentoDataFixture Magento/Catalog/_files/product_simple.php
456
+ */
457
+ public function testGetItemById ()
458
+ {
459
+ $ quote = Bootstrap::getObjectManager ()->create ('Magento\Quote\Model\Quote ' );
460
+ $ quote ->load ('test01 ' , 'reserved_order_id ' );
461
+
462
+ $ quoteItem = Bootstrap::getObjectManager ()->create ('Magento\Quote\Model\Quote\Item ' );
463
+
464
+ $ productRepository = Bootstrap::getObjectManager ()->create ('Magento\Catalog\Api\ProductRepositoryInterface ' );
465
+ $ product = $ productRepository ->get ('simple ' );
466
+
467
+ $ quoteItem ->setProduct ($ product );
468
+ $ quote ->addItem ($ quoteItem );
469
+ $ quote ->save ();
470
+
471
+ $ this ->assertInstanceOf ('Magento\Quote\Model\Quote\Item ' , $ quote ->getItemById ($ quoteItem ->getId ()));
472
+ $ this ->assertEquals ($ quoteItem ->getId (), $ quote ->getItemById ($ quoteItem ->getId ())->getId ());
473
+ }
452
474
}
You can’t perform that action at this time.
0 commit comments