File tree Expand file tree Collapse file tree 2 files changed +53
-5
lines changed
app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Field Expand file tree Collapse file tree 2 files changed +53
-5
lines changed Original file line number Diff line number Diff line change 13
13
14
14
class FileTest extends \PHPUnit_Framework_TestCase
15
15
{
16
- /**
17
- * @var \PHPUnit_Framework_MockObject_MockObject
18
- */
19
- protected $ _objectManagerMock ;
20
-
21
16
/**
22
17
* @var \Magento\Config\Block\System\Config\Form\Field\File
23
18
*/
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2015 Magento. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ // @codingStandardsIgnoreFile
8
+
9
+ /**
10
+ * Tests for \Magento\Framework\Data\Form\Element\File
11
+ */
12
+ namespace Magento \Config \Test \Unit \Block \System \Config \Form \Field ;
13
+
14
+ class HeadingTest extends \PHPUnit_Framework_TestCase
15
+ {
16
+ /**
17
+ * @var \PHPUnit_Framework_MockObject_MockObject
18
+ */
19
+ protected $ _objectManagerMock ;
20
+
21
+ /**
22
+ * @var \Magento\Config\Block\System\Config\Form\Field\File
23
+ */
24
+ protected $ file ;
25
+
26
+ public function testRender ()
27
+ {
28
+ $ htmlId = 'test_HTML_id ' ;
29
+ $ label = 'test_label ' ;
30
+
31
+ $ elementMock = $ this ->getMockBuilder ('Magento\Framework\Data\Form\Element\AbstractElement ' )
32
+ ->disableOriginalConstructor ()
33
+ ->setMethods (['getHtmlId ' , 'getLabel ' ])
34
+ ->getMock ();
35
+ $ elementMock ->expects ($ this ->any ())->method ('getHtmlId ' )->willReturn ($ htmlId );
36
+ $ elementMock ->expects ($ this ->any ())->method ('getLabel ' )->willReturn ($ label );
37
+
38
+ $ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
39
+
40
+ $ heading = $ objectManager ->getObject ('\Magento\Config\Block\System\Config\Form\Field\Heading ' , []);
41
+
42
+ $ html = $ heading ->render ($ elementMock );
43
+
44
+ $ this ->assertEquals (
45
+ '<tr class="system-fieldset-sub-head" id="row_ ' . $ htmlId . '"> ' .
46
+ '<td colspan="5"> ' .
47
+ '<h4 id=" ' . $ htmlId . '"> ' . $ label . '</h4> ' .
48
+ '</td> ' .
49
+ '</tr> ' ,
50
+ $ html
51
+ );
52
+ }
53
+ }
You can’t perform that action at this time.
0 commit comments