Skip to content

Commit d11bc6d

Browse files
Merge branches 'MAGETWO-64223', 'MAGETWO-64557' and 'MAGETWO-65085' of https://github.com/magento-falcons/magento2ce into MAGETWO-65085
3 parents 1f442ce + d591463 + a6a359b commit d11bc6d

File tree

52 files changed

+2224
-65
lines changed

Some content is hidden

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

52 files changed

+2224
-65
lines changed

app/code/Magento/Backend/Block/System/Account/Edit/Form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Backend\Block\System\Account\Edit;
77

88
use Magento\Framework\App\ObjectManager;
9-
use Magento\Framework\Locale\Deployed\OptionInterface;
9+
use Magento\Framework\Locale\OptionInterface;
1010

1111
/**
1212
* Adminhtml edit admin user account form
@@ -135,7 +135,7 @@ protected function _prepareForm()
135135
'name' => 'interface_locale',
136136
'label' => __('Interface Locale'),
137137
'title' => __('Interface Locale'),
138-
'values' => $this->deployedLocales->getTranslatedLocales(),
138+
'values' => $this->deployedLocales->getTranslatedOptionLocales(),
139139
'class' => 'select'
140140
]
141141
);

app/code/Magento/Catalog/Setup/UpgradeData.php

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Api\Data\ProductAttributeInterface;
99
use Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface;
10+
use Magento\Eav\Model\Entity\AttributeCache;
1011
use Magento\Framework\Setup\UpgradeDataInterface;
1112
use Magento\Framework\Setup\ModuleContextInterface;
1213
use Magento\Framework\Setup\ModuleDataSetupInterface;
@@ -34,16 +35,26 @@ class UpgradeData implements UpgradeDataInterface
3435
*/
3536
private $eavSetupFactory;
3637

38+
/**
39+
* @var AttributeCache
40+
*/
41+
private $attributeCache;
42+
3743
/**
3844
* Init
3945
*
4046
* @param CategorySetupFactory $categorySetupFactory
4147
* @param EavSetupFactory $eavSetupFactory
48+
* @param AttributeCache $attributeCache
4249
*/
43-
public function __construct(CategorySetupFactory $categorySetupFactory, EavSetupFactory $eavSetupFactory)
44-
{
50+
public function __construct(
51+
CategorySetupFactory $categorySetupFactory,
52+
EavSetupFactory $eavSetupFactory,
53+
AttributeCache $attributeCache
54+
) {
4555
$this->categorySetupFactory = $categorySetupFactory;
4656
$this->eavSetupFactory = $eavSetupFactory;
57+
$this->attributeCache = $attributeCache;
4758
}
4859

4960
/**
@@ -135,19 +146,24 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
135146
}
136147

137148
if (version_compare($context->getVersion(), '2.0.4') < 0) {
149+
$mediaBackendType = 'static';
150+
$mediaBackendModel = null;
138151
/** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */
139152
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
140153
$categorySetup->updateAttribute(
141154
'catalog_product',
142155
'media_gallery',
143156
'backend_type',
144-
'static'
157+
$mediaBackendType
145158
);
146159
$categorySetup->updateAttribute(
147160
'catalog_product',
148161
'media_gallery',
149-
'backend_model'
162+
'backend_model',
163+
$mediaBackendModel
150164
);
165+
166+
$this->changeMediaGalleryAttributeInCache($mediaBackendType, $mediaBackendModel);
151167
}
152168

