@@ -26,29 +26,26 @@ class AddToCompareAvailabilityTest extends \PHPUnit\Framework\TestCase
26
26
private $ viewModel ;
27
27
28
28
/**
29
- * @var StockConfigurationInterface|MockObject
29
+ * @var StockConfigurationInterface|MockObject
30
30
*/
31
- protected $ stockConfiguration ;
32
-
33
- /**
34
- * @var ObjectManager
35
- */
36
- private $ objectManager ;
31
+ protected $ stockConfigurationMock ;
37
32
38
33
/**
39
34
* @inheritdoc
40
35
*/
41
36
protected function setUp (): void
42
37
{
43
38
44
- $ this ->stockConfiguration =
39
+ $ objectManager = new ObjectManager ($ this );
40
+
41
+ $ this ->stockConfigurationMock =
45
42
$ this ->getMockBuilder (StockConfigurationInterface::class)
46
43
->getMock ();
47
44
48
- $ this ->viewModel = $ this -> getObjectManager () ->getObject (
45
+ $ this ->viewModel = $ objectManager ->getObject (
49
46
AddToCompareAvailability::class,
50
47
[
51
- 'stockConfiguration ' => $ this ->stockConfiguration
48
+ 'stockConfiguration ' => $ this ->stockConfigurationMock
52
49
]
53
50
);
54
51
}
@@ -81,7 +78,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh
81
78
->method ('getQuantityAndStockStatus ' )
82
79
->willReturn ($ isInStock );
83
80
84
- $ this ->stockConfiguration ->expects ($ this ->any ())
81
+ $ this ->stockConfigurationMock ->expects ($ this ->any ())
85
82
->method ('isShowOutOfStock ' )
86
83
->willReturn ($ isShowOutOfStock );
87
84
@@ -90,7 +87,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh
90
87
91
88
/**
92
89
* Data provider for isAvailableForCompare()
93
- *
90
+ *
94
91
* @return array
95
92
*/
96
93
public function isAvailableForCompareDataProvider (): array
@@ -103,16 +100,4 @@ public function isAvailableForCompareDataProvider(): array
103
100
[2 , true , ['is_in_stock ' => true ], false ]
104
101
];
105
102
}
106
-
107
- /**
108
- * @return ObjectManager
109
- */
110
- private function getObjectManager (): ObjectManager
111
- {
112
- if (null === $ this ->objectManager ) {
113
- $ this ->objectManager = new ObjectManager ($ this );
114
- }
115
-
116
- return $ this ->objectManager ;
117
- }
118
103
}
0 commit comments