@@ -33,119 +33,119 @@ class DynamicStorageTest extends TestCase
33
33
/**
34
34
* @var UrlRewriteFactory|MockObject
35
35
*/
36
- private $ urlRewriteFactory ;
36
+ private $ urlRewriteFactoryMock ;
37
37
38
38
/**
39
39
* @var DataObjectHelper|MockObject
40
40
*/
41
- private $ dataObjectHelper ;
41
+ private $ dataObjectHelperMock ;
42
42
43
43
/**
44
44
* @var AdapterInterface|MockObject
45
45
*/
46
- private $ connection ;
46
+ private $ connectionMock ;
47
47
48
48
/**
49
49
* @var Select|MockObject
50
50
*/
51
- private $ select ;
51
+ private $ selectMock ;
52
52
53
53
/**
54
54
* @var ResourceConnection|MockObject
55
55
*/
56
- private $ resourceConnection ;
56
+ private $ resourceConnectionMock ;
57
57
58
58
/**
59
59
* @var ScopeConfigInterface|MockObject
60
60
*/
61
- private $ scopeConfig ;
61
+ private $ scopeConfigMock ;
62
62
63
63
/**
64
64
* @var Product|MockObject
65
65
*/
66
- private $ productResource ;
66
+ private $ productResourceMock ;
67
67
68
68
/**
69
69
* @var ProductFactory|MockObject
70
70
*/
71
- private $ productFactory ;
71
+ private $ productFactoryMock ;
72
72
73
73
/**
74
74
* @inheritdoc
75
75
*/
76
76
protected function setUp (): void
77
77
{
78
- $ this ->urlRewriteFactory = $ this ->getMockBuilder (UrlRewriteFactory::class)
78
+ $ this ->urlRewriteFactoryMock = $ this ->getMockBuilder (UrlRewriteFactory::class)
79
79
->disableOriginalConstructor ()
80
80
->getMock ();
81
81
82
- $ this ->dataObjectHelper = $ this ->getMockBuilder (DataObjectHelper::class)
82
+ $ this ->dataObjectHelperMock = $ this ->getMockBuilder (DataObjectHelper::class)
83
83
->disableOriginalConstructor ()
84
84
->getMock ();
85
85
86
- $ this ->connection = $ this ->getMockBuilder (AdapterInterface::class)
86
+ $ this ->connectionMock = $ this ->getMockBuilder (AdapterInterface::class)
87
87
->disableOriginalConstructor ()
88
88
->getMock ();
89
89
90
- $ this ->select = $ this ->getMockBuilder (Select::class)
90
+ $ this ->selectMock = $ this ->getMockBuilder (Select::class)
91
91
->disableOriginalConstructor ()
92
92
->getMock ();
93
93
94
- $ this ->resourceConnection = $ this ->getMockBuilder (ResourceConnection::class)
94
+ $ this ->resourceConnectionMock = $ this ->getMockBuilder (ResourceConnection::class)
95
95
->disableOriginalConstructor ()
96
96
->getMock ();
97
97
98
- $ this ->connection
98
+ $ this ->connectionMock
99
99
->method ('select ' )
100
- ->willReturn ($ this ->select );
100
+ ->willReturn ($ this ->selectMock );
101
101
102
- $ this ->resourceConnection
102
+ $ this ->resourceConnectionMock
103
103
->method ('getConnection ' )
104
- ->willReturn ($ this ->connection );
104
+ ->willReturn ($ this ->connectionMock );
105
105
106
- $ this ->scopeConfig = $ this ->getMockBuilder (ScopeConfigInterface::class)
106
+ $ this ->scopeConfigMock = $ this ->getMockBuilder (ScopeConfigInterface::class)
107
107
->getMock ();
108
108
109
- $ this ->productResource = $ this ->getMockBuilder (Product::class)
109
+ $ this ->productResourceMock = $ this ->getMockBuilder (Product::class)
110
110
->disableOriginalConstructor ()
111
111
->getMock ();
112
112
113
- $ this ->productFactory = $ this ->getMockBuilder (ProductFactory::class)
113
+ $ this ->productFactoryMock = $ this ->getMockBuilder (ProductFactory::class)
114
114
->disableOriginalConstructor ()
115
115
->getMock ();
116
116
117
- $ this ->productFactory
117
+ $ this ->productFactoryMock
118
118
->method ('create ' )
119
- ->willReturn ($ this ->productResource );
119
+ ->willReturn ($ this ->productResourceMock );
120
120
121
121
$ this ->object = new DynamicStorage (
122
- $ this ->urlRewriteFactory ,
123
- $ this ->dataObjectHelper ,
124
- $ this ->resourceConnection ,
125
- $ this ->scopeConfig ,
126
- $ this ->productFactory
122
+ $ this ->urlRewriteFactoryMock ,
123
+ $ this ->dataObjectHelperMock ,
124
+ $ this ->resourceConnectionMock ,
125
+ $ this ->scopeConfigMock ,
126
+ $ this ->productFactoryMock
127
127
);
128
128
}
129
129
130
130
/**
131
- * @param $data
132
- * @param $productFromDb
133
- * @param $categorySuffix
134
- * @param $categoryFromDb
135
- * @param $canBeShownInCategory
136
- * @param $expectedProductRewrite
137
- * @throws \ReflectionException
138
131
* @dataProvider findProductRewriteByRequestPathDataProvider
132
+ * @param array $data
133
+ * @param array|false $productFromDb
134
+ * @param string $categorySuffix
135
+ * @param array|false $categoryFromDb
136
+ * @param bool $canBeShownInCategory
137
+ * @param array|null $expectedProductRewrite
138
+ * @throws \ReflectionException
139
139
*/
140
140
public function testFindProductRewriteByRequestPath (
141
- $ data ,
141
+ array $ data ,
142
142
$ productFromDb ,
143
- $ categorySuffix ,
143
+ string $ categorySuffix ,
144
144
$ categoryFromDb ,
145
- $ canBeShownInCategory ,
146
- $ expectedProductRewrite
147
- ) {
148
- $ this ->connection ->expects ($ this ->any ())
145
+ bool $ canBeShownInCategory ,
146
+ ? array $ expectedProductRewrite
147
+ ): void {
148
+ $ this ->connectionMock ->expects ($ this ->any ())
149
149
->method ('fetchRow ' )
150
150
->will ($ this ->onConsecutiveCalls ($ productFromDb , $ categoryFromDb ));
151
151
@@ -158,11 +158,11 @@ public function testFindProductRewriteByRequestPath(
158
158
]
159
159
];
160
160
161
- $ this ->scopeConfig
161
+ $ this ->scopeConfigMock
162
162
->method ('getValue ' )
163
163
->willReturnMap ($ scopeConfigMap );
164
164
165
- $ this ->productResource
165
+ $ this ->productResourceMock
166
166
->method ('canBeShowInCategory ' )
167
167
->willReturn ($ canBeShownInCategory );
168
168
@@ -185,9 +185,9 @@ public function findProductRewriteByRequestPathDataProvider(): array
185
185
'store_id ' => 1
186
186
],
187
187
false ,
188
+ '' ,
188
189
null ,
189
- null ,
190
- null ,
190
+ true ,
191
191
null
192
192
],
193
193
[
@@ -205,7 +205,7 @@ public function findProductRewriteByRequestPathDataProvider(): array
205
205
],
206
206
'.html ' ,
207
207
false ,
208
- null ,
208
+ true ,
209
209
null
210
210
],
211
211
[
0 commit comments