Skip to content

Commit 0b968b8

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #23710: [2.3] Improve Database Media Storage Configuration settings usability (by @gwharton) - #23592: [Unit] Fix broken unit tests (by @Den4ik) - #23649: [2.3] Transfer Encoding of emails changed to QUOTED-PRINTABLE (by @gwharton) - #23652: Add missing getClass() to image.phtml so it is more like image_with_borders.phtml (by @woutersamaey) - #23291: Optimized dev:urn-catalog:generate for PHPStorm (by @JeroenBoersma) - #23735: Fixed typo in deploy module README.md (by @arnolds) Fixed GitHub Issues: - #23597: Database Media Storage : Difficulty changing mode to database media storage due to poor "Use Default Value" checkbox behaviour (reported by @gwharton) has been fixed in #23710 by @gwharton in 2.3-develop branch Related commits: 1. 85e5375 2. a974261 - #23643: Mime parts of email are no more encoded with quoted printable (reported by @ffauvel) has been fixed in #23649 by @gwharton in 2.3-develop branch Related commits: 1. 226009e
2 parents 5b1f2ef + 79b0984 commit 0b968b8

File tree

24 files changed

+166
-90
lines changed

24 files changed

+166
-90
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/image.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
?>
77
<?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?>
88

9-
<img class="photo image"
9+
<img class="photo image <?= $block->escapeHtmlAttr($block->getClass()) ?>"
1010
<?= $block->escapeHtml($block->getCustomAttributes()) ?>
1111
src="<?= $block->escapeUrl($block->getImageUrl()) ?>"
1212
width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>"

app/code/Magento/Deploy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Deploy is a module that holds collection of services and command line tools to h
55
To execute this command, please, run "bin/magento setup:static-content:deploy" from the Magento root directory.
66
Deploy module contains 2 additional commands that allows switching between application modes (for instance from
77
development to
8-
production) and show current application mode. To change the mode run "bin/magento setup:mode:set [mode]".
8+
production) and show current application mode. To change the mode run "bin/magento deploy:mode:set [mode]".
99
Where mode can be one of the following:
1010
- development
1111
- production

app/code/Magento/Developer/Model/XmlCatalog/Format/PhpStorm.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
class PhpStorm implements FormatInterface
2020
{
21+
private const PROJECT_PATH_IDENTIFIER = '$PROJECT_DIR$';
22+
2123
/**
2224
* @var ReadInterface
2325
*/
@@ -95,7 +97,7 @@ public function generateCatalog(array $dictionary, $configFilePath)
9597
foreach ($dictionary as $urn => $xsdPath) {
9698
$node = $dom->createElement('resource');
9799
$node->setAttribute('url', $urn);
98-
$node->setAttribute('location', $xsdPath);
100+
$node->setAttribute('location', $this->getFileLocationInProject($xsdPath));
99101
$componentNode->appendChild($node);
100102
}
101103
$dom->formatOutput = true;
@@ -129,4 +131,15 @@ private function initEmptyFile(\DOMDocument $dom)
129131
$projectNode->appendChild($rootComponentNode);
130132
return $projectNode;
131133
}
134+
135+
/**
136+
* Resolve xsdpath to xml project path
137+
*
138+
* @param string $xsdPath
139+
* @return string
140+
*/
141+
private function getFileLocationInProject(string $xsdPath): string
142+
{
143+
return self::PROJECT_PATH_IDENTIFIER . DIRECTORY_SEPARATOR . $this->currentDirRead->getRelativePath($xsdPath);
144+
}
132145
}

app/code/Magento/MediaStorage/etc/adminhtml/system.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<section id="system" type="text" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="1">
1111
<group id="media_storage_configuration" translate="label" type="text" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="1">
1212
<label>Storage Configuration for Media</label>
13-
<field id="media_storage" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
13+
<field id="media_storage" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0">
1414
<label>Media Storage</label>
1515
<source_model>Magento\MediaStorage\Model\Config\Source\Storage\Media\Storage</source_model>
1616
</field>
17-
<field id="media_database" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
17+
<field id="media_database" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="0" showInStore="0">
1818
<label>Select Media Database</label>
1919
<source_model>Magento\MediaStorage\Model\Config\Source\Storage\Media\Database</source_model>
2020
<backend_model>Magento\MediaStorage\Model\Config\Backend\Storage\Media\Database</backend_model>
@@ -24,7 +24,7 @@
2424
</field>
2525
<field id="synchronize" translate="label comment" type="button" sortOrder="300" showInDefault="1" showInWebsite="0" showInStore="0">
2626
<frontend_model>Magento\MediaStorage\Block\System\Config\System\Storage\Media\Synchronize</frontend_model>
27-
<comment>After selecting a new media storage location, press the Synchronize button to transfer all media to that location. Media will not be available in the new location until the synchronization process is complete.</comment>
27+
<comment>After selecting a new media storage location, press the Synchronize button to transfer all media to that location and then "Save Config". Media will not be available in the new location until the synchronization process is complete.</comment>
2828
</field>
2929
<field id="configuration_update_time" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
3030
<label>Environment Update Time</label>

