Skip to content

Commit 1db2bf2

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'origin/develop' into PR-2
2 parents d0fecac + dd344de commit 1db2bf2

File tree

13 files changed

+231
-95
lines changed

13 files changed

+231
-95
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$element = $block->getElement();
1313
$note = $element->getNote() ? '<div class="note" id="' . $element->getId() . '-note">' . $element->getNote() . '</div>' : '';
1414
$elementBeforeLabel = $element->getExtType() == 'checkbox admin__control-checkbox' || $element->getExtType() == 'radio admin__control-radio';
15-
$addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml();
15+
$addOn = ($element->getBeforeElementHtml() || $element->getAfterElementHtml()) && !$element->getNoWrapAsAddon();
1616
$fieldId = ($element->getHtmlContainerId()) ? ' id="' . $element->getHtmlContainerId() . '"' : '';
1717
$fieldClass = "admin__field field field-{$element->getId()} {$element->getCssClass()}";
1818
$fieldClass .= ($elementBeforeLabel) ? ' choice' : '';

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ protected function _saveMediaGallery(array $mediaGalleryData)
18031803
'value' => $insertValue['value'],
18041804
];
18051805
$valueToProductId[$insertValue['value']] = $productId;
1806-
$imageNames = $insertValue['value'];
1806+
$imageNames[] = $insertValue['value'];
18071807
$multiInsertData[] = $valueArr;
18081808
$insertedGalleryImgs[] = $insertValue['value'];
18091809
}

app/code/Magento/Customer/Block/CustomerData.php

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,14 @@
77

88
class CustomerData extends \Magento\Framework\View\Element\Template
99
{
10-
/**
11-
* Sections that can not be cached on frontend-side
12-
*
13-
* @var array
14-
*/
15-
protected $nonCachedSections = [];
16-
1710
/**
1811
* @param \Magento\Framework\View\Element\Template\Context $context
1912
* @param array $data
20-
* @param array $nonCachedSections
2113
*/
2214
public function __construct(
2315
\Magento\Framework\View\Element\Template\Context $context,
24-
array $data = [],
25-
array $nonCachedSections = []
16+
array $data = []
2617
) {
27-
$this->nonCachedSections = $nonCachedSections;
2818
parent::__construct($context, $data);
2919
}
3020

@@ -50,24 +40,4 @@ public function getCustomerDataUrl($route)
5040
{
5141
return $this->getUrl($route, ['_secure' => $this->getRequest()->isSecure()]);
5242
}
53-
54-
/**
55-
* Get sections that can not be cached on frontend-side
56-
*
57-
* @return array
58-
*/
59-
public function getNotCachedSections()
60-
{
61-
return $this->nonCachedSections;
62-
}
63-
64-
/**
65-
* Get keys of sections that can not be cached on frontend-side
66-
*
67-
* @return array
68-
*/
69-
public function getNonCachedSectionKeys()
70-
{
71-
return array_keys($this->nonCachedSections);
72-
}
7343
}

app/code/Magento/Customer/view/frontend/templates/js/customer-data.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
'*' => ['Magento_Customer/js/customer-data' => [
1414
'sectionLoadUrl' => $block->getCustomerDataUrl('customer/section/load'),
1515
'cookieLifeTime' => $block->getCookieLifeTime(),
16-
'nonCachedSections' => $block->getNonCachedSectionKeys(),
1716
]],
1817
]);
1918
?>

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ define([
2323
storage.removeAll();
2424
var date = new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000);
2525
$.localStorage.set('mage-cache-timeout', date);
26-
} else {
27-
invalidateNonCachedSections(options);
2826
}
2927
};
3028

@@ -35,12 +33,6 @@ define([
3533
}
3634
};
3735

