コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getList($cartId)
 {
     /** @var $quoteIdMask QuoteIdMask */
     $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
     $cartItemList = $this->repository->getList($quoteIdMask->getQuoteId());
     /** @var $item CartItemInterface */
     foreach ($cartItemList as $item) {
         $item->setQuoteId($quoteIdMask->getMaskedId());
     }
     return $cartItemList;
 }
コード例 #2
0
ファイル: RepositoryTest.php プロジェクト: opexsw/magento2
 /**
  * @return void
  */
 public function testGetList()
 {
     $quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', [], [], '', false);
     $this->quoteRepositoryMock->expects($this->once())->method('getActive')->with(33)->will($this->returnValue($quoteMock));
     $itemMock = $this->getMock('\\Magento\\Quote\\Model\\Quote\\Item', [], [], '', false);
     $quoteMock->expects($this->any())->method('getAllItems')->will($this->returnValue([$itemMock]));
     $this->assertEquals([$itemMock], $this->repository->getList(33));
 }