Skip to content

Commit a9e62c3

Browse files
committed
Merge remote-tracking branch 'mainline/2.4-develop' into ACP2E-1044
2 parents 71d3eab + bd74c82 commit a9e62c3

File tree

393 files changed

+12569
-10016
lines changed

Some content is hidden

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

393 files changed

+12569
-10016
lines changed

.github/ISSUE_TEMPLATE/developer-experience-issue.md

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Developer experience issue
2+
description: Issues related to customization, extensibility, modularity
3+
labels: ['Triage: Dev.Experience']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Please read [our guidelines](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#report-an-issue) before submitting the issue.
9+
- type: textarea
10+
attributes:
11+
label: Summary
12+
description: |
13+
Describe the issue you are experiencing.
14+
Include general information, error messages, environments, and so on.
15+
validations:
16+
required: true
17+
- type: textarea
18+
attributes:
19+
label: Examples
20+
description: |
21+
Provide code examples or a patch with a test (recommended) to clearly indicate the problem.
22+
validations:
23+
required: true
24+
- type: textarea
25+
attributes:
26+
label: Proposed solution
27+
description: |
28+
Suggest your potential solutions for this issue.
29+
- type: textarea
30+
attributes:
31+
label: Release note
32+
description: |
33+
Help us to provide meaningful release notes to the community.
34+
- type: checkboxes
35+
attributes:
36+
label: Triage and priority
37+
description: |
38+
Provide [Severity](https://developer.adobe.com/commerce/contributor/guides/code-contributions/#community-backlog-priority) assessment for the Issue as a Reporter.
39+
This information helps us during the Confirmation and Issue triage processes.
40+
options:
41+
- label: 'Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._'
42+
- label: 'Severity: **S1** _- Affects critical data or functionality and forces users to employ a workaround._'
43+
- label: 'Severity: **S2** _- Affects non-critical data or functionality and forces users to employ a workaround._'
44+
- label: 'Severity: **S3** _- Affects non-critical data or functionality and does not force users to employ a workaround._'
45+
- label: 'Severity: **S4** _- Affects aesthetics, professional look and feel, “quality” or “usability”._'

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Feature request
2+
description: Report to https://github.com/magento/community-features
3+
labels: ['feature request']
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Important: This repository is intended only for Magento 2 Technical Issues.
9+
Enter Feature Requests at https://github.com/magento/community-features.
10+
Project stakeholders monitor and manage requests.
11+
Feature requests entered using this form may be moved to the forum.
12+
- type: textarea
13+
attributes:
14+
label: Description
15+
description: |
16+
Describe the feature you would like to add.
17+
validations:
18+
required: true
19+
- type: textarea
20+
attributes:
21+
label: Expected behavior
22+
description: |
23+
What is the expected behavior of this feature?
24+
How is it going to work?
25+
validations:
26+
required: true
27+
- type: textarea
28+
attributes:
29+
label: Benefits
30+
description: |
31+
How do you think this feature would improve Magento?
32+
- type: textarea
33+
attributes:
34+
label: Additional information
35+
description: |
36+
What other information can you provide about the desired feature?
37+
- type: textarea
38+
attributes:
39+
label: Release note
40+
description: |
41+
Help us to provide meaningful release notes to the community.

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
/**
1515
* Export Advanced Pricing
1616
*
17-
* @author Magento Core Team <core@magentocommerce.com>
1817
* @SuppressWarnings(PHPMD.TooManyFields)
1918
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2019
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2120
*/
2221
class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product
2322
{
24-
const ENTITY_ADVANCED_PRICING = 'advanced_pricing';
23+
public const ENTITY_ADVANCED_PRICING = 'advanced_pricing';
2524

2625
/**
2726
* @var \Magento\CatalogImportExport\Model\Import\Product\StoreResolver
@@ -568,10 +567,10 @@ protected function getTierPrices(array $listSku, $table)
568567
if (isset($price[0]) && !empty($price[0]) || isset($price[1]) && !empty($price[1])) {
569568
$select->orWhere('ap.percentage_value IS NOT NULL');
570569
}
571-
if (isset($updatedAtFrom) && !empty($updatedAtFrom)) {
570+
if (isset($updatedAtFrom)) {
572571
$select->where('cpe.updated_at >= ?', $updatedAtFrom);
573572
}
574-
if (isset($updatedAtTo) && !empty($updatedAtTo)) {
573+
if (isset($updatedAtTo)) {
575574
$select->where('cpe.updated_at <= ?', $updatedAtTo);
576575
}
577576
$exportData = $this->_connection->fetchAll($select);

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ protected function _importData()
316316
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $this->getBehavior()) {
317317
$this->saveAdvancedPricing();
318318
}
319-
320319
return true;
321320
}
322321

@@ -342,7 +341,7 @@ public function deleteAdvancedPricing()
342341
{
343342
$this->_cachedSkuToDelete = null;
344343
$listSku = [];
345-
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
344+
while ($bunch = $this->_dataSourceModel->getNextUniqueBunch($this->getIds())) {
346345
foreach ($bunch as $rowNum => $rowData) {
347346
$this->validateRow($rowData, $rowNum);
348347
if (!$this->getErrorAggregator()->isRowInvalid($rowNum)) {
@@ -389,7 +388,7 @@ protected function saveAndReplaceAdvancedPrices()
389388
}
390389
$listSku = [];
391390
$tierPrices = [];
392-
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
391+
while ($bunch = $this->_dataSourceModel->getNextUniqueBunch($this->getIds())) {
393392
$bunchTierPrices = [];
394393
foreach ($bunch as $rowNum => $rowData) {
395394
if (!$this->validateRow($rowData, $rowNum)) {
@@ -417,7 +416,7 @@ protected function saveAndReplaceAdvancedPrices()
417416
'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
418417
];
419418
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
420-
$bunchTierPrices[$rowSku][] = $tierPrice;
419+
$bunchTierPrices[$rowSku][] = $tierPrice;
421420
}
422421
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
423422
$tierPrices[$rowSku][] = $tierPrice;
@@ -437,9 +436,7 @@ protected function saveAndReplaceAdvancedPrices()
437436
if ($listSku) {
438437
$this->setUpdatedAt($listSku);
439438
}
440-
}
441-
442-
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
439+
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
443440
if ($listSku) {
444441
$this->processCountNewPrices($tierPrices);
445442
if ($this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) {
@@ -448,6 +445,7 @@ protected function saveAndReplaceAdvancedPrices()
448445
}
449446
}
450447
}
448+
$this->finalizeCount();
451449

452450
return $this;
453451
}
@@ -652,11 +650,18 @@ protected function processCountNewPrices(array $tierPrices)
652650
foreach ($tierPrices as $productPrices) {
653651
$this->countItemsCreated += count($productPrices);
654652
}
655-
$this->countItemsCreated -= $this->countItemsUpdated;
656653

657654
return $this;
658655
}
659656

657+
/**
658+
* Finalize count of new and existing records
659+
*/
660+
protected function finalizeCount()
661+
{
662+
$this->countItemsCreated -= $this->countItemsUpdated;
663+
}
664+
660665
/**
661666
* Get product entity link field
662667
*

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class AdvancedPricingTest extends AbstractImportTestCase
3939
/**
4040
* DB Table data
4141
*/
42-
const TABLE_NAME = 'tableName';
43-
const LINK_FIELD = 'linkField';
42+
public const TABLE_NAME = 'tableName';
43+
public const LINK_FIELD = 'linkField';
4444

4545
/**
4646
* @var ResourceFactory|MockObject
@@ -328,7 +328,7 @@ public function testSaveAndReplaceAdvancedPricesAddRowErrorCall(): void
328328
]
329329
];
330330
$this->dataSourceModel
331-
->method('getNextBunch')
331+
->method('getNextUniqueBunch')
332332
->willReturnOnConsecutiveCalls($testBunch);
333333
$this->advancedPricing->expects($this->once())->method('validateRow')->willReturn(false);
334334
$this->advancedPricing->method('saveProductPrices')->willReturnSelf();
@@ -400,7 +400,7 @@ public function testSaveAndReplaceAdvancedPricesAppendBehaviourDataAndCalls(
400400
->method('getBehavior')
401401
->willReturn(Import::BEHAVIOR_APPEND);
402402
$this->dataSourceModel
403-
->method('getNextBunch')
403+
->method('getNextUniqueBunch')
404404
->willReturnOnConsecutiveCalls($data);
405405
$advancedPricing->method('validateRow')->willReturn(true);
406406

@@ -524,7 +524,7 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls():
524524
Import::BEHAVIOR_REPLACE
525525
);
526526
$this->dataSourceModel
527-
->method('getNextBunch')
527+
->method('getNextUniqueBunch')
528528
->willReturnOnConsecutiveCalls($data);
529529
$this->advancedPricing->expects($this->once())->method('validateRow')->willReturn(true);
530530

@@ -577,7 +577,7 @@ public function testDeleteAdvancedPricingFormListSkuToDelete(): void
577577
];
578578

579579
$this->dataSourceModel
580-
->method('getNextBunch')
580+
->method('getNextUniqueBunch')
581581
->willReturnOnConsecutiveCalls($data);
582582
$this->advancedPricing->method('validateRow')->willReturn(true);
583583
$expectedSkuList = ['sku value'];

app/code/Magento/Analytics/Test/Mftf/ActionGroup/AssertAdminAdvancedReportingPageUrlActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
<switchToNextTab stepKey="switchToNewTab"/>
1717
<waitForPageLoad stepKey="waitForAdvancedReportingPageLoad"/>
18-
<seeInCurrentUrl url="reports/advanced-reporting" stepKey="seeAssertAdvancedReportingPageUrl"/>
18+
<seeInCurrentUrl url="report" stepKey="seeAssertAdvancedReportingPageUrl"/>
1919
</actionGroup>
2020
</actionGroups>

app/code/Magento/AwsS3/Driver/AwsS3.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,15 +861,21 @@ public function fileWrite($resource, $data)
861861
*/
862862
public function fileClose($resource): bool
863863
{
864+
if (!is_resource($resource)) {
865+
return false;
866+
}
864867
//phpcs:disable
865-
$resourcePath = stream_get_meta_data($resource)['uri'];
868+
$meta = stream_get_meta_data($resource);
866869
//phpcs:enable
867870

868871
foreach ($this->streams as $path => $stream) {
869872
// phpcs:ignore
870-
if (stream_get_meta_data($stream)['uri'] === $resourcePath) {
873+
if (stream_get_meta_data($stream)['uri'] === $meta['uri']) {
874+
if (isset($meta['seekable']) && $meta['seekable']) {
875+
// rewind the file pointer to make sure the full content of the file is saved
876+
$this->fileSeek($resource, 0);
877+
}
871878
$this->adapter->writeStream($path, $resource, new Config(self::CONFIG));
872-
873879
// Remove path from streams after
874880
unset($this->streams[$path]);
875881

app/code/Magento/AwsS3/Test/Unit/Driver/AwsS3Test.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,28 @@ public function testRenameSameDestination(): void
513513

514514
self::assertTrue($this->driver->rename('test/path', 'test/path'));
515515
}
516+
517+
public function testFileShouldBeRewindBeforeSave(): void
518+
{
519+
$resource = $this->driver->fileOpen('test/path', 'w');
520+
$this->driver->fileWrite($resource, 'abc');
521+
$this->adapterMock->method('fileExists')->willReturn(false);
522+
$this->adapterMock->expects($this->once())
523+
->method('writeStream')
524+
->with(
525+
'test/path',
526+
$this->callback(
527+
// assert that the file pointer is at the beginning of the file before saving it in aws
528+
fn ($stream) => $stream === $resource && is_resource($stream) && ftell($stream) === 0
529+
)
530+
);
531+
$this->driver->fileClose($resource);
532+
}
533+
534+
public function testFileCloseShouldReturnFalseIfTheArgumentIsNotAResource(): void
535+
{
536+
$this->assertEquals(false, $this->driver->fileClose(''));
537+
$this->assertEquals(false, $this->driver->fileClose(null));
538+
$this->assertEquals(false, $this->driver->fileClose(false));
539+
}
516540
}

0 commit comments

Comments
 (0)