Skip to content

Commit 7bd45f9

Browse files
Merge branches 'MAGETWO-57398' and 'MAGETWO-67357' of https://github.com/magento-falcons/magento2ce into MAGETWO-67357
2 parents 336de83 + 9365fd8 commit 7bd45f9

File tree

10 files changed

+82
-80
lines changed

10 files changed

+82
-80
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ atlassian*
4141
!/pub/media/customer/.htaccess
4242
/pub/media/downloadable/*
4343
!/pub/media/downloadable/.htaccess
44+
/pub/media/favicon/*
4445
/pub/media/import/*
4546
!/pub/media/import/.htaccess
4647
/pub/media/theme/*

app/code/Magento/Contact/Model/Mail.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public function __construct(
4949
*/
5050
public function send($replyTo, array $variables)
5151
{
52+
/** @see \Magento\Contact\Controller\Index\Post::validatedParams() */
53+
$replyToName = !empty($variables['data']['name']) ? $variables['data']['name'] : null;
54+
5255
$this->inlineTranslation->suspend();
5356
try {
5457
$transport = $this->transportBuilder
@@ -62,7 +65,7 @@ public function send($replyTo, array $variables)
6265
->setTemplateVars($variables)
6366
->setFrom($this->contactsConfig->emailSender())
6467
->addTo($this->contactsConfig->emailRecipient())
65-
->setReplyTo($replyTo)
68+
->setReplyTo($replyTo, $replyToName)
6669
->getTransport();
6770

6871
$transport->sendMessage();

app/code/Magento/Weee/view/frontend/layout/checkout_cart_index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<item name="weee" xsi:type="array">
1818
<item name="component" xsi:type="string">Magento_Weee/js/view/cart/totals/weee</item>
1919
<item name="config" xsi:type="array">
20-
<item name="title" xsi:type="string">FPT</item>
20+
<item name="title" xsi:type="string" translate="true">FPT</item>
2121
</item>
2222
</item>
2323
</item>

lib/internal/Magento/Framework/App/Bootstrap.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ public function __construct(ObjectManagerFactory $factory, $rootDir, array $init
204204
$this->factory = $factory;
205205
$this->rootDir = $rootDir;
206206
$this->server = $initParams;
207+
$this->objectManager = $this->factory->create($this->server);
207208
}
208209

209210
/**
@@ -227,7 +228,6 @@ public function getParams()
227228
public function createApplication($type, $arguments = [])
228229
{
229230
try {
230-
$this->initObjectManager();
231231
$application = $this->objectManager->create($type, $arguments);
232232
if (!($application instanceof AppInterface)) {
233233
throw new \InvalidArgumentException("The provided class doesn't implement AppInterface: {$type}");
@@ -250,7 +250,6 @@ public function run(AppInterface $application)
250250
try {
251251
\Magento\Framework\Profiler::start('magento');
252252
$this->initErrorHandler();
253-
$this->initObjectManager();
254253
$this->assertMaintenance();
255254
$this->assertInstalled();
256255
$response = $application->launch();
@@ -279,7 +278,6 @@ protected function assertMaintenance()
279278
if (null === $isExpected) {
280279
return;
281280
}
282-
$this->initObjectManager();
283281
/** @var \Magento\Framework\App\MaintenanceMode $maintenance */
284282
$this->maintenance = $this->objectManager->get(\Magento\Framework\App\MaintenanceMode::class);
285283

@@ -312,7 +310,6 @@ protected function assertInstalled()
312310
if (null === $isExpected) {
313311
return;
314312
}
315-
$this->initObjectManager();
316313
$isInstalled = $this->isInstalled();
317314
if (!$isInstalled && $isExpected) {
318315
$this->errorCode = self::ERR_IS_INSTALLED;
@@ -351,7 +348,6 @@ private function getIsExpected($key, $default)
351348
*/
352349
private function isInstalled()
353350
{
354-
$this->initObjectManager();
355351
/** @var \Magento\Framework\App\DeploymentConfig $deploymentConfig */
356352
$deploymentConfig = $this->objectManager->get(\Magento\Framework\App\DeploymentConfig::class);
357353
return $deploymentConfig->isAvailable();
@@ -364,7 +360,6 @@ private function isInstalled()
364360
*/
365361
public function getObjectManager()
366362
{
367-
$this->initObjectManager();
368363
return $this->objectManager;
369364
}
370365

@@ -378,20 +373,7 @@ private function initErrorHandler()
378373
$handler = new ErrorHandler();
379374
set_error_handler([$handler, 'handler']);
380375
}
381-
382-
/**
383-
* Initializes object manager
384-
*
385-
* @return void
386-
*/
387-
private function initObjectManager()
388-
{
389-
if (!$this->objectManager) {
390-
$this->objectManager = $this->factory->create($this->server);
391-
$this->maintenance = $this->objectManager->get(\Magento\Framework\App\MaintenanceMode::class);
392-
}
393-
}
394-
376+
395377
/**
396378
* Getter for error code
397379
*

lib/internal/Magento/Framework/App/ObjectManagerFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ObjectManagerFactory
3232
*
3333
* @var string
3434
*/
35-
protected $_locatorClassName = \Magento\Framework\ObjectManager\ObjectManager::class;
35+
protected $_locatorClassName = \Magento\Framework\App\ObjectManager::class;
3636

3737
/**
3838
* Config class name
@@ -169,7 +169,6 @@ public function create(array $arguments)
169169
$objectManager = new $this->_locatorClassName($this->factory, $diConfig, $sharedInstances);
170170

171171
$this->factory->setObjectManager($objectManager);
172-
ObjectManager::setInstance($objectManager);
173172

174173
$generatorParams = $diConfig->getArguments(\Magento\Framework\Code\Generator::class);
175174
/** Arguments are stored in different format when DI config is compiled, thus require custom processing */

lib/internal/Magento/Framework/Config/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function getIdAttributes()
152152
{
153153
$idAttributes = [
154154
'/view/vars' => 'module',
155-
'/view/vars/var' => 'name',
155+
'/view/vars/(var/)*var' => 'name',
156156
'/view/exclude/item' => ['type', 'item'],
157157
];
158158
foreach ($this->xpath as $attribute) {

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/_files/invalidConfigXmlArray.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@
178178
</config>',
179179
[
180180
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '' is not accepted by the pattern '" .
181-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
182-
")*'." .
181+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
182+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
183183
"\nLine: 2\n",
184184
"Element 'virtualType', attribute 'name': '' is not a valid value of the atomic type 'phpClassName'." .
185185
"\nLine: 2\n",
@@ -188,32 +188,14 @@
188188
"\nLine: 2\n",
189189
],
190190
],
191-
'virtualtype with invalid_name' => [
192-
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
193-
<virtualType name="\\BackslashPrefix\\IsNotAllowed" type="TypeName" shared="true"/>
194-
</config>',
195-
[
196-
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\BackslashPrefix\\IsNotAllowed' " .
197-
"is not accepted by the pattern '" .
198-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
199-
")*'." .
200-
"\nLine: 2\n",
201-
"Element 'virtualType', attribute 'name': '\\BackslashPrefix\\IsNotAllowed' " .
202-
"is not a valid value of the atomic type 'phpClassName'." .
203-
"\nLine: 2\n",
204-
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
205-
"invalid or something strange happend." .
206-
"\nLine: 2\n",
207-
],
208-
],
209191
'virtualtype with empty_type' => [
210192
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
211193
<virtualType name="Name" type="" shared="true"/>
212194
</config>',
213195
[
214196
"Element 'virtualType', attribute 'type': [facet 'pattern'] The value '' is not accepted by the pattern '" .
215-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
216-
")*'." .
197+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
198+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
217199
"\nLine: 2\n",
218200
"Element 'virtualType', attribute 'type': '' is not a valid value of the atomic type 'phpClassName'." .
219201
"\nLine: 2\n",
@@ -226,8 +208,8 @@
226208
[
227209
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '777Digits\\IsNotAllowed' " .
228210
"is not accepted by the pattern '" .
229-
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
230-
")*'." .
211+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
212+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
231213
"\nLine: 2\n",
232214
"Element 'virtualType', attribute 'name': '777Digits\\IsNotAllowed' " .
233215
"is not a valid value of the atomic type 'phpClassName'." .
@@ -237,4 +219,22 @@
237219
"\nLine: 2\n",
238220
],
239221
],
222+
'virtualtype with digits_and_prefix_slash' => [
223+
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
224+
<virtualType name="\\777Digits\\IsNotAllowed" type="TypeName" shared="true"/>
225+
</config>',
226+
[
227+
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\777Digits\\IsNotAllowed' " .
228+
"is not accepted by the pattern '" .
229+
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
230+
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
231+
"\nLine: 2\n",
232+
"Element 'virtualType', attribute 'name': '\\777Digits\\IsNotAllowed' " .
233+
"is not a valid value of the atomic type 'phpClassName'." .
234+
"\nLine: 2\n",
235+
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
236+
"invalid or something strange happend." .
237+
"\nLine: 2\n",
238+
],
239+
],
240240
];

lib/internal/Magento/Framework/ObjectManager/Test/Unit/Config/_files/valid_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@
6464
</argument>
6565
</arguments>
6666
</type>
67+
<virtualType name="\BackslashPrefix\IsAllowed" type="TypeName" shared="true"/>
6768
</config>

lib/internal/Magento/Framework/ObjectManager/etc/config.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</xs:documentation>
3737
</xs:annotation>
3838
<xs:restriction base="xs:string">
39-
<xs:pattern value="([a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
39+
<xs:pattern value="(\\?[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
4040
</xs:restriction>
4141
</xs:simpleType>
4242

setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -298,37 +298,14 @@ public function testInstall()
298298
$this->phpReadinessCheck->expects($this->once())->method('checkPhpExtensions')->willReturn(
299299
['responseType' => \Magento\Setup\Controller\ResponseTypeInterface::RESPONSE_TYPE_SUCCESS]
300300
);
301+
$this->filePermissions->expects($this->any())
302+
->method('getMissingWritablePathsForInstallation')
303+
->willReturn([]);
304+
$this->filePermissions->expects($this->once())
305+
->method('getMissingWritableDirectoriesForDbUpgrade')
306+
->willReturn([]);
307+
$this->setupLoggerExpectsForInstall();
301308

302-
$this->logger->expects($this->at(0))->method('log')->with('Starting Magento installation:');
303-
$this->logger->expects($this->at(1))->method('log')->with('File permissions check...');
304-
$this->logger->expects($this->at(3))->method('log')->with('Required extensions check...');
305-
// at(2) invokes logMeta()
306-
$this->logger->expects($this->at(5))->method('log')->with('Enabling Maintenance Mode...');
307-
// at(4) - logMeta and so on...
308-
$this->logger->expects($this->at(7))->method('log')->with('Installing deployment configuration...');
309-
$this->logger->expects($this->at(9))->method('log')->with('Installing database schema:');
310-
$this->logger->expects($this->at(11))->method('log')->with("Module 'Foo_One':");
311-
$this->logger->expects($this->at(13))->method('log')->with("Module 'Bar_Two':");
312-
$this->logger->expects($this->at(15))->method('log')->with('Schema post-updates:');
313-
$this->logger->expects($this->at(16))->method('log')->with("Module 'Foo_One':");
314-
$this->logger->expects($this->at(18))->method('log')->with("Module 'Bar_Two':");
315-
$this->logger->expects($this->at(21))->method('log')->with('Installing user configuration...');
316-
$this->logger->expects($this->at(23))->method('log')->with('Enabling caches:');
317-
$this->logger->expects($this->at(27))->method('log')->with('Installing data...');
318-
$this->logger->expects($this->at(28))->method('log')->with('Data install/update:');
319-
$this->logger->expects($this->at(29))->method('log')->with("Module 'Foo_One':");
320-
$this->logger->expects($this->at(31))->method('log')->with("Module 'Bar_Two':");
321-
$this->logger->expects($this->at(33))->method('log')->with('Data post-updates:');
322-
$this->logger->expects($this->at(34))->method('log')->with("Module 'Foo_One':");
323-
$this->logger->expects($this->at(36))->method('log')->with("Module 'Bar_Two':");
324-
$this->logger->expects($this->at(39))->method('log')->with('Installing admin user...');
325-
$this->logger->expects($this->at(41))->method('log')->with('Caches clearing:');
326-
$this->logger->expects($this->at(44))->method('log')->with('Disabling Maintenance Mode:');
327-
$this->logger->expects($this->at(46))->method('log')->with('Post installation file permissions check...');
328-
$this->logger->expects($this->at(48))->method('log')->with('Write installation date...');
329-
$this->logger->expects($this->at(50))->method('logSuccess')->with('Magento installation complete.');
330-
$this->logger->expects($this->at(52))->method('log')
331-
->with('Sample Data is installed with errors. See log file for details');
332309
$this->object->install($request);
333310
}
334311

@@ -541,6 +518,45 @@ private function prepareForUpdateModulesTests()
541518

542519
return $newObject;
543520
}
521+
522+
/**
523+
* Set up logger expectations for install method
524+
*
525+
* @return void
526+
*/
527+
private function setupLoggerExpectsForInstall()
528+
{
529+
$this->logger->expects($this->at(0))->method('log')->with('Starting Magento installation:');
530+
$this->logger->expects($this->at(1))->method('log')->with('File permissions check...');
531+
$this->logger->expects($this->at(3))->method('log')->with('Required extensions check...');
532+
// at(2) invokes logMeta()
533+
$this->logger->expects($this->at(5))->method('log')->with('Enabling Maintenance Mode...');
534+
// at(4) - logMeta and so on...
535+
$this->logger->expects($this->at(7))->method('log')->with('Installing deployment configuration...');
536+
$this->logger->expects($this->at(9))->method('log')->with('Installing database schema:');
537+
$this->logger->expects($this->at(11))->method('log')->with("Module 'Foo_One':");
538+
$this->logger->expects($this->at(13))->method('log')->with("Module 'Bar_Two':");
539+
$this->logger->expects($this->at(15))->method('log')->with('Schema post-updates:');
540+
$this->logger->expects($this->at(16))->method('log')->with("Module 'Foo_One':");
541+
$this->logger->expects($this->at(18))->method('log')->with("Module 'Bar_Two':");
542+
$this->logger->expects($this->at(21))->method('log')->with('Installing user configuration...');
543+
$this->logger->expects($this->at(23))->method('log')->with('Enabling caches:');
544+
$this->logger->expects($this->at(27))->method('log')->with('Installing data...');
545+
$this->logger->expects($this->at(28))->method('log')->with('Data install/update:');
546+
$this->logger->expects($this->at(29))->method('log')->with("Module 'Foo_One':");
547+
$this->logger->expects($this->at(31))->method('log')->with("Module 'Bar_Two':");
548+
$this->logger->expects($this->at(33))->method('log')->with('Data post-updates:');
549+
$this->logger->expects($this->at(34))->method('log')->with("Module 'Foo_One':");
550+
$this->logger->expects($this->at(36))->method('log')->with("Module 'Bar_Two':");
551+
$this->logger->expects($this->at(39))->method('log')->with('Installing admin user...');
552+
$this->logger->expects($this->at(41))->method('log')->with('Caches clearing:');
553+
$this->logger->expects($this->at(44))->method('log')->with('Disabling Maintenance Mode:');
554+
$this->logger->expects($this->at(46))->method('log')->with('Post installation file permissions check...');
555+
$this->logger->expects($this->at(48))->method('log')->with('Write installation date...');
556+
$this->logger->expects($this->at(50))->method('logSuccess')->with('Magento installation complete.');
557+
$this->logger->expects($this->at(52))->method('log')
558+
->with('Sample Data is installed with errors. See log file for details');
559+
}
544560
}
545561

546562
namespace Magento\Setup\Model;

0 commit comments

Comments
 (0)