@@ -19,22 +19,22 @@ class CopierTest extends \PHPUnit\Framework\TestCase
1919 /**
2020 * @var \PHPUnit_Framework_MockObject_MockObject
2121 */
22- protected $ optionRepositoryMock ;
22+ private $ optionRepositoryMock ;
2323
2424 /**
2525 * @var Copier
2626 */
27- protected $ _model ;
27+ private $ _model ;
2828
2929 /**
3030 * @var \PHPUnit_Framework_MockObject_MockObject
3131 */
32- protected $ copyConstructorMock ;
32+ private $ copyConstructorMock ;
3333
3434 /**
3535 * @var \PHPUnit_Framework_MockObject_MockObject
3636 */
37- protected $ productFactoryMock ;
37+ private $ productFactoryMock ;
3838
3939 /**
4040 * @var \PHPUnit_Framework_MockObject_MockObject
@@ -44,12 +44,12 @@ class CopierTest extends \PHPUnit\Framework\TestCase
4444 /**
4545 * @var \PHPUnit_Framework_MockObject_MockObject
4646 */
47- protected $ productMock ;
47+ private $ productMock ;
4848
4949 /**
5050 * @var \PHPUnit_Framework_MockObject_MockObject
5151 */
52- protected $ metadata ;
52+ private $ metadata ;
5353
5454 protected function setUp ()
5555 {
@@ -77,13 +77,10 @@ protected function setUp()
7777 $ this ->_model = new Copier (
7878 $ this ->copyConstructorMock ,
7979 $ this ->productFactoryMock ,
80- $ this ->scopeOverriddenValueMock
80+ $ this ->scopeOverriddenValueMock ,
81+ $ this ->optionRepositoryMock ,
82+ $ metadataPool
8183 );
82-
83- $ this ->setProperties ($ this ->_model , [
84- 'optionRepository ' => $ this ->optionRepositoryMock ,
85- 'metadataPool ' => $ metadataPool
86- ]);
8784 }
8885
8986 /**
@@ -340,20 +337,4 @@ public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl()
340337 $ this ->expectException (\Magento \UrlRewrite \Model \Exception \UrlAlreadyExistsException::class);
341338 $ this ->_model ->copy ($ this ->productMock );
342339 }
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- }
359340}
0 commit comments