예제 #1
0
 public function testSettersGetters()
 {
     $setElementRenderer = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Element')->disableOriginalConstructor()->getMock();
     // note: this results in setting a static variable in the Form class
     $this->_form->setElementRenderer($setElementRenderer);
     $getElementRenderer = $this->_form->getElementRenderer();
     $this->assertSame($setElementRenderer, $getElementRenderer);
     // restore our Form to its earlier state
     $this->_form->setElementRenderer(null);
     $setFieldsetRenderer = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset')->disableOriginalConstructor()->getMock();
     $this->_form->setFieldsetRenderer($setFieldsetRenderer);
     $getFieldsetRenderer = $this->_form->getFieldsetRenderer();
     $this->assertSame($setFieldsetRenderer, $getFieldsetRenderer);
     $setFieldsetElementRenderer = $this->getMockBuilder('Magento\\Backend\\Block\\Widget\\Form\\Renderer\\Fieldset')->disableOriginalConstructor()->getMock();
     $this->_form->setFieldsetElementRenderer($setFieldsetElementRenderer);
     $getFieldsetElementRenderer = $this->_form->getFieldsetElementRenderer();
     $this->assertSame($setFieldsetElementRenderer, $getFieldsetElementRenderer);
     $this->assertSame($this->_form->getHtmlAttributes(), ['id', 'name', 'method', 'action', 'enctype', 'class', 'onsubmit', 'target']);
     $this->_form->setFieldContainerIdPrefix('abc');
     $this->assertSame($this->_form->getFieldContainerIdPrefix(), 'abc');
     $result = $this->_form->addSuffixToName('123', 'abc');
     $this->assertSame($result, 'abc[123]');
 }