app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
use PHPUnit_Framework_MockObject_MockObject as MockObject;
3030

3131
/**
32+
* Paypal transparent test class
33+
*
3234
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3335
*/
3436
class TransparentTest extends \PHPUnit\Framework\TestCase
@@ -194,7 +196,7 @@ private function getPaymentExtensionInterfaceFactory()
194196
->disableOriginalConstructor()
195197
->getMock();
196198
$orderPaymentExtension = $this->getMockBuilder(OrderPaymentExtensionInterface::class)
197-
->setMethods(['setVaultPaymentToken'])
199+
->setMethods(['setVaultPaymentToken', 'getVaultPaymentToken'])
198200
->disableOriginalConstructor()
199201
->getMock();
200202

app/code/Magento/Reports/Model/ResourceModel/Product/Collection.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

7-
/**
8-
* @author Magento Core Team <[email protected]>
9-
*/
108
namespace Magento\Reports\Model\ResourceModel\Product;
119

10+
use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory;
11+
1212
/**
1313
* Products Report collection.
1414
*
@@ -90,6 +90,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
9090
* @param \Magento\Catalog\Model\Product\Type $productType
9191
* @param \Magento\Quote\Model\ResourceModel\Quote\Collection $quoteResource
9292
* @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection
93+
* @param ProductLimitationFactory|null $productLimitationFactory
9394
*
9495
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
9596
*/
@@ -117,7 +118,8 @@ public function __construct(
117118
\Magento\Reports\Model\Event\TypeFactory $eventTypeFactory,
118119
\Magento\Catalog\Model\Product\Type $productType,
119120
\Magento\Quote\Model\ResourceModel\Quote\Collection $quoteResource,
120-
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null
121+
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
122+
ProductLimitationFactory $productLimitationFactory = null
121123
) {
122124
$this->setProductEntityId($product->getEntityIdField());
123125
$this->setProductEntityTableName($product->getEntityTable());
@@ -142,7 +144,8 @@ public function __construct(
142144
$customerSession,
143145
$dateTime,
144146
$groupManagement,
145-
$connection
147+
$connection,
148+
$productLimitationFactory
146149
);
147150
$this->_eventTypeFactory = $eventTypeFactory;
148151
$this->_productType = $productType;

app/code/Magento/Reports/Test/Unit/Model/ResourceModel/Product/CollectionTest.php

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Reports\Test\Unit\Model\ResourceModel\Product;
89

@@ -12,6 +13,8 @@
1213
use Magento\Catalog\Model\Product\Type as ProductType;
1314
use Magento\Catalog\Model\ResourceModel\Helper;
1415
use Magento\Catalog\Model\ResourceModel\Product as ResourceProduct;
16+
use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitation;
17+
use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory;
1518
use Magento\Catalog\Model\ResourceModel\Url;
1619
use Magento\Customer\Api\GroupManagementInterface;
1720
use Magento\Customer\Model\Session;
@@ -75,6 +78,11 @@ class CollectionTest extends \PHPUnit\Framework\TestCase
7578
*/
7679
private $selectMock;
7780

81+
/**
82+
* SetUp method
83+
*
84+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
85+
*/
7886
protected function setUp()
7987
{
8088
$this->objectManager = new ObjectManager($this);
@@ -138,31 +146,44 @@ protected function setUp()
138146
$this->resourceMock->expects($this->atLeastOnce())->method('getConnection')->willReturn($this->connectionMock);
139147
$this->connectionMock->expects($this->atLeastOnce())->method('select')->willReturn($this->selectMock);
140148

141-
$this->collection = new ProductCollection(
142-
$entityFactoryMock,
143-
$loggerMock,
144-
$fetchStrategyMock,
145-
$eventManagerMock,
146-
$eavConfigMock,
147-
$this->resourceMock,
148-
$eavEntityFactoryMock,
149-
$resourceHelperMock,
150-
$universalFactoryMock,
151-
$storeManagerMock,
152-
$moduleManagerMock,
153-
$productFlatStateMock,
154-
$scopeConfigMock,
155-
$optionFactoryMock,
156-
$catalogUrlMock,
157-
$localeDateMock,
158-
$customerSessionMock,
159-
$dateTimeMock,
160-
$groupManagementMock,
161-
$productMock,
162-
$this->eventTypeFactoryMock,
163-
$productTypeMock,
164-
$quoteResourceMock,
165-
$this->connectionMock
149+
$productLimitationFactoryMock = $this->createPartialMock(
150+
ProductLimitationFactory::class,
151+
['create']
152+
);
153+
$productLimitation = $this->createMock(ProductLimitation::class);
154+
$productLimitationFactoryMock->expects($this->once())
155+
->method('create')
156+
->willReturn($productLimitation);
157+
158+
$this->collection = $this->objectManager->getObject(
159+
ProductCollection::class,
160+
[
161+
'entityFactory' => $entityFactoryMock,
162+
'logger' => $loggerMock,
163+
'fetchStrategy' => $fetchStrategyMock,
164+
'eventManager' => $eventManagerMock,
165+
'eavConfig' => $eavConfigMock,
166+
'resource' => $this->resourceMock,
167+
'eavEntityFactory' => $eavEntityFactoryMock,
168+
'resourceHelper' => $resourceHelperMock,
169+
'universalFactory' => $universalFactoryMock,
170+
'storeManager' => $storeManagerMock,
171+
'moduleManager' => $moduleManagerMock,
172+
'catalogProductFlatState' => $productFlatStateMock,
173+
'scopeConfig' => $scopeConfigMock,
174+
'productOptionFactory' => $optionFactoryMock,
175+
'catalogUrl' => $catalogUrlMock,
176+
'localeDate' => $localeDateMock,
177+
'customerSession' => $customerSessionMock,
178+
'dateTime' => $dateTimeMock,
179+
'groupManagement' => $groupManagementMock,
180+
'product' => $productMock,
181+
'eventTypeFactory' => $this->eventTypeFactoryMock,
182+
'productType' => $productTypeMock,
183+
'quoteResource' => $quoteResourceMock,
184+
'connection' => $this->connectionMock,
185+
'productLimitationFactory' => $productLimitationFactoryMock
186+
]
166187
);
167188
}
168189

app/code/Magento/Vault/Test/Unit/Model/Method/VaultTest.php

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Vault\Test\Unit\Model\Method;
79

810
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
@@ -25,6 +27,7 @@
2527

2628
/**
2729
* Class VaultTest
30+
*
2831
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2932
*/
3033
class VaultTest extends \PHPUnit\Framework\TestCase
@@ -140,7 +143,7 @@ public function testAuthorize()
140143
->disableOriginalConstructor()
141144
->getMock();
142145
$extensionAttributes = $this->getMockBuilder(OrderPaymentExtensionInterface::class)
143-
->setMethods(['setVaultPaymentToken'])
146+
->setMethods(['setVaultPaymentToken', 'getVaultPaymentToken'])
144147
->getMockForAbstractClass();
145148

146149
$commandManagerPool = $this->createMock(CommandManagerPoolInterface::class);
@@ -235,7 +238,7 @@ public function testCapture()
235238
}
236239

237240
/**
238-
* @covers \Magento\Vault\Model\Method\Vault::isAvailable
241+
* @covers \Magento\Vault\Model\Method\Vault::isAvailable
239242
* @dataProvider isAvailableDataProvider
240243
*/
241244
public function testIsAvailable($isAvailableProvider, $isActive, $expected)
@@ -251,18 +254,24 @@ public function testIsAvailable($isAvailableProvider, $isActive, $expected)
251254

252255
$config->expects(static::any())
253256
->method('getValue')
254-
->with('active', $storeId)
257+
->with(
258+
'active',
259+
$storeId
260+
)
255261
->willReturn($isActive);
256262

257263
$quote->expects(static::any())
258264
->method('getStoreId')
259265
->willReturn($storeId);
260266

261267
/** @var Vault $model */
262-
$model = $this->objectManager->getObject(Vault::class, [
263-
'config' => $config,
264-
'vaultProvider' => $this->vaultProvider
265-
]);
268+
$model = $this->objectManager->getObject(
269+
Vault::class,
270+
[
271+
'config' => $config,
272+
'vaultProvider' => $this->vaultProvider
273+
]
274+
);
266275
$actual = $model->isAvailable($quote);
267276
static::assertEquals($expected, $actual);
268277
}
@@ -296,19 +305,25 @@ public function testIsAvailableWithoutQuote()
296305

