Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QuoteIdToMaskedQuoteIdTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
8 namespace Magento\Quote\Model;
9 
11 use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper;
13 
14 class QuoteIdToMaskedQuoteIdTest extends \PHPUnit\Framework\TestCase
15 {
19  private $quoteResource;
20 
24  private $quoteFactory;
25 
29  private $quoteIdToMaskedQuoteId;
30 
31  protected function setUp()
32  {
33  $objectManager = BootstrapHelper::getObjectManager();
34  $this->quoteIdToMaskedQuoteId = $objectManager->create(QuoteIdToMaskedQuoteIdInterface::class);
35  $this->quoteFactory = $objectManager->create(QuoteFactory::class);
36  $this->quoteResource = $objectManager->create(QuoteResource::class);
37  }
38 
42  public function testMaskedQuoteId()
43  {
44  $quote = $this->quoteFactory->create();
45  $this->quoteResource->load($quote, 'test01', 'reserved_order_id');
46  $maskedQuoteId = $this->quoteIdToMaskedQuoteId->execute((int) $quote->getId());
47 
48  self::assertNotEmpty($maskedQuoteId);
49  }
50 
52  {
53  self::expectException(NoSuchEntityException::class);
54 
55  $this->quoteIdToMaskedQuoteId->execute(0);
56  }
57 }
$objectManager
Definition: bootstrap.php:17
$quote