Skip to content

Commit 1662910

Browse files
committed
MC-37364: Unit Test and JSUnit Test fails to start on Magento composer 2.4.0. Revert integration tests suites. Add correct exception class to unit tests.
1 parent a8256b2 commit 1662910

File tree

15 files changed

+31
-19
lines changed

15 files changed

+31
-19
lines changed

app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Magento\Quote\Model\ShippingAssignmentFactory;
3333
use Magento\Quote\Model\ShippingFactory;
3434
use PHPUnit\Framework\MockObject\MockObject;
35+
use PHPUnit\Framework\MockObject\RuntimeException;
3536
use PHPUnit\Framework\TestCase;
3637

3738
/**
@@ -631,7 +632,7 @@ private function getCartExtensionMock(): MockObject
631632
$mockBuilder = $this->getMockBuilder(CartExtension::class);
632633
try {
633634
$mockBuilder->addMethods(['getShippingAssignments', 'setShippingAssignments']);
634-
} catch (\RuntimeException $e) {
635+
} catch (RuntimeException $e) {
635636
// CartExtension already generated.
636637
}
637638

app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/GuestValidationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Quote\Api\Data\PaymentInterface;
2121
use Magento\Store\Model\ScopeInterface;
2222
use PHPUnit\Framework\MockObject\MockObject;
23+
use PHPUnit\Framework\MockObject\RuntimeException;
2324
use PHPUnit\Framework\TestCase;
2425

2526
/**
@@ -174,7 +175,7 @@ private function getPaymentExtension(): MockObject
174175
$mockBuilder = $this->getMockBuilder(PaymentExtension::class);
175176
try {
176177
$mockBuilder->addMethods(['getAgreementIds']);
177-
} catch (\RuntimeException $e) {
178+
} catch (RuntimeException $e) {
178179
// Payment extension already generated.
179180
}
180181

app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Magento\Quote\Model\Quote;
2323
use Magento\Store\Model\ScopeInterface;
2424
use PHPUnit\Framework\MockObject\MockObject;
25+
use PHPUnit\Framework\MockObject\RuntimeException;
2526
use PHPUnit\Framework\TestCase;
2627

2728
/**
@@ -241,7 +242,7 @@ private function getPaymentExtension(): MockObject
241242
$mockBuilder = $this->getMockBuilder(PaymentExtension::class);
242243
try {
243244
$mockBuilder->addMethods(['getAgreementIds']);
244-
} catch (\RuntimeException $e) {
245+
} catch (RuntimeException $e) {
245246
// Payment extension already generated.
246247
}
247248

app/code/Magento/Downloadable/Test/Unit/Model/Link/UpdateHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Downloadable\Model\Link\UpdateHandler;
1616
use Magento\Downloadable\Model\Product\Type;
1717
use PHPUnit\Framework\MockObject\MockObject;
18+
use PHPUnit\Framework\MockObject\RuntimeException;
1819
use PHPUnit\Framework\TestCase;
1920

2021
/**
@@ -157,7 +158,7 @@ private function getProductExtensionMock(): MockObject
157158
->disableOriginalConstructor();
158159
try {
159160
$mockBuilder->addMethods(['getDownloadableProductLinks']);
160-
} catch (\RuntimeException $e) {
161+
} catch (RuntimeException $e) {
161162
// ProductExtension already generated.
162163
}
163164

app/code/Magento/Downloadable/Test/Unit/Model/Quote/Item/CartItemProcessorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\Quote\Model\Quote\Item;
2222
use Magento\Quote\Model\Quote\ProductOptionFactory;
2323
use PHPUnit\Framework\MockObject\MockObject;
24+
use PHPUnit\Framework\MockObject\RuntimeException;
2425
use PHPUnit\Framework\TestCase;
2526

2627
/**
@@ -250,7 +251,7 @@ private function getProductOptionExtensionMock(): MockObject
250251
$mockBuilder = $this->getMockBuilder(ProductOptionExtension::class);
251252
try {
252253
$mockBuilder->addMethods(['setDownloadableOption']);
253-
} catch (\RuntimeException $e) {
254+
} catch (RuntimeException $e) {
254255
// ProductOptionExtension already generated.
255256
}
256257

app/code/Magento/Downloadable/Test/Unit/Model/Sample/UpdateHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Downloadable\Model\Product\Type;
1616
use Magento\Downloadable\Model\Sample\UpdateHandler;
1717
use PHPUnit\Framework\MockObject\MockObject;
18+
use PHPUnit\Framework\MockObject\RuntimeException;
1819
use PHPUnit\Framework\TestCase;
1920

2021
/**
@@ -157,7 +158,7 @@ private function getProductExtensionMock(): MockObject
157158
->disableOriginalConstructor();
158159
try {
159160
$mockBuilder->addMethods(['getDownloadableProductSamples']);
160-
} catch (\RuntimeException $e) {
161+
} catch (RuntimeException $e) {
161162
// Product extension already generated.
162163
}
163164

app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderGetTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Sales\Api\Data\OrderItemInterface;
2121
use Magento\Sales\Model\ResourceModel\Order\Collection;
2222
use PHPUnit\Framework\MockObject\MockObject;
23+
use PHPUnit\Framework\MockObject\RuntimeException;
2324
use PHPUnit\Framework\TestCase;
2425

2526
/**
@@ -279,7 +280,7 @@ private function getOrderExtensionMock(): MockObject
279280
$mockObject = $this->getMockBuilder(OrderExtension::class);
280281
try {
281282
$mockObject->addMethods(['getGiftMessage', 'setGiftMessage']);
282-
} catch (\RuntimeException $e) {
283+
} catch (RuntimeException $e) {
283284
// Order extension already generated.
284285
}
285286

@@ -296,7 +297,7 @@ private function getOrderItemExtensionMock(): MockObject
296297
$mockObject = $this->getMockBuilder(OrderItemExtension::class);
297298
try {
298299
$mockObject->addMethods(['getGiftMessage', 'setGiftMessage']);
299-
} catch (\RuntimeException $e) {
300+
} catch (RuntimeException $e) {
300301
// Order extension already generated.
301302
}
302303

app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Sales\Api\Data\OrderItemExtension;
1717
use Magento\Sales\Api\Data\OrderItemInterface;
1818
use PHPUnit\Framework\MockObject\MockObject;
19+
use PHPUnit\Framework\MockObject\RuntimeException;
1920
use PHPUnit\Framework\TestCase;
2021

2122
class OrderSaveTest extends TestCase
@@ -199,7 +200,7 @@ private function getOrderExtensionMock(): MockObject
199200
$mockBuilder = $this->getMockBuilder(OrderExtension::class);
200201
try {
201202
$mockBuilder->addMethods(['getGiftMessage', 'setGiftMessage']);
202-
} catch (\RuntimeException $e) {
203+
} catch (RuntimeException $e) {
203204
// OrderExtension already generated.
204205
}
205206

@@ -216,7 +217,7 @@ private function getOrderItemExtensionMock(): MockObject
216217
$mockBuilder = $this->getMockBuilder(OrderItemExtension::class);
217218
try {
218219
$mockBuilder->addMethods(['getGiftMessage', 'setGiftMessage']);
219-
} catch (\RuntimeException $e) {
220+
} catch (RuntimeException $e) {
220221
// OrderItemExtension already generated.
221222
}
222223

app/code/Magento/Multishipping/Test/Unit/Model/DisableMultishippingTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Quote\Api\Data\CartExtensionInterface;
1212
use Magento\Quote\Api\Data\CartInterface;
1313
use PHPUnit\Framework\MockObject\MockObject;
14+
use PHPUnit\Framework\MockObject\RuntimeException;
1415
use PHPUnit\Framework\TestCase;
1516

1617
/**
@@ -121,7 +122,7 @@ private function getCartExtensionMock(): MockObject
121122
->disableOriginalConstructor();
122123
try {
123124
$mockBuilder->addMethods(['getShippingAssignments', 'setShippingAssignments']);
124-
} catch (\RuntimeException $e) {
125+
} catch (RuntimeException $e) {
125126
// CartExtension already generated.
126127
}
127128

app/code/Magento/Persistent/Test/Unit/Model/QuoteManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ private function getExtensionAttributesMock(): MockObject
392392
$extensionMockBuilder = $this->getMockBuilder(CartExtensionInterface::class);
393393
try {
394394
$extensionMockBuilder->addMethods(['setShippingAssignments']);
395-
} catch (\RuntimeException $e) {
395+
} catch (RuntimeException $e) {
396396
// do nothing as CartExtensionInterface already generated and has 'setShippingAssignments' method.
397397
}
398398

0 commit comments

Comments
 (0)