7
7
8
8
class AbstractTest extends \PHPUnit_Framework_TestCase
9
9
{
10
- public function testGetArrayRows ()
10
+ /**
11
+ * @var \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
12
+ */
13
+ private $ model ;
14
+
15
+ protected function setUp ()
11
16
{
12
- /** @var $block \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray */
13
- $ block = $ this ->getMockForAbstractClass (
17
+ $ this ->model = $ this ->getMockForAbstractClass (
14
18
\Magento \Config \Block \System \Config \Form \Field \FieldArray \AbstractFieldArray::class,
15
19
[],
16
20
'' ,
@@ -19,12 +23,15 @@ public function testGetArrayRows()
19
23
true ,
20
24
['escapeHtml ' ]
21
25
);
22
- $ block -> expects ( $ this -> any ())-> method ( ' escapeHtml ' )-> will ( $ this -> returnArgument ( 0 ));
26
+ }
23
27
28
+ public function testGetArrayRows ()
29
+ {
30
+ $ this ->model ->expects ($ this ->any ())->method ('escapeHtml ' )->will ($ this ->returnArgument (0 ));
24
31
$ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
25
32
$ element = $ objectManager ->getObject (\Magento \Framework \Data \Form \Element \Multiselect::class);
26
33
$ element ->setValue ([['te<s>t ' => 't<e>st ' , 'data&1 ' => 'da&ta1 ' ]]);
27
- $ block ->setElement ($ element );
34
+ $ this -> model ->setElement ($ element );
28
35
$ this ->assertEquals (
29
36
[
30
37
new \Magento \Framework \DataObject (
@@ -36,7 +43,17 @@ public function testGetArrayRows()
36
43
]
37
44
),
38
45
],
39
- $ block ->getArrayRows ()
46
+ $ this -> model ->getArrayRows ()
40
47
);
41
48
}
49
+
50
+ public function testGetAddButtonLabel ()
51
+ {
52
+ $ contextMock = $ this ->getMockBuilder (\Magento \Backend \Block \Template \Context::class)
53
+ ->disableOriginalConstructor ()
54
+ ->getMock ();
55
+ $ this ->model ->__construct ($ contextMock );
56
+
57
+ $ this ->assertEquals ("Add " , $ this ->model ->getAddButtonLabel ());
58
+ }
42
59
}
0 commit comments