Skip to content

Commit ae331f5

Browse files
author
Yaroslav Onischenko
authored
Merge pull request #981 from magento-falcons/MAGETWO-66208
[Falcons] Delivery of deployment improvements and bug fixes
2 parents 5aca8ee + 2ebfd16 commit ae331f5

File tree

58 files changed

+1301
-492
lines changed

Some content is hidden

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

58 files changed

+1301
-492
lines changed

app/code/Magento/Authorizenet/etc/di.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,6 @@
1616
<argument name="storage" xsi:type="object">Magento\Authorizenet\Model\Directpost\Session\Storage</argument>
1717
</arguments>
1818
</type>
19-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
20-
<arguments>
21-
<argument name="configs" xsi:type="array">
22-
<item name="payment/authorizenet_directpost/login" xsi:type="string">1</item>
23-
<item name="payment/authorizenet_directpost/trans_key" xsi:type="string">1</item>
24-
<item name="payment/authorizenet_directpost/trans_md5" xsi:type="string">1</item>
25-
<item name="payment/authorizenet_directpost/merchant_email" xsi:type="string">1</item>
26-
</argument>
27-
</arguments>
28-
</type>
2919
<type name="Magento\Config\Model\Config\TypePool">
3020
<arguments>
3121
<argument name="sensitive" xsi:type="array">

app/code/Magento/Backend/etc/di.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,6 @@
171171
</argument>
172172
</arguments>
173173
</type>
174-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
175-
<arguments>
176-
<argument name="configs" xsi:type="array">
177-
<item name="trans_email/ident_general/name" xsi:type="string">1</item>
178-
<item name="trans_email/ident_general/email" xsi:type="string">1</item>
179-
<item name="trans_email/ident_sales/name" xsi:type="string">1</item>
180-
<item name="trans_email/ident_sales/email" xsi:type="string">1</item>
181-
<item name="trans_email/ident_support/name" xsi:type="string">1</item>
182-
<item name="trans_email/ident_support/email" xsi:type="string">1</item>
183-
<item name="trans_email/ident_custom1/name" xsi:type="string">1</item>
184-
<item name="trans_email/ident_custom1/email" xsi:type="string">1</item>
185-
<item name="trans_email/ident_custom2/name" xsi:type="string">1</item>
186-
<item name="trans_email/ident_custom2/email" xsi:type="string">1</item>
187-
<item name="admin/url/custom" xsi:type="string">1</item>
188-
<item name="admin/url/custom_path" xsi:type="string">1</item>
189-
</argument>
190-
</arguments>
191-
</type>
192174
<type name="Magento\Config\Model\Config\TypePool">
193175
<arguments>
194176
<argument name="sensitive" xsi:type="array">

app/code/Magento/Braintree/etc/di.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,6 @@
544544
</arguments>
545545
</type>
546546
<!-- END Settlement Report Section -->
547-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
548-
<arguments>
549-
<argument name="configs" xsi:type="array">
550-
<item name="payment/braintree/merchant_id" xsi:type="string">1</item>
551-
<item name="payment/braintree/public_key" xsi:type="string">1</item>
552-
<item name="payment/braintree/private_key" xsi:type="string">1</item>
553-
<item name="payment/braintree/merchant_account_id" xsi:type="string">1</item>
554-
<item name="payment/braintree/kount_id" xsi:type="string">1</item>
555-
<item name="payment/braintree_paypal/merchant_name_override" xsi:type="string">1</item>
556-
</argument>
557-
</arguments>
558-
</type>
559547
<type name="Magento\Config\Model\Config\TypePool">
560548
<arguments>
561549
<argument name="sensitive" xsi:type="array">

app/code/Magento/Checkout/etc/di.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@
4242
</argument>
4343
</arguments>
4444
</type>
45-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
46-
<arguments>
47-
<argument name="configs" xsi:type="array">
48-
<item name="checkout/payment_failed/copy_to" xsi:type="string">1</item>
49-
</argument>
50-
</arguments>
51-
</type>
5245
<type name="Magento\Config\Model\Config\TypePool">
5346
<arguments>
5447
<argument name="sensitive" xsi:type="array">

app/code/Magento/Config/Console/Command/ConfigSet/ProcessorFacade.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
namespace Magento\Config\Console\Command\ConfigSet;
77

