7
7
8
8
use Magento \Paypal \Model \Config \Structure \Element \FieldPlugin as FieldConfigStructurePlugin ;
9
9
use Magento \Framework \TestFramework \Unit \Helper \ObjectManager as ObjectManagerHelper ;
10
- use Magento \Framework \App \RequestInterface ;
11
10
use Magento \Config \Model \Config \Structure \Element \Field as FieldConfigStructureMock ;
12
11
13
12
class FieldPluginTest extends \PHPUnit \Framework \TestCase
@@ -22,28 +21,20 @@ class FieldPluginTest extends \PHPUnit\Framework\TestCase
22
21
*/
23
22
private $ objectManagerHelper ;
24
23
25
- /**
26
- * @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject
27
- */
28
- private $ requestMock ;
29
-
30
24
/**
31
25
* @var FieldConfigStructureMock|\PHPUnit_Framework_MockObject_MockObject
32
26
*/
33
27
private $ subjectMock ;
34
28
35
29
protected function setUp ()
36
30
{
37
- $ this ->requestMock = $ this ->getMockBuilder (RequestInterface::class)
38
- ->getMockForAbstractClass ();
39
31
$ this ->subjectMock = $ this ->getMockBuilder (FieldConfigStructureMock::class)
40
32
->disableOriginalConstructor ()
41
33
->getMock ();
42
34
43
35
$ this ->objectManagerHelper = new ObjectManagerHelper ($ this );
44
36
$ this ->plugin = $ this ->objectManagerHelper ->getObject (
45
- FieldConfigStructurePlugin::class,
46
- ['request ' => $ this ->requestMock ]
37
+ FieldConfigStructurePlugin::class
47
38
);
48
39
}
49
40
@@ -56,10 +47,9 @@ public function testAroundGetConfigPathHasResult()
56
47
57
48
public function testAroundGetConfigPathNonPaymentSection ()
58
49
{
59
- $ this ->requestMock ->expects (static ::once ())
60
- ->method ('getParam ' )
61
- ->with ('section ' )
62
- ->willReturn ('non-payment ' );
50
+ $ this ->subjectMock ->expects ($ this ->once ())
51
+ ->method ('getPath ' )
52
+ ->willReturn ('non-payment/group/field ' );
63
53
64
54
$ this ->assertNull ($ this ->plugin ->afterGetConfigPath ($ this ->subjectMock , null ));
65
55
}
@@ -72,11 +62,7 @@ public function testAroundGetConfigPathNonPaymentSection()
72
62
*/
73
63
public function testAroundGetConfigPath ($ subjectPath , $ expectedConfigPath )
74
64
{
75
- $ this ->requestMock ->expects (static ::once ())
76
- ->method ('getParam ' )
77
- ->with ('section ' )
78
- ->willReturn ('payment ' );
79
- $ this ->subjectMock ->expects (static ::once ())
65
+ $ this ->subjectMock ->expects ($ this ->exactly (2 ))
80
66
->method ('getPath ' )
81
67
->willReturn ($ subjectPath );
82
68
0 commit comments