@@ -35,17 +35,7 @@ class FBEHelperTest extends TestCase
35
35
/**
36
36
* @var FBEHelper
37
37
*/
38
- private $ fbeHelper ;
39
-
40
- /**
41
- * @var MockObject
42
- */
43
- private $ systemConfig ;
44
-
45
- /**
46
- * @var MockObject
47
- */
48
- private $ context ;
38
+ private FBEHelper $ fbeHelper ;
49
39
50
40
/**
51
41
* @var MockObject
@@ -55,27 +45,12 @@ class FBEHelperTest extends TestCase
55
45
/**
56
46
* @var MockObject
57
47
*/
58
- private $ logger ;
59
-
60
- /**
61
- * @var MockObject
62
- */
63
- private $ storeManager ;
64
-
65
- /**
66
- * @var MockObject
67
- */
68
- private $ curl ;
69
-
70
- /**
71
- * @var MockObject
72
- */
73
- private $ resourceConnection ;
48
+ private $ moduleList ;
74
49
75
50
/**
76
- * @var MockObject
51
+ * @var ProductMetadataInterface| MockObject
77
52
*/
78
- private $ moduleList ;
53
+ private $ productMetaData ;
79
54
80
55
/**
81
56
* Used to reset or change values after running a test
@@ -93,23 +68,25 @@ public function tearDown(): void
93
68
*/
94
69
public function setUp (): void
95
70
{
96
- $ this -> context = $ this ->createMock (Context::class);
71
+ $ context = $ this ->createMock (Context::class);
97
72
$ this ->objectManagerInterface = $ this ->createMock (ObjectManagerInterface::class);
98
- $ this -> logger = $ this ->createMock (Logger::class);
99
- $ this -> storeManager = $ this ->createMock (StoreManagerInterface::class);
100
- $ this -> curl = $ this ->createMock (Curl::class);
101
- $ this -> resourceConnection = $ this ->createMock (ResourceConnection::class);
73
+ $ logger = $ this ->createMock (Logger::class);
74
+ $ storeManager = $ this ->createMock (StoreManagerInterface::class);
75
+ $ curl = $ this ->createMock (Curl::class);
76
+ $ resourceConnection = $ this ->createMock (ResourceConnection::class);
102
77
$ this ->moduleList = $ this ->createMock (ModuleListInterface::class);
103
- $ this ->systemConfig = $ this ->createMock (Config::class);
78
+ $ systemConfig = $ this ->createMock (Config::class);
79
+ $ this ->productMetaData = $ this ->createMock (ProductMetadataInterface::class);
104
80
$ this ->fbeHelper = new FBEHelper (
105
- $ this -> context ,
81
+ $ context ,
106
82
$ this ->objectManagerInterface ,
107
- $ this -> logger ,
108
- $ this -> storeManager ,
109
- $ this -> curl ,
110
- $ this -> resourceConnection ,
83
+ $ logger ,
84
+ $ storeManager ,
85
+ $ curl ,
86
+ $ resourceConnection ,
111
87
$ this ->moduleList ,
112
- $ this ->systemConfig
88
+ $ systemConfig ,
89
+ $ this ->productMetaData
113
90
);
114
91
}
115
92
@@ -132,8 +109,7 @@ public function testCorrectPartnerAgent()
132
109
->disableOriginalConstructor ()
133
110
->setMethods (['getVersion ' , 'getEdition ' , 'getName ' ])
134
111
->getMock ();
135
- $ productMetadata ->method ('getVersion ' )->willReturn ($ magentoVersion );
136
- $ productMetadata ->method ('getVersion ' )->willReturn ($ magentoVersion );
112
+ $ this ->productMetaData ->expects ($ this ->once ())->method ('getVersion ' )->willReturn ($ magentoVersion );
137
113
$ this ->objectManagerInterface ->method ('get ' )->willReturn ($ productMetadata );
138
114
$ this ->assertEquals (
139
115
sprintf ('%s-%s-%s ' , $ source , $ magentoVersion , $ pluginVersion ),
0 commit comments