File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed
lib/internal/Magento/Framework/Data/Test/Unit/Form/Element Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,12 @@ class AbstractElementTest extends \PHPUnit\Framework\TestCase
33
33
34
34
protected function setUp ()
35
35
{
36
+ $ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
36
37
$ this ->_factoryMock =
37
38
$ this ->createMock (\Magento \Framework \Data \Form \Element \Factory::class);
38
39
$ this ->_collectionFactoryMock =
39
40
$ this ->createMock (\Magento \Framework \Data \Form \Element \CollectionFactory::class);
40
- $ this ->_escaperMock = $ this -> createMock (\Magento \Framework \Escaper::class);
41
+ $ this ->_escaperMock = $ objectManager -> getObject (\Magento \Framework \Escaper::class);
41
42
42
43
$ this ->_model = $ this ->getMockForAbstractClass (
43
44
\Magento \Framework \Data \Form \Element \AbstractElement::class,
@@ -423,9 +424,6 @@ public function testGetHtmlContainerIdWithFieldContainerIdPrefix()
423
424
*/
424
425
public function testAddElementValues (array $ initialData , $ expectedValue )
425
426
{
426
- $ this ->_escaperMock ->expects ($ this ->any ())
427
- ->method ('escapeHtml ' )
428
- ->will ($ this ->returnArgument (0 ));
429
427
$ this ->_model ->setValues ($ initialData ['initial_values ' ]);
430
428
$ this ->_model ->addElementValues ($ initialData ['add_values ' ], $ initialData ['overwrite ' ]);
431
429
Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ class LinkTest extends \PHPUnit\Framework\TestCase
23
23
24
24
protected function setUp ()
25
25
{
26
+ $ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
26
27
$ factoryMock = $ this ->createMock (\Magento \Framework \Data \Form \Element \Factory::class);
27
28
$ collectionFactoryMock = $ this ->createMock (\Magento \Framework \Data \Form \Element \CollectionFactory::class);
28
- $ escaperMock = $ this -> createMock (\Magento \Framework \Escaper::class);
29
+ $ escaperMock = $ objectManager -> getObject (\Magento \Framework \Escaper::class);
29
30
$ this ->_link = new \Magento \Framework \Data \Form \Element \Link (
30
31
$ factoryMock ,
31
32
$ collectionFactoryMock ,
Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Framework \Data \Test \Unit \Form \Element ;
7
7
8
+ use Magento \Framework \Escaper ;
9
+
8
10
class MultiselectTest extends \PHPUnit \Framework \TestCase
9
11
{
10
12
/**
@@ -15,7 +17,13 @@ class MultiselectTest extends \PHPUnit\Framework\TestCase
15
17
protected function setUp ()
16
18
{
17
19
$ testHelper = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
18
- $ this ->_model = $ testHelper ->getObject (\Magento \Framework \Data \Form \Element \Editablemultiselect::class);
20
+ $ escaper = new Escaper ();
21
+ $ this ->_model = $ testHelper ->getObject (
22
+ \Magento \Framework \Data \Form \Element \Editablemultiselect::class,
23
+ [
24
+ '_escaper ' => $ escaper
25
+ ]
26
+ );
19
27
$ this ->_model ->setForm (new \Magento \Framework \DataObject ());
20
28
}
21
29
Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ class NoteTest extends \PHPUnit\Framework\TestCase
23
23
24
24
protected function setUp ()
25
25
{
26
+ $ objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
26
27
$ factoryMock = $ this ->createMock (\Magento \Framework \Data \Form \Element \Factory::class);
27
28
$ collectionFactoryMock = $ this ->createMock (\Magento \Framework \Data \Form \Element \CollectionFactory::class);
28
- $ escaperMock = $ this -> createMock (\Magento \Framework \Escaper::class);
29
+ $ escaperMock = $ objectManager -> getObject (\Magento \Framework \Escaper::class);
29
30
$ this ->_model = new \Magento \Framework \Data \Form \Element \Note (
30
31
$ factoryMock ,
31
32
$ collectionFactoryMock ,
You can’t perform that action at this time.
0 commit comments