Skip to content

Commit f686865

Browse files
#25249: fix cs
1 parent 5b3a131 commit f686865

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
use Magento\Catalog\Api\CategoryRepositoryInterface;
1010
use Magento\Catalog\Api\Data\CategoryProductLinkInterface;
1111
use Magento\Catalog\Api\ProductRepositoryInterface;
12-
use Magento\Catalog\Model\CategoryLinkRepository;
13-
use Magento\Catalog\Model\ResourceModel\Product;
1412
use Magento\Catalog\Model\Category;
13+
use Magento\Catalog\Model\CategoryLinkRepository;
1514
use Magento\Catalog\Model\Product as ProductModel;
15+
use Magento\Catalog\Model\ResourceModel\Product;
16+
use Magento\Framework\Exception\CouldNotSaveException;
17+
use Magento\Framework\Exception\InputException;
18+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1619

1720
/**
1821
* Test for \Magento\Catalog\Model\CategoryLinkRepository
@@ -24,27 +27,27 @@ class CategoryLinkRepositoryTest extends \PHPUnit\Framework\TestCase
2427
/**
2528
* @var CategoryLinkRepository
2629
*/
27-
protected $model;
30+
private $model;
2831

2932
/**
30-
* @var CategoryRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
33+
* @var CategoryRepositoryInterface|MockObject
3134
*/
32-
protected $categoryRepositoryMock;
35+
private $categoryRepositoryMock;
3336

3437
/**
35-
* @var ProductRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject
38+
* @var ProductRepositoryInterface|MockObject
3639
*/
37-
protected $productRepositoryMock;
40+
private $productRepositoryMock;
3841

3942
/**
40-
* @var CategoryProductLinkInterface|\PHPUnit_Framework_MockObject_MockObject
43+
* @var CategoryProductLinkInterface|MockObject
4144
*/
42-
protected $productLinkMock;
45+
private $productLinkMock;
4346

4447
/**
45-
* @var Product|\PHPUnit_Framework_MockObject_MockObject
48+
* @var Product|MockObject
4649
*/
47-
protected $productResourceMock;
50+
private $productResourceMock;
4851

4952
/**
5053
* Initialize required data
@@ -126,7 +129,7 @@ public function testSaveWithCouldNotSaveException(): void
126129
$categoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
127130

128131
$this->expectExceptionMessage('Could not save product "55" with position 1 to category 42');
129-
$this->expectException(\Magento\Framework\Exception\CouldNotSaveException::class);
132+
$this->expectException(CouldNotSaveException::class);
130133
$this->model->save($this->productLinkMock);
131134
}
132135

@@ -185,7 +188,7 @@ public function testDeleteByIdsWithCouldNotSaveException(): void
185188
$categoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
186189

187190
$this->expectExceptionMessage('Could not save product "55" with position 1 to category 42');
188-
$this->expectException(\Magento\Framework\Exception\CouldNotSaveException::class);
191+
$this->expectException(CouldNotSaveException::class);
189192
$this->model->deleteByIds($categoryId, $productSku);
190193
}
191194

@@ -216,7 +219,7 @@ public function testDeleteWithInputException(): void
216219
$categoryMock->expects($this->never())->method('save');
217220

218221
$this->expectExceptionMessage('The category doesn\'t contain the specified product.');
219-
$this->expectException(\Magento\Framework\Exception\InputException::class);
222+
$this->expectException(InputException::class);
220223
$this->assertTrue($this->model->delete($this->productLinkMock));
221224
}
222225

@@ -293,7 +296,7 @@ public function testDeleteBySkusWithInputException(): void
293296
->willReturn($categoryMock);
294297

295298
$this->expectExceptionMessage('The category doesn\'t contain the specified products.');
296-
$this->expectException(\Magento\Framework\Exception\InputException::class);
299+
$this->expectException(InputException::class);
297300
$this->model->deleteBySkus($categoryId, [$productSku]);
298301
}
299302

@@ -322,7 +325,7 @@ public function testDeleteSkusIdsWithCouldNotSaveException(): void
322325
$categoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
323326

324327
$this->expectExceptionMessage('Could not save products "testSku" to category 42');
325-
$this->expectException(\Magento\Framework\Exception\CouldNotSaveException::class);
328+
$this->expectException(CouldNotSaveException::class);
326329
$this->assertTrue($this->model->deleteBySkus($categoryId, [$productSku]));
327330
}
328331
}

0 commit comments

Comments
 (0)