Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FrontTest.php
Go to the documentation of this file.
1 <?php
7 
11 class FrontTest extends \PHPUnit\Framework\TestCase
12 {
16  private $block;
17 
21  private $objectManager;
22 
23  protected function setUp()
24  {
26 
28  $layout = $this->objectManager->create(\Magento\Framework\View\LayoutInterface::class);
29  $this->block = $layout->createBlock(\Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit\Tab\Front::class);
30  }
31 
36  public function testToHtml($attributeCode)
37  {
39  $model = $this->objectManager->create(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class);
40  $model->loadByCode(\Magento\Catalog\Model\Product::ENTITY, $attributeCode);
41 
43  $coreRegistry = $this->objectManager->get(\Magento\Framework\Registry::class);
44  $coreRegistry->unregister('entity_attribute');
45  $coreRegistry->register('entity_attribute', $model);
46 
47  $this->assertRegExp('/<select\sid="is_searchable".*disabled="disabled"/', $this->block->toHtml());
48  }
49 
53  public function toHtmlDataProvider()
54  {
55  return [
56  ['visibility'],
57  ['url_key'],
58  ['status'],
59  ['price_type'],
60  ['category_ids'],
61  ['media_gallery'],
62  ['country_of_manufacture'],
63  ];
64  }
65 }
$attributeCode
Definition: extend.phtml:12