ConfigTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Catalog\Model;
  7. use Magento\Catalog\Model\Config;
  8. use Magento\TestFramework\ObjectManager;
  9. use Magento\TestFramework\Helper\Bootstrap;
  10. use Magento\TestFramework\Helper\CacheCleaner;
  11. class ConfigTest extends \PHPUnit\Framework\TestCase
  12. {
  13. /**
  14. * @var Config
  15. */
  16. private $config;
  17. /**
  18. * @var ObjectManager
  19. */
  20. private $objectManager;
  21. protected function setUp()
  22. {
  23. $this->objectManager = Bootstrap::getObjectManager();
  24. $this->config = $this->objectManager->get(Config::class);
  25. }
  26. public function testGetEntityAttributeCodes()
  27. {
  28. $entityType = 'catalog_product';
  29. CacheCleaner::cleanAll();
  30. $this->assertEquals(
  31. $this->config->getEntityAttributeCodes($entityType),
  32. $this->config->getEntityAttributeCodes($entityType)
  33. );
  34. }
  35. public function testGetAttribute()
  36. {
  37. $entityType = 'catalog_product';
  38. $attributeCode = 'color';
  39. CacheCleaner::cleanAll();
  40. $this->assertEquals(
  41. $this->config->getAttribute($entityType, $attributeCode),
  42. $this->config->getAttribute($entityType, $attributeCode)
  43. );
  44. }
  45. public function testGetEntityType()
  46. {
  47. $entityType = 'catalog_product';
  48. CacheCleaner::cleanAll();
  49. $this->assertEquals(
  50. $this->config->getEntityType($entityType),
  51. $this->config->getEntityType($entityType)
  52. );
  53. }
  54. }