Skip to content

Commit 858d9d3

Browse files
ShradddhaShradddha
authored andcommitted
File change for Magento2EE
1 parent 03d609e commit 858d9d3

File tree

5 files changed

+58
-8
lines changed

5 files changed

+58
-8
lines changed

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Export/AdvancedPricingTest.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
use Magento\Catalog\Model\ResourceModel\ProductFactory;
1515
use Magento\CatalogImportExport\Model\Export\Product;
1616
use Magento\CatalogImportExport\Model\Export\Product\Type\Factory;
17+
use Magento\CatalogImportExport\Model\Export\ProductFilterInterface;
1718
use Magento\CatalogImportExport\Model\Export\RowCustomizer\Composite;
1819
use Magento\CatalogImportExport\Model\Import\Product\StoreResolver;
20+
use Magento\CatalogInventory\Api\StockConfigurationInterface;
1921
use Magento\CatalogInventory\Model\ResourceModel\Stock\ItemFactory;
2022
use Magento\Customer\Api\GroupRepositoryInterface;
2123
use Magento\Eav\Model\Config;
@@ -33,8 +35,9 @@
3335
use PHPUnit\Framework\MockObject\MockObject;
3436
use PHPUnit\Framework\TestCase;
3537
use Psr\Log\LoggerInterface;
38+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
3639

37-
/**
40+
/**
3841
* @SuppressWarnings(PHPMD)
3942
*/
4043
class AdvancedPricingTest extends TestCase
@@ -149,11 +152,25 @@ class AdvancedPricingTest extends TestCase
149152
*/
150153
protected $object;
151154

155+
152156
/**
153157
* Set Up
154158
*/
155159
protected function setUp(): void
156160
{
161+
$objectManager = new ObjectManager($this);
162+
$objects = [
163+
[
164+
ProductFilterInterface::class,
165+
$this->createMock(ProductFilterInterface::class)
166+
],
167+
[
168+
StockConfigurationInterface::class,
169+
$this->createMock(StockConfigurationInterface::class)
170+
]
171+
];
172+
$objectManager->prepareObjectManager($objects);
173+
157174
$this->localeDate = $this->createMock(Timezone::class);
158175
$this->config = $this->createPartialMock(Config::class, ['getEntityType']);
159176
$type = $this->createMock(Type::class);
@@ -243,12 +260,14 @@ protected function setUp(): void
243260
$this->advancedPricing = $this->getMockBuilder(
244261
AdvancedPricing::class
245262
)
246-
->setMethods($mockMethods)
263+
->onlyMethods($mockMethods)
247264
->disableOriginalConstructor()
248265
->getMock();
249266
foreach ($constructorMethods as $method) {
250267
$this->advancedPricing->expects($this->once())->method($method)->willReturnSelf();
251268
}
269+
270+
252271
$this->advancedPricing->__construct(
253272
$this->localeDate,
254273
$this->config,

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)