88
use Magento\Config\Console\Command\ConfigSetCommand;
9-
use Magento\Config\Model\Config\PathValidator;
109
use Magento\Framework\App\Scope\ValidatorInterface;
10+
use Magento\Config\Model\Config\PathValidator;
11+
use Magento\Framework\Exception\LocalizedException;
1112
use Magento\Framework\Exception\ConfigurationMismatchException;
1213
use Magento\Framework\Exception\CouldNotSaveException;
13-
use Magento\Framework\Exception\LocalizedException;
1414
use Magento\Framework\Exception\ValidatorException;
1515

1616
/**
@@ -21,7 +21,10 @@
2121
class ProcessorFacade
2222
{
2323
/**
24-
* The scope validator.
24+
* The scope and scope code validator.
25+
*
26+
* Checks if scope and scope code exist, and scope code belongs to scope.
27+
* For example, scope "websites" and scope code "base" exist, and scope code "base" belongs to scope "website".
2528
*
2629
* @var ValidatorInterface
2730
*/
@@ -30,6 +33,8 @@ class ProcessorFacade
3033
/**
3134
* The path validator.
3235
*
36+
* Checks whether the config path present in configuration structure.
37+
*
3338
* @var PathValidator
3439
*/
3540
private $pathValidator;
@@ -65,15 +70,18 @@ public function __construct(
6570
* @param string $scopeCode The scope code
6671
* @param boolean $lock The lock flag
6772
* @return string Processor response message
68-
* @throws LocalizedException If scope validation failed
69-
* @throws ValidatorException If path validation failed
70-
* @throws CouldNotSaveException If processing failed
73+
* @throws ValidatorException If some validation is wrong
74+
* @throws CouldNotSaveException If cannot save config value
7175
* @throws ConfigurationMismatchException If processor can not be instantiated
7276
*/
7377
public function process($path, $value, $scope, $scopeCode, $lock)
7478
{
75-
$this->scopeValidator->isValid($scope, $scopeCode);
76-
$this->pathValidator->validate($path);
79+
try {
80+
$this->scopeValidator->isValid($scope, $scopeCode);
81+
$this->pathValidator->validate($path);
82+
} catch (LocalizedException $exception) {
83+
throw new ValidatorException(__($exception->getMessage()), $exception);
84+
}
7785

7886
$processor = $lock
7987
? $this->configSetProcessorFactory->create(ConfigSetProcessorFactory::TYPE_LOCK)

app/code/Magento/Config/Console/Command/ConfigSetCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ protected function configure()
116116
protected function execute(InputInterface $input, OutputInterface $output)
117117
{
118118
try {
119+
$areaScope = $this->scope->getCurrentScope();
119120
// Emulating adminhtml scope to be able to read configs.
120121
$this->state->emulateAreaCode(Area::AREA_ADMINHTML, function () use ($input, $output) {
121122
$this->scope->setCurrentScope(Area::AREA_ADMINHTML);
@@ -131,6 +132,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
131132
$output->writeln('<info>' . $message . '</info>');
132133
});
133134

135+
$this->scope->setCurrentScope($areaScope);
136+
134137
return Cli::RETURN_SUCCESS;
135138
} catch (\Exception $exception) {
136139
$output->writeln('<error>' . $exception->getMessage() . '</error>');

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
*
1111
* Used when you need to know if the configuration path belongs to a certain type.
1212
* Participates in the mechanism for creating the configuration dump file.
13-
* There are several types:
14-
* - sensitive - the fields that have this type will not be written in the dump configuration;
15-
* - environment - the fields that have this type will not be written to the dump configuration.
1613
*/
1714
class TypePool
1815
{
@@ -88,7 +85,7 @@ public function isPresent($path, $type)
8885
* );
8986
* ```
9087
*
91-
* @param string $type Type configuration fields paths. Allowed values of types:
88+
* @param string $type Type of configuration fields. Allowed values of types:
9289
* - sensitive or TypePool::TYPE_SENSITIVE;
9390
* - environment or TypePool::TYPE_ENVIRONMENT.
9491
* @return array

app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/ProcessorFacadeTest.php

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
use Magento\Config\Console\Command\ConfigSet\ConfigSetProcessorFactory;
99
use Magento\Config\Console\Command\ConfigSet\ConfigSetProcessorInterface;
1010
use Magento\Config\Console\Command\ConfigSet\ProcessorFacade;
11-
use Magento\Config\Model\Config\PathValidator;
1211
use Magento\Framework\App\Config\ScopeConfigInterface;
1312
use Magento\Framework\App\Scope\ValidatorInterface;
13+
use Magento\Config\Model\Config\PathValidator;
14+
use Magento\Framework\Exception\LocalizedException;
15+
use Magento\Framework\Exception\ValidatorException;
16+
use Magento\Framework\Exception\CouldNotSaveException;
17+
use Magento\Framework\Exception\ConfigurationMismatchException;
1418
use PHPUnit_Framework_MockObject_MockObject as Mock;
1519

1620
/**
@@ -77,6 +81,9 @@ public function testProcess()
7781
$this->scopeValidatorMock->expects($this->once())
7882
->method('isValid')
7983
->willReturn(true);
84+
$this->pathValidatorMock->expects($this->once())
85+
->method('validate')
86+
->willReturn(true);
8087
$this->configSetProcessorFactoryMock->expects($this->once())
8188
->method('create')
8289
->with(ConfigSetProcessorFactory::TYPE_DEFAULT)
@@ -91,6 +98,77 @@ public function testProcess()
9198
);
9299
}
93100

101+
/**
102+
* @param LocalizedException $exception
103+
* @dataProvider processWithValidatorExceptionDataProvider
104+
*/
105+
public function testProcessWithValidatorException(LocalizedException $exception)
106+
{
107+
$this->setExpectedException(ValidatorException::class, 'Some error');
108+
$this->scopeValidatorMock->expects($this->once())
109+
->method('isValid')
110+
->willThrowException($exception);
111+
112+
$this->model->process('test/test/test', 'test', ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, false);
113+
}
114+
115+
/**
116+
* @return array
117+
*/
118+
public function processWithValidatorExceptionDataProvider()
119+
{
120+
return [
121+
[new LocalizedException(__('Some error'))],
122+
[new ValidatorException(__('Some error'))],
123+
];
124+
}
125+
126+
/**
127+
* @expectedException \Magento\Framework\Exception\ConfigurationMismatchException
128+
* @expectedExceptionMessage Some error
129+
*/
130+
public function testProcessWithConfigurationMismatchException()
131+
{
132+
$this->scopeValidatorMock->expects($this->once())
133+
->method('isValid')
134+
->willReturn(true);
135+
$this->pathValidatorMock->expects($this->once())
136+
->method('validate')
137+
->willReturn(true);
138+
$this->configSetProcessorFactoryMock->expects($this->once())
139+
->method('create')
140+
->with(ConfigSetProcessorFactory::TYPE_DEFAULT)
141+
->willThrowException(new ConfigurationMismatchException(__('Some error')));
142+
$this->processorMock->expects($this->never())
143+
->method('process');
144+
145+
$this->model->process('test/test/test', 'test', ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, false);
146+
}
147+
148+
/**
149+
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
150+
* @expectedExceptionMessage Some error
151+
*/
152+
public function testProcessWithCouldNotSaveException()
153+
{
154+
$this->scopeValidatorMock->expects($this->once())
155+
->method('isValid')
156+
->willReturn(true);
157+
$this->pathValidatorMock->expects($this->once())
158+
->method('validate')
159+
->willReturn(true);
160+
$this->configSetProcessorFactoryMock->expects($this->once())
161+
->method('create')
162+
->with(ConfigSetProcessorFactory::TYPE_DEFAULT)
163+
->willReturn($this->processorMock);
164+
$this->processorMock->expects($this->once())
165+
->method('process')
166+
->with('test/test/test', 'test', ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null)
167+
->willThrowException(new CouldNotSaveException(__('Some error')));
168+
169+
$this->model->process('test/test/test', 'test', ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, false);
170+
}
171+
94172
public function testExecuteLock()
95173
{
96174
$this->scopeValidatorMock->expects($this->once())

app/code/Magento/Contact/etc/di.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
99
<preference for="Magento\Contact\Model\MailInterface" type="Magento\Contact\Model\Mail" />
1010
<preference for="Magento\Contact\Model\ConfigInterface" type="Magento\Contact\Model\Config" />
11-
<type name="Magento\Config\Model\Config\Export\ExcludeList">
12-
<arguments>
13-
<argument name="configs" xsi:type="array">
14-
<item name="contact/email/recipient_email" xsi:type="string">1</item>
15-
</argument>
16-
</arguments>
17-
</type>
1811
<type name="Magento\Config\Model\Config\TypePool">
1912
<arguments>
2013
<argument name="sensitive" xsi:type="array">

0 commit comments

Comments
 (0)