Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CompanyTest.php
Go to the documentation of this file.
1 <?php
7 
13 class CompanyTest extends \PHPUnit\Framework\TestCase
14 {
18  public function testToHtml()
19  {
22  \Magento\Customer\Block\Widget\Company::class
23  );
24 
25  $this->assertContains('title="Company"', $block->toHtml());
26  $this->assertNotContains('required', $block->toHtml());
27  }
28 
33  public function testToHtmlRequired()
34  {
37  \Magento\Customer\Model\Attribute::class
38  );
39  $model->loadByCode('customer_address', 'company')->setIsRequired(true);
40  $model->save();
41 
44  \Magento\Customer\Block\Widget\Company::class
45  );
46 
47  $this->assertContains('title="Company"', $block->toHtml());
48  $this->assertContains('required', $block->toHtml());
49  }
50 
51  protected function tearDown()
52  {
55  $eavConfig->clear();
56  }
57 }
$block
Definition: block.php:8