297306
$config->expects(static::once())
298307
->method('getValue')
299-
->with('active', $quote)
308+
->with(
309+
'active',
310+
$quote
311+
)
300312
->willReturn(false);
301313

302314
/** @var Vault $model */
303-
$model = $this->objectManager->getObject(Vault::class, [
304-
'config' => $config,
305-
'vaultProvider' => $this->vaultProvider
306-
]);
315+
$model = $this->objectManager->getObject(
316+
Vault::class,
317+
[
318+
'config' => $config,
319+
'vaultProvider' => $this->vaultProvider
320+
]
321+
);
307322
static::assertFalse($model->isAvailable($quote));
308323
}
309324

310325
/**
311-
* @covers \Magento\Vault\Model\Method\Vault::canUseInternal
326+
* @covers \Magento\Vault\Model\Method\Vault::canUseInternal
312327
* @param bool|null $configValue
313328
* @param bool|null $paymentValue
314329
* @param bool $expected
@@ -326,18 +341,24 @@ public function testCanUseInternal($configValue, $paymentValue, $expected)
326341

327342
$handler->expects(static::once())
328343
->method('handle')
329-
->with(['field' => 'can_use_internal'], null)
344+
->with(
345+
['field' => 'can_use_internal'],
346+
null
347+
)
330348
->willReturn($configValue);
331349

332350
$this->vaultProvider->expects(static::any())
333351
->method('canUseInternal')
334352
->willReturn($paymentValue);
335353

336354
/** @var Vault $model */
337-
$model = $this->objectManager->getObject(Vault::class, [
338-
'vaultProvider' => $this->vaultProvider,
339-
'valueHandlerPool' => $handlerPool,
340-
]);
355+
$model = $this->objectManager->getObject(
356+
Vault::class,
357+
[
358+
'vaultProvider' => $this->vaultProvider,
359+
'valueHandlerPool' => $handlerPool,
360+
]
361+
);
341362
static::assertEquals($expected, $model->canUseInternal());
342363
}
343364

dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ public function testConfirmationEmailWithSpecialCharacters(): void
771771

772772
$this->assertContains('To: ' . $email, $rawMessage);
773773

774-
$content = $message->getBody()->getPartContent(0);
774+
$content = $message->getBody()->getParts()[0]->getRawContent();
775775
$confirmationUrl = $this->getConfirmationUrlFromMessageContent($content);
776776
$this->setRequestInfo($confirmationUrl, 'confirm');
777777
$this->clearCookieMessagesList();

dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\TestFramework\Mail\Template\TransportBuilderMock;
99

10+
/**
11+
* \Magento\Newsletter\Model\Subscriber tests
12+
*/
1013
class SubscriberTest extends \PHPUnit\Framework\TestCase
1114
{
1215
/**
@@ -35,7 +38,7 @@ public function testEmailConfirmation()
3538
$this->assertContains(
3639
'/newsletter/subscriber/confirm/id/' . $this->model->getSubscriberId()
3740
. '/code/ysayquyajua23iq29gxwu2eax2qb6gvy',
38-
$transportBuilder->getSentMessage()->getRawMessage()
41+
$transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent()
3942
);
4043
$this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->model->getSubscriberStatus());
4144
}

dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/Create/SaveTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testSendEmailOnOrderSave(): void
142142
);
143143

144144
$this->assertEquals($message->getSubject(), $subject);
145-
$this->assertThat($message->getRawMessage(), $assert);
145+
$this->assertThat($message->getBody()->getParts()[0]->getRawContent(), $assert);
146146
}
147147

148148
/**

0 commit comments

Comments
 (0)