153169
if (version_compare($context->getVersion(), '2.0.5', '<')) {
@@ -340,10 +356,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
340356
]
341357
);
342358
}
343-
359+
344360
if (version_compare($context->getVersion(), '2.0.7') < 0) {
345361
/** @var EavSetup $eavSetup */
346-
$eavSetup= $this->eavSetupFactory->create(['setup' => $setup]);
362+
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
347363

348364
$eavSetup->updateAttribute(
349365
ProductAttributeInterface::ENTITY_TYPE_CODE,
@@ -381,4 +397,25 @@ private function changePriceAttributeDefaultScope($categorySetup)
381397

382398
}
383399
}
400+
401+
/**
402+
* @param string $mediaBackendType
403+
* @param string $mediaBackendModel
404+
* @return void
405+
*/
406+
private function changeMediaGalleryAttributeInCache($mediaBackendType, $mediaBackendModel)
407+
{
408+
// need to do, because media_gallery has backend model in cache.
409+
$catalogProductAttributes = $this->attributeCache->getAttributes('catalog_product', '0-0');
410+
411+
if (is_array($catalogProductAttributes)) {
412+
/** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $catalogProductAttribute */
413+
foreach ($catalogProductAttributes as $catalogProductAttribute) {
414+
if ($catalogProductAttribute->getAttributeCode() == 'media_gallery') {
415+
$catalogProductAttribute->setBackendModel($mediaBackendModel);
416+
$catalogProductAttribute->setBackendType($mediaBackendType);
417+
}
418+
}
419+
}
420+
}
384421
}

app/code/Magento/Config/Model/Config/PathValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public function __construct(Structure $structure)
2828
}
2929

3030
/**
31-
* Validates the config path by config structure schema.
31+
* Checks whether the config path present in configuration structure.
3232
*
3333
* @param string $path The config path
34-
* @return bool The result of validation
34+
* @return true The result of validation
3535
* @throws ValidatorException If provided path is not valid
3636
*/
3737
public function validate($path)

app/code/Magento/Config/Model/Config/Structure.php

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,38 @@ protected function _getGroupFieldPathsByAttribute(array $fields, $parentPath, $a
252252
}
253253

254254
/**
255-
* Collects config field paths recursively from config schema.
256-
* Returns an array map of fields specification.
255+
* Collects config paths and their structure paths from configuration files.
256+
* Returns the map of config paths and their structure paths.
257257
*
258-
* ```php
259-
* [
260-
* 'test_config/test_config/test_config' => [
261-
* 'test_structure/test_structure/test_structure'
262-
* ]
258+
* All paths are declared in module's system.xml.
259+
*
260+
* ```xml
261+
* <section id="section_id">
262+
* <group id="group_id" ...>
263+
* <field id="field_one_id" ...>
264+
* <label>Field One</label>
265+
* ...
266+
* </field>
267+
* <field id="field_two_id" ...>
268+
* <label>Field Two</label>
269+
* <config_path>section/group/field</config_path>
270+
* ...
271+
* </field>
272+
* </group>
273+
* </section>
263274
* ```
275+
* If <config_path> node does not exist, then config path duplicates structure path.
276+
* The result of this example will be:
277+
*
278+
* ```php
279+
* [
280+
* 'section_id/group_id/field_one_id' => [
281+
* 'section_id/group_id/field_one_id'
282+
* ],
283+
* 'section/group/field' => [
284+
* 'section_id/group_id/field_two_id'
285+
* ]
286+
*```
264287
*
265288
* @return array An array of config path to config structure path map
266289
*/
@@ -272,7 +295,7 @@ public function getFieldPaths()
272295
}
273296

