Skip to content

Commit 252a0ed

Browse files
Oleksii Korshenkoal.kravchuk
authored andcommitted
#18840: Invalid Unit Test Annotations.
- fixed invalid unit tests annotations that assert exception messages - backport to 2.2.
1 parent 9d56ebe commit 252a0ed

File tree

17 files changed

+26
-26
lines changed

17 files changed

+26
-26
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function testGetWithNonExistingProduct()
268268

269269
/**
270270
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
271-
* @expectedExceptionText Such image doesn't exist
271+
* @expectedExceptionMessage Such image doesn't exist
272272
*/
273273
public function testGetWithNonExistingImage()
274274
{

app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function setUp()
5656

5757
/**
5858
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
59-
* @expectedMessage This product doesn't have tier price
59+
* @expectedExceptionMessage Product hasn't group price with such data: customerGroupId = '1', website = 1, qty = 3
6060
*/
6161
public function testRemoveWhenTierPricesNotExists()
6262
{
@@ -72,7 +72,7 @@ public function testRemoveWhenTierPricesNotExists()
7272

7373
/**
7474
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
75-
* @expectedMessage For current customerGroupId = '10' with 'qty' = 15 any tier price exist'.
75+
* @expectedExceptionMessage Product hasn't group price with such data: customerGroupId = '10', website = 1, qty = 5
7676
*/
7777
public function testRemoveTierPriceForNonExistingCustomerGroup()
7878
{
@@ -83,7 +83,7 @@ public function testRemoveTierPriceForNonExistingCustomerGroup()
8383
->will($this->returnValue($this->prices));
8484
$this->productMock->expects($this->never())->method('setData');
8585
$this->productRepositoryMock->expects($this->never())->method('save');
86-
$this->priceModifier->removeTierPrice($this->productMock, 10, 15, 1);
86+
$this->priceModifier->removeTierPrice($this->productMock, 10, 5, 1);
8787
}
8888

8989
public function testSuccessfullyRemoveTierPriceSpecifiedForAllGroups()

app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function testSuccessDeleteTierPrice()
188188

189189
/**
190190
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
191-
* @message Such product doesn't exist
191+
* @expectedExceptionMessage No such entity.
192192
*/
193193
public function testDeleteTierPriceFromNonExistingProduct()
194194
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testCheckQuoteItem()
9494

9595
/**
9696
* @expectedException \Magento\Framework\Exception\LocalizedException
97-
* @exceptedExceptionMessage We can't find the quote item.
97+
* @expectedExceptionMessage We can't find the quote item.
9898
*/
9999
public function testCheckQuoteItemWithException()
100100
{

app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testSetResourceInvalidPath()
8989

9090
/**
9191
* @expectedException \Magento\Framework\Exception\LocalizedException
92-
* @exectedExceptionMessage Please set resource file and link type.
92+
* @expectedExceptionMessage Please set resource file and link type.
9393
*/
9494
public function testGetFileSizeNoResource()
9595
{

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testAfterSaveGiftMessages()
128128

129129
/**
130130
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
131-
* @expectedMessage Could not add gift message to order:Test message
131+
* @expectedExceptionMessage Could not add gift message to order: "Test message"
132132
*/
133133
public function testAfterSaveIfGiftMessagesNotExist()
134134
{
@@ -146,7 +146,7 @@ public function testAfterSaveIfGiftMessagesNotExist()
146146
$this->giftMessageOrderRepositoryMock
147147
->expects($this->once())
148148
->method('save')
149-
->willThrowException(new \Exception('TestMessage'));
149+
->willThrowException(new \Exception('Test message'));
150150

151151
// save Gift Messages on item level
152152
$this->orderMock->expects($this->never())->method('getItems');
@@ -155,7 +155,7 @@ public function testAfterSaveIfGiftMessagesNotExist()
155155

156156
/**
157157
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
158-
* @expectedMessage Could not add gift message to order:Test message
158+
* @expectedExceptionMessage Could not add gift message to order's item: "Test message"
159159
*/
160160
public function testAfterSaveIfItemGiftMessagesNotExist()
161161
{
@@ -185,7 +185,7 @@ public function testAfterSaveIfItemGiftMessagesNotExist()
185185
$this->giftMessageOrderItemRepositoryMock
186186
->expects($this->once())->method('save')
187187
->with($orderId, $orderItemId, $this->giftMessageMock)
188-
->willThrowException(new \Exception('TestMessage'));
188+
->willThrowException(new \Exception('Test message'));
189189
$this->plugin->afterSave($this->orderRepositoryMock, $this->orderMock);
190190
}
191191
}

app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function setUp()
3636

3737
/**
3838
* @expectedException \Magento\Framework\Exception\StateException
39-
* @expectedMessage Cannot assign customer to the given cart. You don't have permission for this operation.
39+
* @expectedExceptionMessage Cannot assign customer to the given cart. You don't have permission for this operation.
4040
*/
4141
public function testBeforeAssignCustomer()
4242
{

app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function setUp()
9292

9393
/**
9494
* @expectedException \InvalidArgumentException
95-
* @ExceptedExceptionMessage The qty value is required to update quote item.
95+
* @expectedExceptionMessage The qty value is required to update quote item.
9696
*/
9797
public function testUpdateNoQty()
9898
{

app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function setUp()
100100

101101
/**
102102
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
103-
* @expected ExceptionMessage error345
103+
* @expectedExceptionMessage error345
104104
*/
105105
public function testSetAddressValidationFailed()
106106
{

app/code/Magento/Search/Test/Unit/Model/SynonymGroupRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testSaveCreate()
5353

5454
/**
5555
* @expectedException \Magento\Search\Model\Synonym\MergeConflictException
56-
* @expecteExceptionMessage (c,d,e)
56+
* @expectedExceptionMessage Merge conflict with existing synonym group(s): (a,b,c)
5757
*/
5858
public function testSaveCreateMergeConflict()
5959
{
@@ -138,7 +138,7 @@ public function testSaveUpdate()
138138

139139
/**
140140
* @expectedException \Magento\Search\Model\Synonym\MergeConflictException
141-
* @expecteExceptionMessage (d,h,i)
141+
* @expectedExceptionMessage (d,h,i)
142142
*/
143143
public function testSaveUpdateMergeConflict()
144144
{

0 commit comments

Comments
 (0)