Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SwitchPriceAttributeScopeOnConfigChangeTest.php
Go to the documentation of this file.
1 <?php
7 
10 
11 class SwitchPriceAttributeScopeOnConfigChangeTest extends \PHPUnit\Framework\TestCase
12 {
16  private $objectManager;
17 
18  public function setUp()
19  {
21  }
22 
28  {
29  foreach (['price', 'cost', 'special_price'] as $attributeCode) {
30  $attribute = $this->objectManager->get(\Magento\Eav\Model\Config::class)->getAttribute(
31  'catalog_product',
33  );
34  $this->assertTrue($attribute->isScopeGlobal());
35  }
36  }
37 
42  public function testPriceAttributeHasScopeWebsite()
43  {
45  $config = $this->objectManager->get(
46  ReinitableConfigInterface::class
47  );
48  $config->setValue(
52  );
53 
54  $eventManager = $this->objectManager->get(\Magento\Framework\Event\ManagerInterface::class);
55  $eventManager->dispatch(
56  "admin_system_config_changed_section_catalog",
57  ['website' => 0, 'store' => 0]
58  );
59  foreach (['price', 'cost', 'special_price'] as $attributeCode) {
60  $attribute = $this->objectManager->get(\Magento\Eav\Model\Config::class)->getAttribute(
61  'catalog_product',
63  );
64  $this->assertTrue($attribute->isScopeWebsite());
65  }
66  }
67 }
$config
Definition: fraud_order.php:17
$attributeCode
Definition: extend.phtml:12