Skip to content

Commit 0b806f9

Browse files
committed
Fixed the static tests & feedbacks
1 parent f075d4e commit 0b806f9

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

app/code/Magento/Catalog/Test/Unit/ViewModel/Product/Checker/AddToCompareAvailabilityTest.php

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,26 @@ class AddToCompareAvailabilityTest extends \PHPUnit\Framework\TestCase
2626
private $viewModel;
2727

2828
/**
29-
* @var StockConfigurationInterface|MockObject
29+
* @var StockConfigurationInterface|MockObject
3030
*/
31-
protected $stockConfiguration;
32-
33-
/**
34-
* @var ObjectManager
35-
*/
36-
private $objectManager;
31+
protected $stockConfigurationMock;
3732

3833
/**
3934
* @inheritdoc
4035
*/
4136
protected function setUp(): void
4237
{
4338

44-
$this->stockConfiguration =
39+
$objectManager = new ObjectManager($this);
40+
41+
$this->stockConfigurationMock =
4542
$this->getMockBuilder(StockConfigurationInterface::class)
4643
->getMock();
4744

48-
$this->viewModel = $this->getObjectManager()->getObject(
45+
$this->viewModel = $objectManager->getObject(
4946
AddToCompareAvailability::class,
5047
[
51-
'stockConfiguration' => $this->stockConfiguration
48+
'stockConfiguration' => $this->stockConfigurationMock
5249
]
5350
);
5451
}
@@ -81,7 +78,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh
8178
->method('getQuantityAndStockStatus')
8279
->willReturn($isInStock);
8380

84-
$this->stockConfiguration->expects($this->any())
81+
$this->stockConfigurationMock->expects($this->any())
8582
->method('isShowOutOfStock')
8683
->willReturn($isShowOutOfStock);
8784

@@ -90,7 +87,7 @@ public function testIsAvailableForCompare($status, $isSalable, $isInStock, $isSh
9087

9188
/**
9289
* Data provider for isAvailableForCompare()
93-
*
90+
*
9491
* @return array
9592
*/
9693
public function isAvailableForCompareDataProvider(): array
@@ -103,16 +100,4 @@ public function isAvailableForCompareDataProvider(): array
103100
[2, true, ['is_in_stock' => true], false]
104101
];
105102
}
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-
}
118103
}

0 commit comments

Comments
 (0)