6
6
7
7
use PHPUnit \Framework \TestCase ;
8
8
use Meta \BusinessExtension \Model \Api \CoreConfig ;
9
+ use Magento \Framework \TestFramework \Unit \Helper \ObjectManager ;
9
10
10
11
class CoreConfigTest extends TestCase
11
12
{
@@ -23,9 +24,13 @@ protected function setup(): void
23
24
{
24
25
parent ::setup ();
25
26
26
- $ this ->metaCoreConfig = $ this ->getMockBuilder (CoreConfig::class)
27
- ->disableOriginalConstructor ()
28
- ->getMock ();
27
+ $ objectManager = new ObjectManager ($ this );
28
+ $ this ->metaCoreConfig = $ objectManager ->getObject (
29
+ CoreConfig::class,
30
+ [
31
+ 'data ' => []
32
+ ]
33
+ );
29
34
}
30
35
31
36
/**
@@ -34,26 +39,10 @@ protected function setup(): void
34
39
* @return void
35
40
*/
36
41
public function testGetExternalBusinessId (): void
37
- {
38
- $ this ->metaCoreConfig ->method ('getExternalBusinessId ' )
39
- ->willReturn ('' );
40
-
41
- $ this ->assertEmpty ($ this ->metaCoreConfig ->getExternalBusinessId ());
42
- }
43
-
44
- /**
45
- * Validate if the external business ID is set
46
- *
47
- * @return void
48
- */
49
- public function testSetExternalBusinessId (): void
50
- {
42
+ {
51
43
$ businessId = 'ZmJfaWRfMQ== ' ;
52
44
$ this ->metaCoreConfig ->setExternalBusinessId ($ businessId );
53
- $ this ->metaCoreConfig ->method ('getExternalBusinessId ' )
54
- ->willReturn ($ businessId );
55
-
56
- $ this ->assertSame ($ businessId , $ this ->metaCoreConfig ->getExternalBusinessId ());
45
+ $ this ->assertEquals ($ businessId , $ this ->metaCoreConfig ->getExternalBusinessId ());
57
46
}
58
47
59
48
/**
@@ -65,9 +54,6 @@ public function testSetIsOrderSyncEnabled(): void
65
54
{
66
55
$ isOrderSyncEnabled = true ;
67
56
$ this ->metaCoreConfig ->setIsOrderSyncEnabled ($ isOrderSyncEnabled );
68
-
69
- $ this ->metaCoreConfig ->method ('isOrderSyncEnabled ' )
70
- ->willReturn ($ isOrderSyncEnabled );
71
57
72
58
$ this ->assertSame ($ isOrderSyncEnabled , $ this ->metaCoreConfig ->isOrderSyncEnabled ());
73
59
}
@@ -81,9 +67,6 @@ public function testSetIsCatalogSyncEnabled(): void
81
67
{
82
68
$ isCatalogSyncEnabled = true ;
83
69
$ this ->metaCoreConfig ->setIsCatalogSyncEnabled ($ isCatalogSyncEnabled );
84
-
85
- $ this ->metaCoreConfig ->method ('isCatalogSyncEnabled ' )
86
- ->willReturn ($ isCatalogSyncEnabled );
87
70
88
71
$ this ->assertSame ($ isCatalogSyncEnabled , $ this ->metaCoreConfig ->isCatalogSyncEnabled ());
89
72
}
@@ -97,9 +80,6 @@ public function testSetIsPromotionsSyncEnabled(): void
97
80
{
98
81
$ isPromotionsSyncEnabled = true ;
99
82
$ this ->metaCoreConfig ->setIsPromotionsSyncEnabled ($ isPromotionsSyncEnabled );
100
-
101
- $ this ->metaCoreConfig ->method ('isPromotionsSyncEnabled ' )
102
- ->willReturn ($ isPromotionsSyncEnabled );
103
83
104
84
$ this ->assertSame ($ isPromotionsSyncEnabled , $ this ->metaCoreConfig ->isPromotionsSyncEnabled ());
105
85
}
@@ -113,9 +93,6 @@ public function testSetIsActiveExtension(): void
113
93
{
114
94
$ isActiveExtension = true ;
115
95
$ this ->metaCoreConfig ->setIsActiveExtension ($ isActiveExtension );
116
-
117
- $ this ->metaCoreConfig ->method ('isActiveExtension ' )
118
- ->willReturn ($ isActiveExtension );
119
96
120
97
$ this ->assertSame ($ isActiveExtension , $ this ->metaCoreConfig ->isActiveExtension ());
121
98
}
@@ -129,9 +106,6 @@ public function testSetProductIdentifierAttr(): void
129
106
{
130
107
$ productIdentifierAttr = 'sku ' ;
131
108
$ this ->metaCoreConfig ->setProductIdentifierAttr ($ productIdentifierAttr );
132
-
133
- $ this ->metaCoreConfig ->method ('getProductIdentifierAttr ' )
134
- ->willReturn ($ productIdentifierAttr );
135
109
136
110
$ this ->assertSame ($ productIdentifierAttr , $ this ->metaCoreConfig ->getProductIdentifierAttr ());
137
111
}
@@ -145,9 +119,6 @@ public function testSetOutOfStockThreshold(): void
145
119
{
146
120
$ outOfStockThreshold = '10 ' ;
147
121
$ this ->metaCoreConfig ->setOutOfStockThreshold ($ outOfStockThreshold );
148
-
149
- $ this ->metaCoreConfig ->method ('getOutOfStockThreshold ' )
150
- ->willReturn ($ outOfStockThreshold );
151
122
152
123
$ this ->assertSame ($ outOfStockThreshold , $ this ->metaCoreConfig ->getOutOfStockThreshold ());
153
124
}
@@ -161,9 +132,6 @@ public function testSetFeedId(): void
161
132
{
162
133
$ feedId = 'feed-id ' ;
163
134
$ this ->metaCoreConfig ->setFeedId ($ feedId );
164
-
165
- $ this ->metaCoreConfig ->method ('getFeedId ' )
166
- ->willReturn ($ feedId );
167
135
168
136
$ this ->assertSame ($ feedId , $ this ->metaCoreConfig ->getFeedId ());
169
137
}
@@ -177,9 +145,6 @@ public function testSetInstalledMetaExtensionVersion(): void
177
145
{
178
146
$ version = '1.0.0 ' ;
179
147
$ this ->metaCoreConfig ->setInstalledMetaExtensionVersion ($ version );
180
-
181
- $ this ->metaCoreConfig ->method ('getInstalledMetaExtensionVersion ' )
182
- ->willReturn ($ version );
183
148
184
149
$ this ->assertSame ($ version , $ this ->metaCoreConfig ->getInstalledMetaExtensionVersion ());
185
150
}
@@ -193,9 +158,6 @@ public function testSetGraphApiVersion(): void
193
158
{
194
159
$ graphApiVersion = 'v1.0 ' ;
195
160
$ this ->metaCoreConfig ->setGraphApiVersion ($ graphApiVersion );
196
-
197
- $ this ->metaCoreConfig ->method ('getGraphApiVersion ' )
198
- ->willReturn ($ graphApiVersion );
199
161
200
162
$ this ->assertSame ($ graphApiVersion , $ this ->metaCoreConfig ->getGraphApiVersion ());
201
163
}
@@ -209,9 +171,6 @@ public function testSetMagentoVersion(): void
209
171
{
210
172
$ magentoVersion = '2.4.5 ' ;
211
173
$ this ->metaCoreConfig ->setMagentoVersion ($ magentoVersion );
212
-
213
- $ this ->metaCoreConfig ->method ('getMagentoVersion ' )
214
- ->willReturn ($ magentoVersion );
215
174
216
175
$ this ->assertSame ($ magentoVersion , $ this ->metaCoreConfig ->getMagentoVersion ());
217
176
}
0 commit comments