LastOrderedItemsTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\Sales\CustomerData;
  8. use Magento\Framework\ObjectManagerInterface;
  9. use Magento\TestFramework\Helper\Bootstrap;
  10. use PHPUnit\Framework\TestCase;
  11. use Magento\Customer\Model\Session;
  12. /**
  13. * @magentoAppIsolation enabled
  14. */
  15. class LastOrderedItemsTest extends TestCase
  16. {
  17. /**
  18. * @var ObjectManagerInterface
  19. */
  20. private $objectManager;
  21. public function setUp()
  22. {
  23. $this->objectManager = Bootstrap::getObjectManager();
  24. }
  25. /**
  26. * @magentoDataFixture Magento/Sales/_files/order_with_customer_and_multiple_order_items.php
  27. */
  28. public function testDefaultFormatterIsAppliedWhenBasicIntegration()
  29. {
  30. /** @var Session $customerSession */
  31. $customerSession = $this->objectManager->get(Session::class);
  32. $customerSession->loginById(1);
  33. /** @var LastOrderedItems $customerDataSectionSource */
  34. $customerDataSectionSource = $this->objectManager->get(LastOrderedItems::class);
  35. $data = $customerDataSectionSource->getSectionData();
  36. $this->assertEquals(
  37. LastOrderedItems::SIDEBAR_ORDER_LIMIT,
  38. count($data['items']),
  39. 'Section items count should not be greater then ' . LastOrderedItems::SIDEBAR_ORDER_LIMIT
  40. );
  41. }
  42. }