38-
var invalidateNonCachedSections = function(options) {
39-
_.each(options.nonCachedSections, function (sectionName) {
40-
storageInvalidation.set(sectionName, true);
41-
});
42-
}
43-
4436
var dataProvider = {
4537
getFromStorage: function (sectionNames) {
4638
var result = {};

app/code/Magento/SampleData/Model/BlackHole.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,4 @@
1515
</argument>
1616
</arguments>
1717
</type>
18-
<virtualType name="Magento\SampleData\Model\BlackHoleFactory" type="\Magento\Framework\Mail\TransportInterfaceFactory">
19-
<arguments>
20-
<argument name="instanceName" xsi:type="string">Magento\SampleData\Model\BlackHole</argument>
21-
</arguments>
22-
</virtualType>
23-
<virtualType name="blackHoleTransportBuilder" type="Magento\Framework\Mail\Template\TransportBuilder">
24-
<arguments>
25-
<argument name="mailTransportFactory" xsi:type="object" >Magento\SampleData\Model\BlackHoleFactory</argument>
26-
</arguments>
27-
</virtualType>
28-
<virtualType name="sampleDataAccountManagement" type="Magento\Customer\Model\AccountManagement">
29-
<arguments>
30-
<argument name="transportBuilder" xsi:type="object">blackHoleTransportBuilder</argument>
31-
</arguments>
32-
</virtualType>
33-
<type name="Magento\SampleData\Module\Customer\Setup\Customer">
34-
<arguments>
35-
<argument name="accountManagement" xsi:type="object">sampleDataAccountManagement</argument>
36-
</arguments>
37-
</type>
3818
</config>

app/code/Magento/Theme/Block/Html/Title.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ public function getPageTitle()
3737
return $this->pageConfig->getTitle()->getShort();
3838
}
3939

40+
/**
41+
* Provide own page content heading
42+
*
43+
* @return string
44+
*/
45+
public function getPageHeading()
46+
{
47+
if (!empty($this->pageTitle)) {
48+
return $this->pageTitle;
49+
}
50+
return $this->pageConfig->getTitle()->getShortHeading();
51+
}
52+
4053
/**
4154
* Set own page title
4255
*
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Theme\Test\Unit\Block\Html;
7+
8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
9+
10+
class TitleTest extends \PHPUnit_Framework_TestCase
11+
{
12+
/**
13+
* @var ObjectManagerHelper
14+
*/
15+
protected $objectManagerHelper;
16+
17+
/**
18+
* @var \Magento\Framework\View\Page\Config|\PHPUnit_Framework_MockObject_MockObject
19+
*/
20+
protected $pageConfigMock;
21+
22+
/**
23+
* @var \Magento\Framework\View\Page\Title|\PHPUnit_Framework_MockObject_MockObject
24+
*/
25+
protected $pageTitleMock;
26+
27+
/**
28+
* @var \Magento\Theme\Block\Html\Title
29+
*/
30+
protected $htmlTitle;
31+
32+
/**
33+
* @return void
34+
*/
35+
protected function setUp()
36+
{
37+
$this->objectManagerHelper = new ObjectManagerHelper($this);
38+
$this->pageConfigMock = $this->getMock('Magento\Framework\View\Page\Config', [], [], '', false);
39+
$this->pageTitleMock = $this->getMock('Magento\Framework\View\Page\Title', [], [], '', false);
40+
41+
$context = $this->objectManagerHelper->getObject(
42+
'Magento\Framework\View\Element\Template\Context',
43+
['pageConfig' => $this->pageConfigMock]
44+
);
45+
46+
$this->htmlTitle = $this->objectManagerHelper->getObject(
47+
'Magento\Theme\Block\Html\Title',
48+
['context' => $context]
49+
);
50+
}
51+
52+
/**
53+
* @return void
54+
*/
55+
public function testGetPageTitleWithSetPageTitle()
56+
{
57+
$title = 'some title';
58+
59+
$this->htmlTitle->setPageTitle($title);
60+
$this->pageConfigMock->expects($this->never())
61+
->method('getTitle');
62+
63+
$this->assertEquals($title, $this->htmlTitle->getPageTitle());
64+
}
65+
66+
/**
67+
* @return void
68+
*/
69+
public function testGetPageTitle()
70+
{
71+
$title = 'some title';
72+
73+
$this->pageTitleMock->expects($this->once())
74+
->method('getShort')
75+
->willReturn($title);
76+
$this->pageConfigMock->expects($this->once())
77+
->method('getTitle')
78+
->willReturn($this->pageTitleMock);
79+
80+
$this->assertEquals($title, $this->htmlTitle->getPageTitle());
81+
}
82+
83+
/**
84+
* @return void
85+
*/
86+
public function testGetPageHeadingWithSetPageTitle()
87+
{
88+
$title = 'some title';
89+
90+
$this->htmlTitle->setPageTitle($title);
91+
$this->pageConfigMock->expects($this->never())
92+
->method('getTitle');
93+
94+
$this->assertEquals($title, $this->htmlTitle->getPageHeading());
95+
}
96+
97+
/**
98+
* @return void
99+
*/
100+
public function testGetPageHeading()
101+
{
102+
$title = 'some title';
103+
104+
$this->pageTitleMock->expects($this->once())
105+
->method('getShortHeading')
106+
->willReturn($title);
107+
$this->pageConfigMock->expects($this->once())
108+
->method('getTitle')
109+
->willReturn($this->pageTitleMock);
110+
111+
$this->assertEquals($title, $this->htmlTitle->getPageHeading());
112+
}
113+
}

