Skip to content

Commit 252a0ed

Browse files
Oleksii Korshenkoal.kravchuk
Oleksii Korshenko
authored and
al.kravchuk
committed
#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
{

app/code/Magento/Theme/Test/Unit/Model/Theme/Source/ThemeTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
class ThemeTest extends \PHPUnit\Framework\TestCase
1111
{
1212
/**
13-
* @true
1413
* @return void
1514
* @covers \Magento\Theme\Model\Theme\Source\Theme::__construct
1615
* @covers \Magento\Theme\Model\Theme\Source\Theme::getAllOptions

app/code/Magento/Ui/Test/Unit/Component/Filters/FilterModifierTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public function testNotApplyFilterModifier()
6666

6767
/**
6868
* @return void
69-
* @assertException \Magento\Framework\Exception\LocalizedException
69+
* @expectedException \Magento\Framework\Exception\LocalizedException
70+
* @expectedExceptionMessage Condition type "not_allowed" is not allowed
7071
*/
7172
public function testApplyFilterModifierWithNotAllowedCondition()
7273
{
@@ -78,7 +79,7 @@ public function testApplyFilterModifierWithNotAllowedCondition()
7879
]
7980
]);
8081
$this->dataProvider->expects($this->never())->method('addFilter');
81-
$this->unit->applyFilterModifier($this->dataProvider, 'test');
82+
$this->unit->applyFilterModifier($this->dataProvider, 'filter');
8283
}
8384

8485
/**

lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public function testHandlerException($errorNo, $errorPhrase)
5353
$errorFile = 'test_file';
5454
$errorLine = 'test_error_line';
5555

56-
$exceptedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
56+
$expectedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
5757
$this->expectException('Exception');
58-
$this->expectExceptionMessage($exceptedExceptionMessage);
58+
$this->expectExceptionMessage($expectedExceptionMessage);
5959

6060
$this->object->handler($errorNo, $errorStr, $errorFile, $errorLine);
6161
}

lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function testCreateIfContentDoesntHaveRequiredKeys()
6767

6868
/**
6969
* @expectedException \Exception
70-
* @exceptedExceptionMessage File not found
70+
* @expectedExceptionMessage File not found
7171
*/
7272
public function testCreateIfFileNotExist()
7373
{

lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function testGetLayout()
122122

123123
/**
124124
* @expectedException \RuntimeException
125-
* @exceptedExceptionMessage 'Layout must be loaded only once.'
125+
* @expectedExceptionMessage Layout must be loaded only once.
126126
*/
127127
public function testLoadLayoutWhenLayoutAlreadyLoaded()
128128
{

lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public function fetchDataProvider()
395395

396396
/**
397397
* @expectedException \InvalidArgumentException
398-
* @expectedMessage Timer "foo" doesn't exist.
398+
* @expectedExceptionMessage Timer "foo" doesn't exist.
399399
*/
400400
public function testFetchInvalidTimer()
401401
{
@@ -404,7 +404,7 @@ public function testFetchInvalidTimer()
404404

405405
/**
406406
* @expectedException \InvalidArgumentException
407-
* @expectedMessage Timer "foo" doesn't have value for "bar".
407+
* @expectedExceptionMessage Timer "foo" doesn't have value for "bar".
408408
*/
409409
public function testFetchInvalidKey()
410410
{

setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/ParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function setUp()
4141
* @param array $jsFiles
4242
* @param array $phpMap
4343
* @param array $jsMap
44-
* @paran array $phraseFactoryMap
44+
* @param array $phraseFactoryMap
4545
* @param array $expectedResult
4646
* @dataProvider addPhraseDataProvider
4747
*/

0 commit comments

Comments
 (0)