-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
…op latest changes Accepted Community Pull Requests: - #30076: Reduced html content of image details templates (by @sivaschenko) - #29979: fix incorrect image size when rendition is inserted (by @engcom-Golf) - #30044: #1832: Rename renditions stores config fieldset and add comments (by @joweecaquicla) - #29934: Fix gallery rendering on page load so current breakpoint configuration isn't replaced by any other configuration (by @Januszpl) - #25405: Fix inability to place PayPal guest order when Automatic Assignment to Customer Group is enabled (by @xylodev) - #25510: Fix for issue 25147 - Totals information management module - only set carrier/method code if set in address (by @joe-vortex) - #29274: Update Curl to respect case-insensitive headers (by @pmzandbergen) - #29542: Fix Parameter Tokenizer omitting first char of key (by @marvinhinz) Fixed GitHub Issues: - #1806: how to use require_once in magento2 (reported by @LifeAsBook) has been fixed in #29979 by @engcom-Golf in 2.4-develop branch Related commits: 1. 22da500 2. b5180c0 3. 7cfbc30 4. 9a6bd96 5. 9d0252a 6. e832db8 7. 1db2872 8. 837dd9d 9. 79ddf27 10. 1535626 11. cbc38f6 12. 0cafa20 13. ccd7251 14. 35642f7 15. f6f5a5e - #29933: Gallery multiply breakpoints options configuration doesn't work properly because of mediaCheck triggering exit media query function on page load (reported by @Januszpl) has been fixed in #29934 by @Januszpl in 2.4-develop branch Related commits: 1. faf6dfa 2. 9e53105 3. a46a395 4. c9b7a02 - #25399: Unable to place a guest order with PayPal Express when Enable Automatic Assignment to Customer Group is enabled (reported by @xylodev) has been fixed in #25405 by @xylodev in 2.4-develop branch Related commits: 1. 594fc93 2. fb299a0 3. f898245 4. 7f280cd - #25147: Totals Information Management - setting quote shipping method when address method is null (reported by @joe-vortex) has been fixed in #25510 by @joe-vortex in 2.4-develop branch Related commits: 1. a99d980 2. 1900ffc 3. 8820a5c 4. b0e0517 5. e4fb9d1 - #29524: [Issue] Update Curl to respect case-insensitive headers (reported by @m2-assistant[bot]) has been fixed in #29274 by @pmzandbergen in 2.4-develop branch Related commits: 1. 44d88e6 2. ba6513f 3. 730c495 4. 552e0c1 5. b5463b8 6. e43e45f 7. e1d21cd 8. 9570f8f 9. 9db1f83 10. d61e030 11. e912bdf 12. d5c674d - #29185: \Magento\Framework\Filter\Template\Tokenizer\Parameter (reported by @bernd-reindl) has been fixed in #29542 by @marvinhinz in 2.4-develop branch Related commits: 1. 4328a2d 2. 55a1543 3. 1b322f4
- Loading branch information
Showing
30 changed files
with
1,010 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
app/code/Magento/Checkout/Test/Unit/Model/TotalsInformationManagementTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Checkout\Test\Unit\Model; | ||
|
||
use Magento\Checkout\Api\Data\TotalsInformationInterface; | ||
use Magento\Checkout\Model\TotalsInformationManagement; | ||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; | ||
use Magento\Quote\Api\CartRepositoryInterface; | ||
use Magento\Quote\Api\CartTotalRepositoryInterface; | ||
use Magento\Quote\Model\Quote\Address; | ||
|
||
class TotalsInformationManagementTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var ObjectManager | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var CartRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject | ||
*/ | ||
private $cartRepositoryMock; | ||
|
||
/** | ||
* @var CartTotalRepositoryInterface|\PHPUnit\Framework\MockObject\MockObject | ||
*/ | ||
private $cartTotalRepositoryMock; | ||
|
||
/** | ||
* @var TotalsInformationManagement | ||
*/ | ||
private $totalsInformationManagement; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->objectManager = new ObjectManager($this); | ||
$this->cartRepositoryMock = $this->createMock( | ||
CartRepositoryInterface::class | ||
); | ||
$this->cartTotalRepositoryMock = $this->createMock( | ||
CartTotalRepositoryInterface::class | ||
); | ||
|
||
$this->totalsInformationManagement = $this->objectManager->getObject( | ||
TotalsInformationManagement::class, | ||
[ | ||
'cartRepository' => $this->cartRepositoryMock, | ||
'cartTotalRepository' => $this->cartTotalRepositoryMock, | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* Test for \Magento\Checkout\Model\TotalsInformationManagement::calculate. | ||
* | ||
* @param string|null $carrierCode | ||
* @param string|null $carrierMethod | ||
* @param int $methodSetCount | ||
* @dataProvider dataProviderCalculate | ||
*/ | ||
public function testCalculate(?string $carrierCode, ?string $carrierMethod, int $methodSetCount) | ||
{ | ||
$cartId = 1; | ||
$cartMock = $this->createMock( | ||
\Magento\Quote\Model\Quote::class | ||
); | ||
$cartMock->expects($this->once())->method('getItemsCount')->willReturn(1); | ||
$cartMock->expects($this->once())->method('getIsVirtual')->willReturn(false); | ||
$this->cartRepositoryMock->expects($this->once())->method('get')->with($cartId)->willReturn($cartMock); | ||
$this->cartTotalRepositoryMock->expects($this->once())->method('get')->with($cartId); | ||
|
||
$addressInformationMock = $this->createMock( | ||
TotalsInformationInterface::class | ||
); | ||
$addressMock = $this->getMockBuilder(Address::class) | ||
->addMethods( | ||
[ | ||
'setShippingMethod', | ||
'setCollectShippingRates', | ||
] | ||
) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$addressInformationMock->expects($this->once())->method('getAddress')->willReturn($addressMock); | ||
$addressInformationMock->expects($this->any())->method('getShippingCarrierCode')->willReturn($carrierCode); | ||
$addressInformationMock->expects($this->any())->method('getShippingMethodCode')->willReturn($carrierMethod); | ||
$cartMock->expects($this->once())->method('setShippingAddress')->with($addressMock); | ||
$cartMock->expects($this->exactly($methodSetCount))->method('getShippingAddress')->willReturn($addressMock); | ||
$addressMock->expects($this->exactly($methodSetCount)) | ||
->method('setCollectShippingRates')->with(true)->willReturn($addressMock); | ||
$addressMock->expects($this->exactly($methodSetCount)) | ||
->method('setShippingMethod')->with($carrierCode . '_' . $carrierMethod); | ||
$cartMock->expects($this->once())->method('collectTotals'); | ||
|
||
$this->totalsInformationManagement->calculate($cartId, $addressInformationMock); | ||
} | ||
|
||
/** | ||
* Data provider for testCalculate. | ||
* | ||
* @return array | ||
*/ | ||
public function dataProviderCalculate(): array | ||
{ | ||
return [ | ||
[ | ||
null, | ||
null, | ||
0 | ||
], | ||
[ | ||
null, | ||
'carrier_method', | ||
0 | ||
], | ||
[ | ||
'carrier_code', | ||
null, | ||
0 | ||
], | ||
[ | ||
'carrier_code', | ||
'carrier_method', | ||
1 | ||
] | ||
]; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...o/MediaGalleryRenditions/Test/Mftf/Test/AdminMediaGalleryInsertLargeImageFileSizeTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> | ||
<test name="AdminMediaGalleryInsertLargeImageFileSizeTest"> | ||
<annotations> | ||
<features value="AdminMediaGalleryInsertLargeImageFileSizeTest"/> | ||
<useCaseId value="https://github.com/magento/adobe-stock-integration/issues/1806"/> | ||
<title value="Admin user should see correct image file size after rendition"/> | ||
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/1507933/scenarios/5200023"/> | ||
<stories value="User inserts image rendition to the content"/> | ||
<description value="Admin user should see correct image file size after rendition"/> | ||
<severity value="AVERAGE"/> | ||
<group value="media_gallery_ui"/> | ||
</annotations> | ||
<before> | ||
<createData entity="SimpleSubCategory" stepKey="category"/> | ||
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> | ||
</before> | ||
<after> | ||
<!-- Delete uploaded image --> | ||
<actionGroup ref="AdminOpenCategoryGridPageActionGroup" stepKey="openCategoryPageFoDelete"/> | ||
<actionGroup ref="AdminEditCategoryInGridPageActionGroup" stepKey="editCategoryItemForDelete"> | ||
<argument name="categoryName" value="$category.name$"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminOpenMediaGalleryFromCategoryImageUploaderActionGroup" stepKey="openMediaGalleryForDelete"/> | ||
<actionGroup ref="AdminEnhancedMediaGalleryEnableMassActionModeActionGroup" stepKey="enableMassActionToDeleteImages"/> | ||
<actionGroup ref="AdminEnhancedMediaGallerySelectImageForMassActionActionGroup" stepKey="selectSecondImageToDelete"> | ||
<argument name="imageName" value="{{ImageUpload.fileName}}"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminEnhancedMediaGalleryClickDeleteImagesButtonActionGroup" stepKey="clickDeleteSelectedButton"/> | ||
<actionGroup ref="AdminEnhancedMediaGalleryConfirmDeleteImagesActionGroup" stepKey="deleteImages"/> | ||
|
||
<!-- Delete category --> | ||
<deleteData createDataKey="category" stepKey="deleteCategory"/> | ||
</after> | ||
|
||
<!-- Open category page --> | ||
<actionGroup ref="AdminOpenCategoryGridPageActionGroup" stepKey="openCategoryPage"/> | ||
<actionGroup ref="AdminEditCategoryInGridPageActionGroup" stepKey="editCategoryItem"> | ||
<argument name="categoryName" value="$category.name$"/> | ||
</actionGroup> | ||
|
||
<!-- Add image to category from gallery --> | ||
<actionGroup ref="AdminOpenMediaGalleryFromCategoryImageUploaderActionGroup" stepKey="openMediaGallery"/> | ||
<actionGroup ref="AdminEnhancedMediaGalleryUploadImageActionGroup" stepKey="addCategoryImage"> | ||
<argument name="image" value="ImageUpload"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminMediaGalleryClickImageInGridActionGroup" stepKey="selectImage"> | ||
<argument name="imageName" value="{{ImageUpload.fileName}}"/> | ||
</actionGroup> | ||
<actionGroup ref="AdminMediaGalleryClickAddSelectedActionGroup" stepKey="addSelected"/> | ||
|
||
|
||
<!-- Assert added image size --> | ||
<actionGroup ref="AdminAssertImageUploadFileSizeThanActionGroup" stepKey="assertSize"> | ||
<argument name="fileSize" value="26 KB"/> | ||
</actionGroup> | ||
</test> | ||
</tests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Image/OnInsert.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Magento\MediaGalleryUi\Controller\Adminhtml\Image; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\Result\JsonFactory; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use Magento\MediaGalleryUi\Model\InsertImageData\GetInsertImageData; | ||
|
||
/** | ||
* OnInsert action returns on insert image details | ||
*/ | ||
class OnInsert extends Action implements HttpPostActionInterface | ||
{ | ||
/** | ||
* @see _isAllowed() | ||
*/ | ||
public const ADMIN_RESOURCE = 'Magento_MediaGalleryUiApi::insert_assets'; | ||
|
||
/** | ||
* @var JsonFactory | ||
*/ | ||
private $resultJsonFactory; | ||
|
||
/** | ||
* @var GetInsertImageData | ||
*/ | ||
private $getInsertImageData; | ||
|
||
/** | ||
* @param Context $context | ||
* @param JsonFactory $resultJsonFactory | ||
* @param GetInsertImageData $getInsertImageData | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
JsonFactory $resultJsonFactory, | ||
GetInsertImageData $getInsertImageData | ||
) { | ||
parent::__construct($context); | ||
$this->resultJsonFactory = $resultJsonFactory; | ||
$this->getInsertImageData = $getInsertImageData; | ||
} | ||
|
||
/** | ||
* Return a content (just a link or an html block) for inserting image to the content | ||
* | ||
* @return ResultInterface | ||
*/ | ||
public function execute() | ||
{ | ||
$data = $this->getRequest()->getParams(); | ||
$insertImageData = $this->getInsertImageData->execute( | ||
$data['filename'], | ||
(bool)$data['force_static_path'], | ||
(bool)$data['as_is'], | ||
isset($data['store']) ? (int)$data['store'] : null | ||
); | ||
|
||
return $this->resultJsonFactory->create()->setData([ | ||
'content' => $insertImageData->getContent(), | ||
'size' => $insertImageData->getSize(), | ||
'type' => $insertImageData->getType(), | ||
]); | ||
} | ||
} |
Oops, something went wrong.