Skip to content

Commit 898e108

Browse files
committed
Merge remote-tracking branch 'origin/AC-10621' into AC-10821
2 parents de12b2f + f9e1e26 commit 898e108

File tree

5 files changed

+37
-29
lines changed

5 files changed

+37
-29
lines changed

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Category/EditTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Magento\Framework\Controller\Result\JsonFactory;
1818
use Magento\Framework\Event\ManagerInterface;
1919
use Magento\Framework\ObjectManagerInterface;
20-
use Magento\Framework\Registry;
2120
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
2221
use Magento\Framework\View\LayoutFactory;
2322
use Magento\Framework\View\Page\Title;
@@ -26,8 +25,6 @@
2625
use Magento\Store\Model\StoreManagerInterface;
2726
use PHPUnit\Framework\MockObject\MockObject;
2827
use PHPUnit\Framework\TestCase;
29-
use Magento\Framework\Stdlib\DateTime\Filter\Date;
30-
use Magento\Cms\Model\Wysiwyg\Config;
3128

3229
/**
3330
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -119,26 +116,6 @@ protected function setUp(): void
119116
{
120117
$this->objectManager = new ObjectManager($this);
121118

122-
$objects = [
123-
[
124-
Date::class,
125-
$this->createMock(Date::class)
126-
],
127-
[
128-
Registry::class,
129-
$this->createMock(Registry::class)
130-
],
131-
[
132-
StoreManagerInterface::class,
133-
$this->createMock(StoreManagerInterface::class)
134-
],
135-
[
136-
Config::class,
137-
$this->createMock(Config::class)
138-
]
139-
];
140-
$this->objectManager->prepareObjectManager($objects);
141-
142119
$this->categoryMock = $this->createPartialMock(
143120
Category::class,
144121
[

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Storage/DynamicStorageTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\Framework\App\ResourceConnection;
1717
use Magento\Framework\DB\Adapter\AdapterInterface;
1818
use Magento\Framework\DB\Select;
19+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1920
use Magento\UrlRewrite\Model\OptionProvider;
2021
use Magento\Store\Model\ScopeInterface;
2122
use Magento\UrlRewrite\Service\V1\Data\UrlRewriteFactory;
@@ -128,6 +129,15 @@ protected function setUp(): void
128129
->disableOriginalConstructor()
129130
->getMock();
130131

132+
$objectManager = new ObjectManager($this);
133+
$objects = [
134+
[
135+
LoggerInterface::class,
136+
$this->createMock(LoggerInterface::class)
137+
]
138+
];
139+
$objectManager->prepareObjectManager($objects);
140+
131141
$this->object = new DynamicStorage(
132142
$this->urlRewriteFactoryMock,
133143
$this->dataObjectHelperMock,

app/code/Magento/Checkout/Test/Unit/Block/Cart/LinkTest.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
use Magento\Checkout\Block\Cart\Link;
1111
use Magento\Checkout\Helper\Cart;
12+
use Magento\Framework\Math\Random;
1213
use Magento\Framework\Module\Manager;
1314
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1415
use Magento\Framework\UrlInterface;
1516
use Magento\Framework\View\Element\Template\Context;
17+
use Magento\Framework\View\Helper\SecureHtmlRenderer;
1618
use PHPUnit\Framework\TestCase;
1719

1820
class LinkTest extends TestCase
@@ -25,6 +27,18 @@ class LinkTest extends TestCase
2527
protected function setUp(): void
2628
{
2729
$this->_objectManagerHelper = new ObjectManager($this);
30+
31+
$objects = [
32+
[
33+
SecureHtmlRenderer::class,
34+
$this->createMock(SecureHtmlRenderer::class)
35+
],
36+
[
37+
Random::class,
38+
$this->createMock(Random::class)
39+
]
40+
];
41+
$this->_objectManagerHelper->prepareObjectManager($objects);
2842
}
2943

3044
public function testGetUrl()
@@ -51,7 +65,7 @@ public function testToHtml()
5165
$moduleManager = $this->getMockBuilder(
5266
Manager::class
5367
)->disableOriginalConstructor()
54-
->setMethods(
68+
->onlyMethods(
5569
['isOutputEnabled']
5670
)->getMock();
5771
$helper = $this->getMockBuilder(Cart::class)
@@ -83,7 +97,7 @@ public function testGetLabel($productCount, $label)
8397
$helper = $this->getMockBuilder(
8498
Cart::class
8599
)->disableOriginalConstructor()
86-
->setMethods(
100+
->onlyMethods(
87101
['getSummaryCount']
88102
)->getMock();
89103

app/code/Magento/Checkout/Test/Unit/Block/LinkTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ public function testToHtml($canOnepageCheckout, $isOutputEnabled)
6565
$helper = $this->getMockBuilder(
6666
Data::class
6767
)->disableOriginalConstructor()
68-
->setMethods(
68+
->onlyMethods(
6969
['canOnepageCheckout', 'isModuleOutputEnabled']
7070
)->getMock();
7171

7272
$moduleManager = $this->getMockBuilder(
7373
Manager::class
7474
)->disableOriginalConstructor()
75-
->setMethods(
75+
->onlyMethods(
7676
['isOutputEnabled']
7777
)->getMock();
7878

app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
use Magento\Framework\Api\DataObjectHelper;
2020
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
2121
use Magento\Framework\Api\SearchCriteriaInterface;
22+
use Magento\Framework\EntityManager\HydratorInterface;
2223
use Magento\Framework\Reflection\DataObjectProcessor;
24+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
2325
use Magento\Store\Api\Data\StoreInterface;
2426
use Magento\Store\Model\StoreManagerInterface;
2527
use PHPUnit\Framework\MockObject\MockObject;
@@ -128,7 +130,7 @@ protected function setUp(): void
128130
->getMock();
129131
$this->collection = $this->getMockBuilder(Collection::class)
130132
->disableOriginalConstructor()
131-
->setMethods(['addFieldToFilter', 'getSize', 'setCurPage', 'setPageSize', 'load', 'addOrder'])
133+
->onlyMethods(['addFieldToFilter', 'getSize', 'setCurPage', 'setPageSize', 'load', 'addOrder'])
132134
->getMock();
133135

134136
$blockFactory->expects($this->any())
@@ -156,6 +158,10 @@ protected function setUp(): void
156158
$this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class)
157159
->getMockForAbstractClass();
158160

161+
$hydrator = $this->getMockBuilder(HydratorInterface::class)
162+
->disableOriginalConstructor()
163+
->getMock();
164+
159165
$this->repository = new BlockRepository(
160166
$this->blockResource,
161167
$blockFactory,
@@ -165,7 +171,8 @@ protected function setUp(): void
165171
$this->dataHelper,
166172
$this->dataObjectProcessor,
167173
$this->storeManager,
168-
$this->collectionProcessor
174+
$this->collectionProcessor,
175+
$hydrator
169176
);
170177
}
171178

0 commit comments

Comments
 (0)