5
5
*/
6
6
7
7
/**
8
- * Tests for \Magento\Framework\Data\Form\Element\Textarea
8
+ * Tests for \Magento\Framework\Data\Form\Element\Editor
9
9
*/
10
10
namespace Magento \Framework \Data \Test \Unit \Form \Element ;
11
11
@@ -34,7 +34,7 @@ class EditorTest extends \PHPUnit_Framework_TestCase
34
34
protected $ escaperMock ;
35
35
36
36
/**
37
- * @var \Magento\Framework\Object
37
+ * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject
38
38
*/
39
39
protected $ formMock ;
40
40
@@ -43,8 +43,14 @@ class EditorTest extends \PHPUnit_Framework_TestCase
43
43
*/
44
44
protected $ configMock ;
45
45
46
+ /**
47
+ * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
48
+ */
49
+ protected $ objectManager ;
50
+
46
51
protected function setUp ()
47
52
{
53
+ $ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
48
54
$ this ->factoryMock = $ this ->getMock ('\Magento\Framework\Data\Form\Element\Factory ' , [], [], '' , false );
49
55
$ this ->collectionFactoryMock = $ this ->getMock (
50
56
'\Magento\Framework\Data\Form\Element\CollectionFactory ' ,
@@ -56,11 +62,14 @@ protected function setUp()
56
62
$ this ->escaperMock = $ this ->getMock ('\Magento\Framework\Escaper ' , [], [], '' , false );
57
63
$ this ->configMock = $ this ->getMock ('\Magento\Framework\Object ' , ['getData ' ], [], '' , false );
58
64
59
- $ this ->model = new Editor (
60
- $ this ->factoryMock ,
61
- $ this ->collectionFactoryMock ,
62
- $ this ->escaperMock ,
63
- ['config ' => $ this ->configMock ]
65
+ $ this ->model = $ this ->objectManager ->getObject (
66
+ 'Magento\Framework\Data\Form\Element\Editor ' ,
67
+ [
68
+ 'factoryElement ' => $ this ->factoryMock ,
69
+ 'factoryCollection ' => $ this ->collectionFactoryMock ,
70
+ 'escaper ' => $ this ->escaperMock ,
71
+ 'data ' => ['config ' => $ this ->configMock ]
72
+ ]
64
73
);
65
74
66
75
$ this ->formMock = $ this ->getMock (
@@ -83,11 +92,14 @@ public function testConstruct()
83
92
84
93
$ this ->configMock ->expects ($ this ->once ())->method ('getData ' )->with ('enabled ' )->willReturn (true );
85
94
86
- $ model = new Editor (
87
- $ this ->factoryMock ,
88
- $ this ->collectionFactoryMock ,
89
- $ this ->escaperMock ,
90
- ['config ' => $ this ->configMock ]
95
+ $ model = $ this ->objectManager ->getObject (
96
+ 'Magento\Framework\Data\Form\Element\Editor ' ,
97
+ [
98
+ 'factoryElement ' => $ this ->factoryMock ,
99
+ 'factoryCollection ' => $ this ->collectionFactoryMock ,
100
+ 'escaper ' => $ this ->escaperMock ,
101
+ 'data ' => ['config ' => $ this ->configMock ]
102
+ ]
91
103
);
92
104
93
105
$ this ->assertEquals ('wysiwyg ' , $ model ->getType ());
0 commit comments