Skip to content

Commit 60581ba

Browse files
committed
Merge remote-tracking branch 'origin/2.4.5-develop' into AC-3484_v1
2 parents ec461f3 + 0107106 commit 60581ba

File tree

128 files changed

+3928
-1354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3928
-1354
lines changed

app/code/Magento/Bundle/Pricing/Adjustment/DefaultSelectionPriceListProvider.php

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Bundle\Pricing\Price\BundleSelectionFactory;
1111
use Magento\Catalog\Model\Product;
1212
use Magento\Bundle\Model\Product\Price;
13+
use Magento\Catalog\Helper\Data as CatalogData;
14+
use Magento\Store\Model\StoreManagerInterface;
15+
use Magento\Store\Api\WebsiteRepositoryInterface;
1316

1417
/**
1518
* Provide lightweight implementation which uses price index
@@ -26,16 +29,41 @@ class DefaultSelectionPriceListProvider implements SelectionPriceListProviderInt
2629
*/
2730
private $priceList;
2831

32+
/**
33+
* @var CatalogData
34+
*/
35+
private $catalogData;
36+
37+
/**
38+
* @var StoreManagerInterface
39+
*/
40+
private $storeManager;
41+
42+
/**
43+
* @var WebsiteRepositoryInterface
44+
*/
45+
private $websiteRepository;
46+
2947
/**
3048
* @param BundleSelectionFactory $bundleSelectionFactory
49+
* @param CatalogData $catalogData
50+
* @param StoreManagerInterface $storeManager
51+
* @param WebsiteRepositoryInterface $websiteRepository
3152
*/
32-
public function __construct(BundleSelectionFactory $bundleSelectionFactory)
33-
{
53+
public function __construct(
54+
BundleSelectionFactory $bundleSelectionFactory,
55+
CatalogData $catalogData,
56+
StoreManagerInterface $storeManager,
57+
WebsiteRepositoryInterface $websiteRepository
58+
) {
3459
$this->selectionFactory = $bundleSelectionFactory;
60+
$this->catalogData = $catalogData;
61+
$this->storeManager = $storeManager;
62+
$this->websiteRepository = $websiteRepository;
3563
}
3664

3765
/**
38-
* {@inheritdoc}
66+
* @inheritdoc
3967
*/
4068
public function getPriceList(Product $bundleProduct, $searchMin, $useRegularPrice)
4169
{
@@ -138,7 +166,14 @@ private function addMiniMaxPriceList(Product $bundleProduct, $selectionsCollecti
138166
*/
139167
private function addMaximumMultiSelectionPriceList(Product $bundleProduct, $selectionsCollection, $useRegularPrice)
140168
{
141-
$selectionsCollection->addPriceData();
169+
$websiteId = null;
170+
if (!$this->catalogData->isPriceGlobal()) {
171+
$websiteId = (int)$this->storeManager->getStore()->getWebsiteId();
172+
if ($websiteId === 0) {
173+
$websiteId = $this->websiteRepository->getDefault()->getId();
174+
}
175+
}
176+
$selectionsCollection->addPriceData(null, $websiteId);
142177

143178
foreach ($selectionsCollection as $selection) {
144179
$this->priceList[] = $this->selectionFactory->create(
@@ -153,6 +188,8 @@ private function addMaximumMultiSelectionPriceList(Product $bundleProduct, $sele
153188
}
154189

155190
/**
191+
* Adjust min price for non required options
192+
*
156193
* @return void
157194
*/
158195
private function processMinPriceForNonRequiredOptions()
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Bundle\Test\Unit\Pricing\Adjustment;
9+
10+
use Magento\Bundle\Model\Option;
11+
use Magento\Bundle\Model\Product\Type;
12+
use Magento\Bundle\Model\ResourceModel\Option\Collection;
13+
use Magento\Bundle\Model\ResourceModel\Selection\Collection as SelectionCollection;
14+
use Magento\Bundle\Pricing\Adjustment\DefaultSelectionPriceListProvider;
15+
use Magento\Bundle\Pricing\Price\BundleSelectionFactory;
16+
use Magento\Catalog\Helper\Data as CatalogData;
17+
use Magento\Catalog\Model\Product;
18+
use Magento\Framework\DataObject;
19+
use Magento\Store\Api\Data\StoreInterface;
20+
use Magento\Store\Api\Data\WebsiteInterface;
21+
use Magento\Store\Api\WebsiteRepositoryInterface;
22+
use Magento\Store\Model\StoreManagerInterface;
23+
use PHPUnit\Framework\MockObject\MockObject;
24+
use PHPUnit\Framework\TestCase;
25+
26+
/**
27+
* Test for \Magento\Bundle\Pricing\DefaultSelectionPriceListProvider
28+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
29+
*/
30+
class DefaultSelectionPriceListProviderTest extends TestCase
31+
{
32+
/**
33+
* @var BundleSelectionFactory|MockObject
34+
*/
35+
private $selectionFactory;
36+
37+
/**
38+
* @var CatalogData|MockObject
39+
*/
40+
private $catalogData;
41+
42+
/**
43+
* @var StoreManagerInterface|MockObject
44+
*/
45+
private $storeManager;
46+
47+
/**
48+
* @var WebsiteRepositoryInterface|MockObject
49+
*/
50+
private $websiteRepository;
51+
52+
/**
53+
* @var Product|MockObject
54+
*/
55+
private $product;
56+
57+
/**
58+
* @var Collection|MockObject
59+
*/
60+
private $optionsCollection;
61+
62+
/**
63+
* @var Type|MockObject
64+
*/
65+
private $typeInstance;
66+
67+
/**
68+
* @var Option|MockObject
69+
*/
70+
private $option;
71+
72+
/**
73+
* @var SelectionCollection|MockObject
74+
*/
75+
private $selectionCollection;
76+
77+
/**
78+
* @var DataObject|MockObject
79+
*/
80+
private $selection;
81+
82+
/**
83+
* @var StoreInterface|MockObject
84+
*/
85+
private $store;
86+
87+
/**
88+
* @var WebsiteInterface|MockObject
89+
*/
90+
private $website;
91+
92+
/**
93+
* @var DefaultSelectionPriceListProvider
94+
*/
95+
private $model;
96+
97+
protected function setUp(): void
98+
{
99+
$this->selectionFactory = $this->getMockBuilder(BundleSelectionFactory::class)
100+
->disableOriginalConstructor()
101+
->getMock();
102+
$this->catalogData = $this->getMockBuilder(CatalogData::class)
103+
->disableOriginalConstructor()
104+
->getMock();
105+
$this->storeManager = $this->getMockBuilder(StoreManagerInterface::class)
106+
->getMockForAbstractClass();
107+
$this->websiteRepository = $this->getMockBuilder(WebsiteRepositoryInterface::class)
108+
->getMockForAbstractClass();
109+
110+
$this->product = $this->getMockBuilder(Product::class)
111+
->disableOriginalConstructor()
112+
->getMock();
113+
$this->optionsCollection = $this->getMockBuilder(Collection::class)
114+
->disableOriginalConstructor()
115+
->getMock();
116+
$this->typeInstance = $this->getMockBuilder(Type::class)
117+
->disableOriginalConstructor()
118+
->getMock();
119+
$this->option = $this->getMockBuilder(Option::class)
120+
->disableOriginalConstructor()
121+
->getMock();
122+
$this->selectionCollection = $this->getMockBuilder(SelectionCollection::class)
123+
->disableOriginalConstructor()
124+
->getMock();
125+
$this->selection = $this->getMockBuilder(DataObject::class)
126+
->disableOriginalConstructor()
127+
->getMock();
128+
$this->store = $this->getMockBuilder(StoreInterface::class)
129+
->getMockForAbstractClass();
130+
$this->website = $this->getMockBuilder(WebsiteInterface::class)
131+
->getMockForAbstractClass();
132+
133+
$this->model = new DefaultSelectionPriceListProvider(
134+
$this->selectionFactory,
135+
$this->catalogData,
136+
$this->storeManager,
137+
$this->websiteRepository
138+
);
139+
}
140+
141+
public function testGetPriceList(): void
142+
{
143+
$optionId = 1;
144+
145+
$this->typeInstance->expects($this->any())
146+
->method('getOptionsCollection')
147+
->with($this->product)
148+
->willReturn($this->optionsCollection);
149+
$this->product->expects($this->any())
150+
->method('getTypeInstance')
151+
->willReturn($this->typeInstance);
152+
$this->optionsCollection->expects($this->once())
153+
->method('getIterator')
154+
->willReturn(new \ArrayIterator([$this->option]));
155+
$this->option->expects($this->once())
156+
->method('getOptionId')
157+
->willReturn($optionId);
158+
$this->typeInstance->expects($this->once())
159+
->method('getSelectionsCollection')
160+
->with([$optionId], $this->product)
161+
->willReturn($this->selectionCollection);
162+
$this->option->expects($this->once())
163+
->method('isMultiSelection')
164+
->willReturn(true);
165+
$this->storeManager->expects($this->once())
166+
->method('getStore')
167+
->willReturn($this->store);
168+
$this->store->expects($this->once())
169+
->method('getWebsiteId')
170+
->willReturn(0);
171+
$this->websiteRepository->expects($this->once())
172+
->method('getDefault')
173+
->willReturn($this->website);
174+
$this->website->expects($this->once())
175+
->method('getId')
176+
->willReturn(1);
177+
$this->selectionCollection->expects($this->once())
178+
->method('getIterator')
179+
->willReturn(new \ArrayIterator([]));
180+
181+
$this->model->getPriceList($this->product, false, false);
182+
}
183+
}

app/code/Magento/CatalogInventory/Test/Fixture/SourceItem.php

Lines changed: 0 additions & 90 deletions
This file was deleted.

app/code/Magento/CmsUrlRewrite/Observer/ProcessUrlRewriteSavingObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ public function execute(EventObserver $observer)
4444
/** @var $cmsPage \Magento\Cms\Model\Page */
4545
$cmsPage = $observer->getEvent()->getObject();
4646

47-
if ($cmsPage->dataHasChangedFor('identifier') || $cmsPage->dataHasChangedFor('store_id')) {
47+
if ($cmsPage->dataHasChangedFor('identifier')
48+
|| $cmsPage->dataHasChangedFor('store_id')
49+
|| $cmsPage->getData('rewrites_update_force')
50+
) {
4851
$urls = $this->cmsPageUrlRewriteGenerator->generate($cmsPage);
4952

5053
$this->urlPersist->deleteByData([
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\ImportExport\Api\Data;
9+
10+
/**
11+
* Localized export interface for correct parsing values (like date) provided in admin ui locale.
12+
*/
13+
interface LocalizedExportInfoInterface extends ExtendedExportInfoInterface
14+
{
15+
/**
16+
* Returns admin locale
17+
*
18+
* @return string|null
19+
*/
20+
public function getLocale(): ?string;
21+
22+
/**
23+
* Set admin locale
24+
*
25+
* @param string $locale
26+
* @return void
27+
*/
28+
public function setLocale(string $locale): void;
29+
}

0 commit comments

Comments
 (0)