Skip to content

Commit 6d69505

Browse files
authored
Merge branch '2.4-develop' into B2B-2452
2 parents ad6c694 + bd74c82 commit 6d69505

File tree

178 files changed

+4772
-1236
lines changed

Some content is hidden

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

178 files changed

+4772
-1236
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ protected function saveAndReplaceAdvancedPrices()
416416
'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
417417
];
418418
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
419-
$bunchTierPrices[$rowSku][] = $tierPrice;
419+
$bunchTierPrices[$rowSku][] = $tierPrice;
420420
}
421421
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
422422
$tierPrices[$rowSku][] = $tierPrice;
@@ -436,9 +436,7 @@ protected function saveAndReplaceAdvancedPrices()
436436
if ($listSku) {
437437
$this->setUpdatedAt($listSku);
438438
}
439-
}
440-
441-
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
439+
} elseif (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
442440
if ($listSku) {
443441
$this->processCountNewPrices($tierPrices);
444442
if ($this->deleteProductTierPrices(array_unique($listSku), self::TABLE_TIER_PRICE)) {
@@ -447,6 +445,7 @@ protected function saveAndReplaceAdvancedPrices()
447445
}
448446
}
449447
}
448+
$this->finalizeCount();
450449

451450
return $this;
452451
}
@@ -651,11 +650,18 @@ protected function processCountNewPrices(array $tierPrices)
651650
foreach ($tierPrices as $productPrices) {
652651
$this->countItemsCreated += count($productPrices);
653652
}
654-
$this->countItemsCreated -= $this->countItemsUpdated;
655653

656654
return $this;
657655
}
658656

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

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
}

app/code/Magento/Backend/Test/Unit/Model/Menu/Config/XsdTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ protected function setUp(): void
4242
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
4343
{
4444
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45-
$this->assertEquals($expectedError, $actualError);
45+
$this->assertEquals(false, empty($actualError));
46+
foreach ($expectedError as $error) {
47+
$this->assertContains($error, $actualError);
48+
}
4649
}
4750

4851
public function testSchemaCorrectlyIdentifiesValidXml()

0 commit comments

Comments
 (0)