Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #16564: Trim email address in newsletter, forgot password, checkout login and email to a friend form (by @dankhrapiyush)
 - #16474: [FIX] dev:di:info duplicates plugin info (by @coderimus)
 - #16143: Variable as a method parameter might be overridden by the loop (by @lfluvisotto)
 - #16254: Customer group extension attributes not carried over on save (by @JosephMaxwell)


Fixed GitHub Issues:
 - #6058: IE11 user login email validation fails if field has leading or trailing space (reported by @dnadle) has been fixed in #16564 by @dankhrapiyush in 2.2-develop branch
   Related commits:
     1. 873471a
     2. 9d84b2c
     3. d495275
     4. b827bd1
  • Loading branch information
magento-engcom-team authored Jul 9, 2018
2 parents d91c0c0 + 781c0d8 commit 8c8a626
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 17 deletions.
8 changes: 4 additions & 4 deletions app/code/Magento/Bundle/Model/Product/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,12 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option,

foreach ($selections as $selection) {
if ($selection->getProductId() == $optionProduct->getId()) {
foreach ($options as &$option) {
if ($option->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
foreach ($options as $quoteItemOption) {
if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) {
if ($optionUpdateFlag) {
$option->setValue(intval($option->getValue()));
$quoteItemOption->setValue(intval($quoteItemOption->getValue()));
} else {
$option->setValue($value);
$quoteItemOption->setValue($value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
type="email"
data-bind="
textInput: email,
hasFocus: emailFocused"
hasFocus: emailFocused,
mageInit: {'mage/trim-input':{}}"
name="username"
data-validate="{required:true, 'validate-email':true}"
id="customer-email" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ public function save(\Magento\Customer\Api\Data\GroupInterface $group)
->setCode($groupModel->getCode())
->setTaxClassId($groupModel->getTaxClassId())
->setTaxClassName($groupModel->getTaxClassName());

if ($group->getExtensionAttributes()) {
$groupDataObject->setExtensionAttributes($group->getExtensionAttributes());
}

return $groupDataObject;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class GroupRepositoryTest extends \PHPUnit\Framework\TestCase
*/
protected $group;

/**
* @var \Magento\Customer\Api\Data\GroupInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $factoryCreatedGroup;

/**
* @var \Magento\Customer\Model\ResourceModel\Group|\PHPUnit_Framework_MockObject_MockObject
*/
Expand Down Expand Up @@ -153,6 +158,12 @@ private function setupGroupObjects()
'group',
false
);
$this->factoryCreatedGroup = $this->getMockForAbstractClass(
\Magento\Customer\Api\Data\GroupInterface::class,
[],
'group',
false
);

$this->groupResourceModel = $this->createMock(\Magento\Customer\Model\ResourceModel\Group::class);
}
Expand All @@ -162,16 +173,22 @@ public function testSave()
$groupId = 0;

$taxClass = $this->getMockForAbstractClass(\Magento\Tax\Api\Data\TaxClassInterface::class, [], '', false);
$extensionAttributes = $this->getMockForAbstractClass(
\Magento\Customer\Api\Data\GroupExtensionInterface::class
);

$this->group->expects($this->once())
$this->group->expects($this->atLeastOnce())
->method('getCode')
->willReturn('Code');
$this->group->expects($this->atLeastOnce())
->method('getId')
->willReturn($groupId);
$this->group->expects($this->once())
$this->group->expects($this->atLeastOnce())
->method('getTaxClassId')
->willReturn(17);
$this->group->expects($this->atLeastOnce())
->method('getExtensionAttributes')
->willReturn($extensionAttributes);

$this->groupModel->expects($this->atLeastOnce())
->method('getId')
Expand All @@ -185,22 +202,33 @@ public function testSave()
$this->groupModel->expects($this->atLeastOnce())
->method('getTaxClassName')
->willReturn('Tax class name');
$this->group->expects($this->once())

$this->factoryCreatedGroup->expects($this->once())
->method('setId')
->with($groupId)
->willReturnSelf();
$this->group->expects($this->once())
$this->factoryCreatedGroup->expects($this->once())
->method('setCode')
->with('Code')
->willReturnSelf();
$this->group->expects($this->once())
$this->factoryCreatedGroup->expects($this->once())
->method('setTaxClassId')
->with(234)
->willReturnSelf();
$this->group->expects($this->once())
$this->factoryCreatedGroup->expects($this->once())
->method('setTaxClassName')
->with('Tax class name')
->willReturnSelf();
$this->factoryCreatedGroup->expects($this->once())
->method('setExtensionAttributes')
->with($extensionAttributes)
->willReturnSelf();
$this->factoryCreatedGroup->expects($this->atLeastOnce())
->method('getCode')
->willReturn('Code');
$this->factoryCreatedGroup->expects($this->atLeastOnce())
->method('getTaxClassId')
->willReturn(17);

$this->taxClassRepository->expects($this->once())
->method('get')
Expand Down Expand Up @@ -229,9 +257,12 @@ public function testSave()
->with($groupId);
$this->groupDataFactory->expects($this->once())
->method('create')
->willReturn($this->group);
->willReturn($this->factoryCreatedGroup);

$updatedGroup = $this->model->save($this->group);

$this->assertSame($this->group, $this->model->save($this->group));
$this->assertSame($this->group->getCode(), $updatedGroup->getCode());
$this->assertSame($this->group->getTaxClassId(), $updatedGroup->getTaxClassId());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="field email required">
<label for="email_address" class="label"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
<div class="control">
<input type="email" name="email" alt="email" id="email_address" class="input-text" value="<?= $block->escapeHtmlAttr($block->getEmailValue()) ?>" data-validate="{required:true, 'validate-email':true}">
<input type="email" name="email" alt="email" id="email_address" class="input-text" value="<?= $block->escapeHtmlAttr($block->getEmailValue()) ?>" data-mage-init='{"mage/trim-input":{}}' data-validate="{required:true, 'validate-email':true}">
</div>
</div>
<?= $block->getChildHtml('form_additional_info') ?>
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Developer/Model/Di/PluginList.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ private function addPluginToList($pluginInstance, $pluginMethod, $methodTypes, $
if (!array_key_exists($pluginInstance, $this->pluginList[$this->pluginTypeMapping[$typeCode]])) {
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance] = [];
}
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance][] = $pluginMethod ;

if (!in_array($pluginMethod, $this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance])) {
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance][] = $pluginMethod;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<div class="control">
<input name="email" type="email" id="newsletter"
placeholder="<?= $block->escapeHtmlAttr(__('Enter your email address')) ?>"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-email':true}"/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<div class="control">
<input name="recipients[email][<%- data._index_ %>]" title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
id="recipients-email<%- data._index_ %>" type="email" class="input-text"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-email':true}"/>
</div>
</div>
Expand Down Expand Up @@ -72,7 +73,8 @@
<label for="sender-email" class="label"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
<div class="control">
<input name="sender[email]" value="<?= $block->escapeHtmlAttr($block->getEmail()) ?>"
title="<?= $block->escapeHtmlAttr(__('Email')) ?>" id="sender-email" type="text" class="input-text"
title="<?= $block->escapeHtmlAttr(__('Email')) ?>" id="sender-email" type="email" class="input-text"
data-mage-init='{"mage/trim-input":{}}'
data-validate="{required:true, 'validate-email':true}"/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Theme/view/frontend/web/js/row-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ define([

$(tmpl).appendTo(row);

$(this.options.rowContainer).append(row);
$(this.options.rowContainer).append(row).trigger('contentUpdated');

row.addClass(this.options.additionalRowClass);

Expand Down

0 comments on commit 8c8a626

Please sign in to comment.