@@ -19,22 +19,22 @@ class CopierTest extends \PHPUnit\Framework\TestCase
19
19
/**
20
20
* @var \PHPUnit_Framework_MockObject_MockObject
21
21
*/
22
- protected $ optionRepositoryMock ;
22
+ private $ optionRepositoryMock ;
23
23
24
24
/**
25
25
* @var Copier
26
26
*/
27
- protected $ _model ;
27
+ private $ _model ;
28
28
29
29
/**
30
30
* @var \PHPUnit_Framework_MockObject_MockObject
31
31
*/
32
- protected $ copyConstructorMock ;
32
+ private $ copyConstructorMock ;
33
33
34
34
/**
35
35
* @var \PHPUnit_Framework_MockObject_MockObject
36
36
*/
37
- protected $ productFactoryMock ;
37
+ private $ productFactoryMock ;
38
38
39
39
/**
40
40
* @var \PHPUnit_Framework_MockObject_MockObject
@@ -44,12 +44,12 @@ class CopierTest extends \PHPUnit\Framework\TestCase
44
44
/**
45
45
* @var \PHPUnit_Framework_MockObject_MockObject
46
46
*/
47
- protected $ productMock ;
47
+ private $ productMock ;
48
48
49
49
/**
50
50
* @var \PHPUnit_Framework_MockObject_MockObject
51
51
*/
52
- protected $ metadata ;
52
+ private $ metadata ;
53
53
54
54
protected function setUp ()
55
55
{
@@ -77,13 +77,10 @@ protected function setUp()
77
77
$ this ->_model = new Copier (
78
78
$ this ->copyConstructorMock ,
79
79
$ this ->productFactoryMock ,
80
- $ this ->scopeOverriddenValueMock
80
+ $ this ->scopeOverriddenValueMock ,
81
+ $ this ->optionRepositoryMock ,
82
+ $ metadataPool
81
83
);
82
-
83
- $ this ->setProperties ($ this ->_model , [
84
- 'optionRepository ' => $ this ->optionRepositoryMock ,
85
- 'metadataPool ' => $ metadataPool
86
- ]);
87
84
}
88
85
89
86
/**
@@ -340,20 +337,4 @@ public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl()
340
337
$ this ->expectException (\Magento \UrlRewrite \Model \Exception \UrlAlreadyExistsException::class);
341
338
$ this ->_model ->copy ($ this ->productMock );
342
339
}
343
-
344
- /**
345
- * @param $object
346
- * @param array $properties
347
- */
348
- private function setProperties ($ object , $ properties = [])
349
- {
350
- $ reflectionClass = new \ReflectionClass (get_class ($ object ));
351
- foreach ($ properties as $ key => $ value ) {
352
- if ($ reflectionClass ->hasProperty ($ key )) {
353
- $ reflectionProperty = $ reflectionClass ->getProperty ($ key );
354
- $ reflectionProperty ->setAccessible (true );
355
- $ reflectionProperty ->setValue ($ object , $ value );
356
- }
357
- }
358
- }
359
340
}
0 commit comments