274297
/**
275-
* Iteration that collects config field paths recursively from config schema.
298+
* Iteration that collects config field paths recursively from config files.
276299
*
277300
* @param array $elements The elements to be parsed
278301
* @return array An array of config path to config structure path map

app/code/Magento/User/Block/User/Edit/Tab/Main.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace Magento\User\Block\User\Edit\Tab;
1010

1111
use Magento\Framework\App\ObjectManager;
12-
use Magento\Framework\Locale\Deployed\OptionInterface;
12+
use Magento\Framework\Locale\OptionInterface;
1313

1414
/**
1515
* Cms page edit form main tab
@@ -152,7 +152,7 @@ protected function _prepareForm()
152152
'name' => 'interface_locale',
153153
'label' => __('Interface Locale'),
154154
'title' => __('Interface Locale'),
155-
'values' => $this->deployedLocales->getLocales(),
155+
'values' => $this->deployedLocales->getOptionLocales(),
156156
'class' => 'select'
157157
]
158158
);

app/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<preference for="Magento\Framework\View\Asset\Bundle\ConfigInterface" type="\Magento\Framework\View\Asset\Bundle\Config" />
3636
<preference for="Magento\Framework\Locale\ListsInterface" type="Magento\Framework\Locale\TranslatedLists" />
3737
<preference for="Magento\Framework\Locale\AvailableLocalesInterface" type="Magento\Framework\Locale\Deployed\Codes" />
38-
<preference for="Magento\Framework\Locale\Deployed\OptionInterface" type="Magento\Framework\Locale\Deployed\Options" />
38+
<preference for="Magento\Framework\Locale\OptionInterface" type="Magento\Framework\Locale\Deployed\Options" />
3939
<preference for="Magento\Framework\Api\AttributeTypeResolverInterface" type="Magento\Framework\Reflection\AttributeTypeResolver" />
4040
<preference for="Magento\Framework\Api\Search\SearchResultInterface" type="Magento\Framework\Api\Search\SearchResult" />
4141
<preference for="Magento\Framework\Api\Search\SearchCriteriaInterface" type="Magento\Framework\Api\Search\SearchCriteria"/>

dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Indexer.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class Indexer extends Cli
1818
*/
1919
const PARAM_INDEXER_REINDEX = 'indexer:reindex';
2020

21+
/**
22+
* Parameter for set mode command.
23+
*/
24+
const PARAM_SET_MODE = 'indexer:set-mode';
25+
2126
/**
2227
* Run reindex.
2328
*
@@ -32,4 +37,21 @@ public function reindex(array $indexes = [])
3237
}
3338
parent::execute(Indexer::PARAM_INDEXER_REINDEX . ' ' . $params);
3439
}
40+
41+
/**
42+
* Run set mode. Example of indexers array:
43+
* [
44+
* [0] => ['indexer' => 'category_flat_data', 'mode' => 'schedule'],
45+
* [1] => ['indexer' => 'catalogrule_product', 'mode' => 'realtime']
46+
* ]
47+
*
48+
* @param array $indexers
49+
* @return void
50+
*/
51+
public function setMode(array $indexers)
52+
{
53+
foreach ($indexers as $indexer) {
54+
parent::execute(Indexer::PARAM_SET_MODE . ' ' . $indexer['mode'] . ' ' . $indexer['indexer']);
55+
}
56+
}
3557
}

dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertBackendPageIsAvailable.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
namespace Magento\Backend\Test\Constraint;
88

9-
use Magento\Backend\Test\Fixture\GlobalSearch;
109
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
1110
use Magento\Mtf\Constraint\AbstractConstraint;
1211

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Captcha\Test\Block\Adminhtml;
8+
9+
use Magento\Mtf\Client\Locator;
10+
use Magento\Backend\Test\Block\Admin\Login;
11+
12+
/**
13+
* Login form for backend user.
14+
*/
15+
class LoginWithCaptcha extends Login
16+
{
17+
/**
18+
* Captcha image selector.
19+
*
20+
* @var string
21+
*/
22+
private $captchaImage = '#backend_login';
23+
24+
/**
25+
* Captcha reload button selector.
26+
*
27+
* @var string
28+
*/
29+
private $captchaReload = '#captcha-reload';
30+
31+
/**
32+
* Return captcha element visibility.
33+
*
34+
* @return bool
35+
*/
36+
public function isVisibleCaptcha()
37+
{
38+
return $this->_rootElement->find($this->captchaImage, Locator::SELECTOR_CSS)->isVisible();
39+
}
40+
41+
/**
42+
* Return captcha reload button element visibility.
43+
*
44+
* @return bool
45+
*/
46+
public function isVisibleCaptchaReloadButton()
47+
{
48+
return $this->_rootElement->find($this->captchaReload, Locator::SELECTOR_CSS)->isVisible();
49+
}
50+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="1">
9+
<wrapper>login</wrapper>
10+
<fields>
11+
<username>
12+
<selector>#username</selector>
13+
</username>
14+
<password>
15+
<selector>#login</selector>
16+
</password>
17+
<captcha>
18+
<selector>#captcha</selector>
19+
</captcha>
20+
</fields>
21+
</mapping>

0 commit comments

Comments
 (0)