app/code/Magento/Theme/view/frontend/templates/html/title.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*/
1212
$cssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : '';
1313
$title = '';
14-
if (trim($block->getPageTitle())) {
14+
if (trim($block->getPageHeading())) {
1515
$title = '<span class="base" data-ui-id="page-title-wrapper" ' . $block->getAddBaseAttribute() . '>'
16-
. $block->escapeHtml($block->getPageTitle()) . '</span>';
16+
. $block->escapeHtml($block->getPageHeading()) . '</span>';
1717
}
1818
?>
1919
<?php if ($title): ?>

lib/internal/Magento/Framework/Setup/SampleData/Executor.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,34 @@
77

88
class Executor
99
{
10+
/**
11+
* @var State
12+
*/
13+
private $state;
14+
15+
/**
16+
* @var \Psr\Log\LoggerInterface
17+
*/
18+
private $logger;
19+
20+
/**
21+
* @var \Magento\Framework\App\State
22+
*/
23+
private $appState;
24+
1025
/**
1126
* @param \Psr\Log\LoggerInterface $logger
12-
* @param \Magento\Framework\Setup\SampleData\State $state
27+
* @param State $state
28+
* @param \Magento\Framework\App\State $appState
1329
*/
1430
public function __construct(
1531
\Psr\Log\LoggerInterface $logger,
16-
\Magento\Framework\Setup\SampleData\State $state
32+
\Magento\Framework\Setup\SampleData\State $state,
33+
\Magento\Framework\App\State $appState
1734
) {
1835
$this->logger = $logger;
1936
$this->state = $state;
37+
$this->appState = $appState;
2038
}
2139

2240
/**
@@ -29,7 +47,7 @@ public function __construct(
2947
public function exec(InstallerInterface $installer)
3048
{
3149
try {
32-
$installer->install();
50+
$this->appState->emulateAreaCode('setup', [$installer, 'install']);
3351
$this->state->setInstalled();
3452
} catch (\Exception $e) {
3553
$this->state->setError();

lib/internal/Magento/Framework/View/Page/Title.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,26 @@ public function getShort()
7777
}
7878

7979
/**
80+
* Same as getShort(), but return title without prefix and suffix
81+
* @return mixed
82+
*/
83+
public function getShortHeading()
84+
{
85+
$title = $this->build(false);
86+
return reset($title);
87+
}
88+
89+
/**
90+
* @param bool $withConfigValues
8091
* @return array
8192
*/
82-
protected function build()
93+
protected function build($withConfigValues = true)
8394
{
84-
return array_merge($this->prependedValues, [$this->addConfigValues($this->textValue)], $this->appendedValues);
95+
return array_merge(
96+
$this->prependedValues,
97+
[$withConfigValues ? $this->addConfigValues($this->textValue) : $this->textValue],
98+
$this->appendedValues
99+
);
85100
}
86101

87102
/**

0 commit comments

Comments
 (0)