StoreManagerTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Store\Model;
  7. use Magento\Framework\ObjectManagerInterface as ObjectManager;
  8. use Magento\Store\Model\Store;
  9. use Magento\Store\Model\StoreManagerInterface;
  10. use Magento\TestFramework\Helper\Bootstrap;
  11. class StoreManagerTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /**
  14. * @var StoreManagerInterface
  15. */
  16. private $storeManager;
  17. /**
  18. * @var ObjectManager
  19. */
  20. private $objectManager;
  21. /**
  22. * Class dependencies initialization
  23. *
  24. * @return void
  25. */
  26. protected function setUp()
  27. {
  28. $this->objectManager = Bootstrap::getObjectManager();
  29. $this->storeManager = $this->objectManager->get(StoreManagerInterface::class);
  30. }
  31. /**
  32. * Check that behavior of setting and getting store into StoreManager is correct
  33. * Setting: Magento\Store\Model\StoreManagerInterface::setCurrentStore
  34. * Getting: Magento\Store\Model\StoreManagerInterface::getStore
  35. *
  36. * @return void
  37. */
  38. public function testDefaultStoreIdIsSetCorrectly()
  39. {
  40. $this->storeManager->setCurrentStore(Store::DEFAULT_STORE_ID);
  41. $this->assertEquals(Store::DEFAULT_STORE_ID, $this->storeManager->getStore()->getId());
  42. }
  43. }