Skip to content

Commit 8d9aab5

Browse files
CE-33708: Fixed unit tests warnings
1 parent 13e0a2f commit 8d9aab5

File tree

2 files changed

+39
-13
lines changed

2 files changed

+39
-13
lines changed

app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use Magento\Catalog\Model\Indexer\Product\Price\Processor;
1111
use Magento\Customer\Api\Data\GroupExtensionInterface;
1212
use Magento\Customer\Api\Data\GroupInterface;
13-
use Magento\Customer\Api\GroupRepositoryInterface;
1413
use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface;
14+
use Magento\Customer\Api\GroupRepositoryInterface;
1515
use Magento\Customer\Model\Data\GroupExcludedWebsite;
1616
use Magento\Customer\Model\Data\GroupExcludedWebsiteFactory;
1717
use Magento\Customer\Model\Plugin\SaveCustomerGroupExcludedWebsite;
@@ -80,12 +80,15 @@ class SaveCustomerGroupExcludedWebsiteTest extends TestCase
8080
*/
8181
private $plugin;
8282

83+
/**
84+
* @inheritdoc
85+
*/
8386
protected function setUp(): void
8487
{
8588
$objectManagerHelper = new ObjectManager($this);
8689

8790
$this->groupExcludedWebsiteFactory = $this->getMockBuilder(GroupExcludedWebsiteFactory::class)
88-
->setMethods(['create'])
91+
->onlyMethods(['create'])
8992
->disableOriginalConstructor()
9093
->getMock();
9194
$this->groupExcludedWebsiteRepository = $this->getMockForAbstractClass(
@@ -130,6 +133,9 @@ protected function setUp(): void
130133
);
131134
}
132135

136+
/**
137+
* @return void
138+
*/
133139
public function testAfterSaveWithoutExtensionAttributes(): void
134140
{
135141
$this->groupExtensionInterface->method('getExcludeWebsiteIds')->willReturn(null);
@@ -139,11 +145,13 @@ public function testAfterSaveWithoutExtensionAttributes(): void
139145
}
140146

141147
/**
142-
* @dataProvider dataProviderNoExcludedWebsitesChanged
143148
* @param array $excludedWebsites
144149
* @param array $websitesToExclude
150+
*
151+
* @return void
145152
* @throws \Magento\Framework\Exception\CouldNotSaveException
146153
* @throws \Magento\Framework\Exception\LocalizedException
154+
* @dataProvider dataProviderNoExcludedWebsitesChanged
147155
*/
148156
public function testAfterSaveWithNoExcludedWebsitesChanged(array $excludedWebsites, array $websitesToExclude): void
149157
{
@@ -159,12 +167,14 @@ public function testAfterSaveWithNoExcludedWebsitesChanged(array $excludedWebsit
159167
}
160168

161169
/**
162-
* @dataProvider dataProviderExcludedWebsitesChanged
163170
* @param array $excludedWebsites
164171
* @param array $websitesToExclude
165172
* @param int $times
173+
*
174+
* @return void
166175
* @throws \Magento\Framework\Exception\CouldNotSaveException
167176
* @throws \Magento\Framework\Exception\LocalizedException
177+
* @dataProvider dataProviderExcludedWebsitesChanged
168178
*/
169179
public function testAfterSaveWithExcludedWebsitesChanged(
170180
array $excludedWebsites,
@@ -187,7 +197,7 @@ public function testAfterSaveWithExcludedWebsitesChanged(
187197
->method('setExcludedWebsiteId')->willReturnSelf();
188198
$this->groupExcludedWebsiteRepository->expects(self::exactly($times))
189199
->method('save')
190-
->willReturn($this->groupExcludedWebsiteResourceModel);
200+
->willReturn($this->groupExcludedWebsite);
191201

192202
$this->priceIndexProcessor->expects(self::once())->method('getIndexer')
193203
->willReturn($this->priceIndexer);
@@ -197,14 +207,17 @@ public function testAfterSaveWithExcludedWebsitesChanged(
197207
$this->plugin->afterSave($this->groupRepositoryInterface, $this->groupInterface, $this->groupInterface);
198208
}
199209

210+
/**
211+
* @return void
212+
*/
200213
private function getAllWebsites(): void
201214
{
202215
$websiteMock1 = $this->getMockBuilder(Website::class)
203-
->setMethods(['getWebsiteId'])
216+
->addMethods(['getWebsiteId'])
204217
->disableOriginalConstructor()
205218
->getMock();
206219
$websiteMock2 = $this->getMockBuilder(Website::class)
207-
->setMethods(['getWebsiteId'])
220+
->addMethods(['getWebsiteId'])
208221
->disableOriginalConstructor()
209222
->getMock();
210223
$this->store->expects(self::once())->method('getWebsiteCollection')

app/code/Magento/WeeeGraphQl/Test/Unit/Model/Resolver/FixedProductTaxResolverTest.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ protected function setUp(): void
109109
}
110110

111111
/**
112-
* Verifies that exception is thrown if model is not specified
112+
* Verifies that exception is thrown if model is not specified.
113+
*
114+
* @return void
113115
*/
114116
public function testShouldThrowException(): void
115117
{
@@ -124,14 +126,20 @@ public function testShouldThrowException(): void
124126
}
125127

126128
/**
127-
* Verifies that result is empty if FPT config is disabled
129+
* Verifies that result is empty if FPT config is disabled.
130+
*
131+
* @return void
128132
*/
129133
public function testShouldReturnEmptyResult(): void
130134
{
131135
$store = $this->createMock(StoreInterface::class);
132136
$cartItem = $this->createMock(CartItemInterface::class);
133-
$contextExtensionAttributes = $this->createMock(ContextExtensionInterface::class);
134-
$contextExtensionAttributes->method('getStore')
137+
$contextExtensionAttributes = $this->getMockBuilder(ContextExtensionInterface::class)
138+
->disableOriginalConstructor()
139+
->addMethods(['getStore'])
140+
->getMock();
141+
$contextExtensionAttributes
142+
->method('getStore')
135143
->willreturn($store);
136144
$this->context->method('getExtensionAttributes')
137145
->willReturn($contextExtensionAttributes);
@@ -155,15 +163,20 @@ public function testShouldReturnEmptyResult(): void
155163
}
156164

157165
/**
158-
* @dataProvider shouldReturnResultDataProvider
159166
* @param int $displayType
160167
* @param array $expected
168+
*
169+
* @return void
170+
* @dataProvider shouldReturnResultDataProvider
161171
*/
162172
public function testShouldReturnResult(int $displayType, array $expected): void
163173
{
164174
$store = $this->createMock(StoreInterface::class);
165175
$cartItem = $this->createMock(CartItemInterface::class);
166-
$contextExtensionAttributes = $this->createMock(ContextExtensionInterface::class);
176+
$contextExtensionAttributes = $this->getMockBuilder(ContextExtensionInterface::class)
177+
->disableOriginalConstructor()
178+
->addMethods(['getStore'])
179+
->getMock();
167180
$contextExtensionAttributes->method('getStore')
168181
->willreturn($store);
169182
$this->context->method('getExtensionAttributes')

0 commit comments

Comments
 (0)