Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit e4a433b

Browse files
Merge branch '2.2-develop' of github.com:magento/magento2ce into MAGETWO-80191
2 parents 481b069 + de58c64 commit e4a433b

File tree

21 files changed

+284
-170
lines changed

21 files changed

+284
-170
lines changed

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ env:
2929
- TEST_SUITE=integration INTEGRATION_INDEX=1
3030
- TEST_SUITE=integration INTEGRATION_INDEX=2
3131
- TEST_SUITE=integration INTEGRATION_INDEX=3
32-
- TEST_SUITE=functional ACCEPTANCE_INDEX=1
33-
- TEST_SUITE=functional ACCEPTANCE_INDEX=2
32+
- TEST_SUITE=functional
3433
matrix:
3534
exclude:
3635
- php: 7.0
@@ -40,9 +39,7 @@ matrix:
4039
- php: 7.0
4140
env: TEST_SUITE=js GRUNT_COMMAND=static
4241
- php: 7.0
43-
env: TEST_SUITE=functional ACCEPTANCE_INDEX=1
44-
- php: 7.0
45-
env: TEST_SUITE=functional ACCEPTANCE_INDEX=2
42+
env: TEST_SUITE=functional
4643
cache:
4744
apt: true
4845
directories:

app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Item/StockItemCriteriaMapper.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,9 @@ public function mapWebsiteFilter($website)
9999
/**
100100
* @inheritdoc
101101
*/
102-
public function mapProductsFilter($products)
102+
public function mapProductsFilter(...$products)
103103
{
104104
$productIds = [];
105-
if (!is_array($products)) {
106-
$products = [$products];
107-
}
108105
foreach ($products as $product) {
109106
if ($product instanceof \Magento\Catalog\Model\Product) {
110107
$productIds[] = $product->getId();

app/code/Magento/CatalogInventory/Model/ResourceModel/Stock/Status/StockStatusCriteriaMapper.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,9 @@ public function mapWebsiteFilter($website)
5656
* @param int|array|\Magento\Catalog\Model\Product|\Magento\Catalog\Model\Product[] $products
5757
* @return void
5858
*/
59-
public function mapProductsFilter($products)
59+
public function mapProductsFilter(...$products)
6060
{
6161
$productIds = [];
62-
if (!is_array($products)) {
63-
$products = [$products];
64-
}
6562
foreach ($products as $product) {
6663
if ($product instanceof \Magento\Catalog\Model\Product) {
6764
$productIds[] = $product->getId();

app/code/Magento/Cron/etc/cron_groups.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<schedule_ahead_for>20</schedule_ahead_for>
1212
<schedule_lifetime>15</schedule_lifetime>
1313
<history_cleanup_every>10</history_cleanup_every>
14-
<history_success_lifetime>60</history_success_lifetime>
15-
<history_failure_lifetime>600</history_failure_lifetime>
14+
<history_success_lifetime>10080</history_success_lifetime>
15+
<history_failure_lifetime>10080</history_failure_lifetime>
1616
<use_separate_process>0</use_separate_process>
1717
</group>
1818
</config>

app/code/Magento/Customer/Test/Unit/Ui/Component/DataProvider/DocumentTest.php

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Magento\Customer\Ui\Component\DataProvider\Document;
1414
use Magento\Framework\Api\AttributeValue;
1515
use Magento\Framework\Api\AttributeValueFactory;
16+
use Magento\Framework\App\Config\ScopeConfigInterface;
17+
use Magento\Framework\Phrase;
1618
use Magento\Store\Api\Data\WebsiteInterface;
1719
use Magento\Store\Model\StoreManagerInterface;
1820
use PHPUnit_Framework_MockObject_MockObject as MockObject;
@@ -44,6 +46,11 @@ class DocumentTest extends \PHPUnit\Framework\TestCase
4446
*/
4547
private $storeManager;
4648

49+
/**
50+
* @var ScopeConfigInterface|MockObject
51+
*/
52+
private $scopeConfig;
53+
4754
/**
4855
* @var Document
4956
*/
@@ -59,11 +66,14 @@ protected function setUp()
5966

6067
$this->storeManager = $this->getMockForAbstractClass(StoreManagerInterface::class);
6168

69+
$this->scopeConfig = $this->getMockForAbstractClass(ScopeConfigInterface::class);
70+
6271
$this->document = new Document(
6372
$this->attributeValueFactory,
6473
$this->groupRepository,
6574
$this->customerMetadata,
66-
$this->storeManager
75+
$this->storeManager,
76+
$this->scopeConfig
6777
);
6878
}
6979

@@ -156,6 +166,41 @@ public function testGetWebsiteAttribute()
156166
static::assertEquals('Main Website', $attribute->getValue());
157167
}
158168

169+
/**
170+
* @covers \Magento\Customer\Ui\Component\DataProvider\Document::getCustomAttribute
171+
*/
172+
public function testGetConfirmationAttribute()
173+
{
174+
$websiteId = 1;
175+
$this->document->setData('original_website_id', $websiteId);
176+
177+
$this->scopeConfig->expects(static::once())
178+
->method('getValue')
179+
->with()
180+
->willReturn(true);
181+
182+
$this->document->setData('confirmation', null);
183+
$attribute = $this->document->getCustomAttribute('confirmation');
184+
185+
$value = $attribute->getValue();
186+
static::assertInstanceOf(Phrase::class, $value);
187+
static::assertEquals('Confirmed', (string)$value);
188+
}
189+
190+
/**
191+
* @covers \Magento\Customer\Ui\Component\DataProvider\Document::getCustomAttribute
192+
*/
193+
public function testGetAccountLockValue()
194+
{
195+
$this->document->setData('lock_expires', null);
196+
197+
$attribute = $this->document->getCustomAttribute('lock_expires');
198+
199+
$value = $attribute->getValue();
200+
static::assertInstanceOf(Phrase::class, $value);
201+
static::assertEquals('Unlocked', (string)$value);
202+
}
203+
159204
/**
160205
* Create mock for attribute value factory
161206
* @return void

app/code/Magento/Customer/Ui/Component/DataProvider/Document.php

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
namespace Magento\Customer\Ui\Component\DataProvider;
77

88
use Magento\Customer\Api\CustomerMetadataInterface;
9+
use Magento\Customer\Model\AccountManagement;
910
use Magento\Framework\Api\AttributeValueFactory;
11+
use Magento\Framework\App\Config\ScopeConfigInterface;
1012
use Magento\Framework\Exception\NoSuchEntityException;
1113
use Magento\Customer\Api\GroupRepositoryInterface;
14+
use Magento\Framework\App\ObjectManager;
15+
use Magento\Store\Model\ScopeInterface;
1216
use Magento\Store\Model\StoreManagerInterface;
1317

1418
/**
@@ -31,6 +35,21 @@ class Document extends \Magento\Framework\View\Element\UiComponent\DataProvider\
3135
*/
3236
private static $websiteAttributeCode = 'website_id';
3337

38+
/**
39+
* @var string
40+
*/
41+
private static $websiteIdAttributeCode = 'original_website_id';
42+
43+
/**
44+
* @var string
45+
*/
46+
private static $confirmationAttributeCode = 'confirmation';
47+
48+
/**
49+
* @var string
50+
*/
51+
private static $accountLockAttributeCode = 'lock_expires';
52+
3453
/**
3554
* @var CustomerMetadataInterface
3655
*/
@@ -46,23 +65,31 @@ class Document extends \Magento\Framework\View\Element\UiComponent\DataProvider\
4665
*/
4766
private $storeManager;
4867

68+
/**
69+
* @var ScopeConfigInterface
70+
*/
71+
private $scopeConfig;
72+
4973
/**
5074
* Document constructor.
5175
* @param AttributeValueFactory $attributeValueFactory
5276
* @param GroupRepositoryInterface $groupRepository
5377
* @param CustomerMetadataInterface $customerMetadata
5478
* @param StoreManagerInterface $storeManager
79+
* @param ScopeConfigInterface $scopeConfig
5580
*/
5681
public function __construct(
5782
AttributeValueFactory $attributeValueFactory,
5883
GroupRepositoryInterface $groupRepository,
5984
CustomerMetadataInterface $customerMetadata,
60-
StoreManagerInterface $storeManager
85+
StoreManagerInterface $storeManager,
86+
ScopeConfigInterface $scopeConfig = null
6187
) {
6288
parent::__construct($attributeValueFactory);
6389
$this->customerMetadata = $customerMetadata;
6490
$this->groupRepository = $groupRepository;
6591
$this->storeManager = $storeManager;
92+
$this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->create(ScopeConfigInterface::class);
6693
}
6794

6895
/**
@@ -80,6 +107,12 @@ public function getCustomAttribute($attributeCode)
80107
case self::$websiteAttributeCode:
81108
$this->setWebsiteValue();
82109
break;
110+
case self::$confirmationAttributeCode:
111+
$this->setConfirmationValue();
112+
break;
113+
case self::$accountLockAttributeCode:
114+
$this->setAccountLockValue();
115+
break;
83116
}
84117
return parent::getCustomAttribute($attributeCode);
85118
}
@@ -133,5 +166,49 @@ private function setWebsiteValue()
133166
$value = $this->getData(self::$websiteAttributeCode);
134167
$list = $this->storeManager->getWebsites();
135168
$this->setCustomAttribute(self::$websiteAttributeCode, $list[$value]->getName());
169+
$this->setCustomAttribute(self::$websiteIdAttributeCode, $value);
170+
}
171+
172+
/**
173+
* Update confirmation value
174+
* Method set confirmation text value to match what is shown in grid
175+
* @return void
176+
*/
177+
private function setConfirmationValue()
178+
{
179+
$value = $this->getData(self::$confirmationAttributeCode);
180+
$websiteId = $this->getData(self::$websiteIdAttributeCode) ?: $this->getData(self::$websiteAttributeCode);
181+
$isConfirmRequired = (bool)$this->scopeConfig->getValue(
182+
AccountManagement::XML_PATH_IS_CONFIRM,
183+
ScopeInterface::SCOPE_WEBSITES,
184+
$websiteId
185+
);
186+
187+
$valueText = __('Confirmation Not Required');
188+
if ($isConfirmRequired) {
189+
$valueText = $value === null ? __('Confirmed') : __('Confirmation Required');
190+
}
191+
192+
$this->setCustomAttribute(self::$confirmationAttributeCode, $valueText);
193+
}
194+
195+
/**
196+
* Update lock expires value
197+
* Method set account lock text value to match what is shown in grid
198+
* @return void
199+
*/
200+
private function setAccountLockValue()
201+
{
202+
$value = $this->getDataByPath(self::$accountLockAttributeCode);
203+
204+
$valueText = __('Unlocked');
205+
if ($value !== null) {
206+
$lockExpires = new \DateTime($value);
207+
if ($lockExpires > new \DateTime()) {
208+
$valueText = __('Locked');
209+
}
210+
}
211+
212+
$this->setCustomAttribute(self::$accountLockAttributeCode, $valueText);
136213
}
137214
}

app/code/Magento/Email/Model/Source/Variables.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function __construct()
4747
['value' => 'general/store_information/city', 'label' => __('City')],
4848
['value' => 'general/store_information/street_line1', 'label' => __('Street Address 1')],
4949
['value' => 'general/store_information/street_line2', 'label' => __('Street Address 2')],
50+
['value' => 'general/store_information/merchant_vat_number', 'label' => __('VAT Number')],
5051
];
5152
}
5253

app/code/Magento/Email/Test/Unit/Model/Source/VariablesTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ protected function setup()
5353
['value' => 'general/store_information/city', 'label' => __('City')],
5454
['value' => 'general/store_information/street_line1', 'label' => __('Street Address 1')],
5555
['value' => 'general/store_information/street_line2', 'label' => __('Street Address 2')],
56+
['value' => 'general/store_information/merchant_vat_number', 'label' => __('VAT Number')],
5657
];
5758
}
5859

app/code/Magento/Email/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Region/State,Region/State
5454
City,City
5555
"Street Address 1","Street Address 1"
5656
"Street Address 2","Street Address 2"
57+
"VAT Number","VAT Number"
5758
"Store Contact Information","Store Contact Information"
5859
%1,%1
5960
"Template Variables","Template Variables"

app/code/Magento/Indexer/etc/cron_groups.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<schedule_ahead_for>4</schedule_ahead_for>
1212
<schedule_lifetime>2</schedule_lifetime>
1313
<history_cleanup_every>10</history_cleanup_every>
14-
<history_success_lifetime>60</history_success_lifetime>
15-
<history_failure_lifetime>600</history_failure_lifetime>
14+
<history_success_lifetime>10080</history_success_lifetime>
15+
<history_failure_lifetime>10080</history_failure_lifetime>
1616
<use_separate_process>1</use_separate_process>
1717
</group>
1818
</config>

0 commit comments

Comments
 (0)