QuoteTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Backend\Model\Session;
  7. /**
  8. * Class QuoteTest
  9. */
  10. class QuoteTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * @magentoDataFixture Magento/Customer/_files/customer.php
  14. * @magentoAppIsolation enabled
  15. */
  16. public function testGetQuote()
  17. {
  18. /** Preconditions */
  19. $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
  20. $fixtureCustomerId = 1;
  21. /** @var \Magento\Backend\Model\Session\Quote $backendQuoteSession */
  22. $backendQuoteSession = $objectManager->get(\Magento\Backend\Model\Session\Quote::class);
  23. $backendQuoteSession->setCustomerId($fixtureCustomerId);
  24. /** @var \Magento\Backend\Model\Session\Quote $quoteSession */
  25. $quoteSession = $objectManager->create(\Magento\Backend\Model\Session\Quote::class);
  26. $quoteSession->setEntity(new \Magento\Framework\DataObject());
  27. /** SUT execution */
  28. $quote = $quoteSession->getQuote();
  29. /** Ensure that customer data was added to quote correctly */
  30. $this->assertEquals(
  31. 'John',
  32. $quote->getCustomer()->getFirstname(),
  33. 'Customer data was set to quote incorrectly.'
  34. );
  35. }
  36. }