Skip to content

Commit 2a3cfc5

Browse files
author
Bohdan Korablov
committed
Merge remote-tracking branch 'tangoc/MAGETWO-44434' into new_pr_bugs
2 parents 75327f5 + d4c62d7 commit 2a3cfc5

File tree

7 files changed

+240
-131
lines changed

7 files changed

+240
-131
lines changed

app/code/Magento/Backend/Block/Widget/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ protected function _setFieldset($attributes, $fieldset, $exclude = [])
187187
$fieldType,
188188
[
189189
'name' => $attribute->getAttributeCode(),
190-
'label' => $attribute->getFrontend()->getLabel(),
190+
'label' => $attribute->getFrontend()->getLocalizedLabel(),
191191
'class' => $attribute->getFrontend()->getClass(),
192192
'required' => $attribute->getIsRequired(),
193193
'note' => $attribute->getNote()

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php

Lines changed: 120 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -9,88 +9,105 @@
99

1010
class SaveTest extends \PHPUnit_Framework_TestCase
1111
{
12-
/** @var \Magento\Backend\Controller\Adminhtml\System\Account */
13-
protected $_controller;
14-
15-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface */
16-
protected $_requestMock;
17-
18-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface */
19-
protected $_responseMock;
20-
21-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManager\ObjectManager */
22-
protected $_objectManagerMock;
23-
24-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Message\ManagerInterface */
25-
protected $_messagesMock;
26-
27-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Helper\Data */
28-
protected $_helperMock;
29-
30-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Auth\Session */
31-
protected $_authSessionMock;
32-
33-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\User\Model\User */
34-
protected $_userMock;
35-
36-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Validator\locale */
37-
protected $_validatorMock;
38-
39-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Locale\Manager */
40-
protected $_managerMock;
41-
42-
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\TranslateInterface */
43-
protected $_translatorMock;
12+
/**
13+
* @var \Magento\Backend\Controller\Adminhtml\System\Account\Save
14+
*/
15+
protected $controller;
16+
17+
/**
18+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\RequestInterface
19+
*/
20+
protected $requestMock;
21+
22+
/**
23+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\App\ResponseInterface
24+
*/
25+
protected $responseMock;
26+
27+
/**
28+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManager\ObjectManager
29+
*/
30+
protected $objectManagerMock;
31+
32+
/**
33+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Message\ManagerInterface
34+
*/
35+
protected $messagesMock;
36+
37+
/**
38+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Helper\Data
39+
*/
40+
protected $helperMock;
41+
42+
/**
43+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Auth\Session
44+
*/
45+
protected $authSessionMock;
46+
47+
/**
48+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\User\Model\User
49+
*/
50+
protected $userMock;
51+
52+
/**
53+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Validator\locale
54+
*/
55+
protected $validatorMock;
56+
57+
/**
58+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Backend\Model\Locale\Manager
59+
*/
60+
protected $managerMock;
61+
62+
/**
63+
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\TranslateInterface
64+
*/
65+
protected $translatorMock;
4466

4567
protected function setUp()
4668
{
47-
$this->_requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
69+
$frontControllerMock = $this->getMockBuilder('Magento\Framework\App\FrontController')
70+
->disableOriginalConstructor()
71+
->getMock();
72+
73+
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
4874
->disableOriginalConstructor()->setMethods(['getOriginalPathInfo'])
4975
->getMock();
50-
$this->_responseMock = $this->getMockBuilder('Magento\Framework\App\Response\Http')
76+
$this->responseMock = $this->getMockBuilder('Magento\Framework\App\Response\Http')
5177
->disableOriginalConstructor()
5278
->setMethods([])
5379
->getMock();
54-
$this->_objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManager\ObjectManager')
80+
$this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManager\ObjectManager')
5581
->disableOriginalConstructor()
5682
->setMethods(['get', 'create'])
5783
->getMock();
58-
$frontControllerMock = $this->getMockBuilder('Magento\Framework\App\FrontController')
59-
->disableOriginalConstructor()
60-
->getMock();
61-
62-
$this->_helperMock = $this->getMockBuilder('Magento\Backend\Helper\Data')
84+
$this->helperMock = $this->getMockBuilder('Magento\Backend\Helper\Data')
6385
->disableOriginalConstructor()
6486
->setMethods(['getUrl'])
6587
->getMock();
66-
$this->_messagesMock = $this->getMockBuilder('Magento\Framework\Message\Manager')
88+
$this->messagesMock = $this->getMockBuilder('Magento\Framework\Message\Manager')
6789
->disableOriginalConstructor()
6890
->setMethods(['addSuccess'])
6991
->getMockForAbstractClass();
70-
71-
$this->_authSessionMock = $this->getMockBuilder('Magento\Backend\Model\Auth\Session')
92+
$this->authSessionMock = $this->getMockBuilder('Magento\Backend\Model\Auth\Session')
7293
->disableOriginalConstructor()
7394
->setMethods(['getUser'])
7495
->getMock();
75-
76-
$this->_userMock = $this->getMockBuilder('Magento\User\Model\User')
96+
$this->userMock = $this->getMockBuilder('Magento\User\Model\User')
7797
->disableOriginalConstructor()
7898
->setMethods(
7999
['load', 'save', 'sendPasswordResetNotificationEmail', 'verifyIdentity', '__sleep', '__wakeup']
80100
)
81101
->getMock();
82-
83-
$this->_validatorMock = $this->getMockBuilder('Magento\Framework\Validator\Locale')
102+
$this->validatorMock = $this->getMockBuilder('Magento\Framework\Validator\Locale')
84103
->disableOriginalConstructor()
85104
->setMethods(['isValid'])
86105
->getMock();
87-
88-
$this->_managerMock = $this->getMockBuilder('Magento\Backend\Model\Locale\Manager')
106+
$this->managerMock = $this->getMockBuilder('Magento\Backend\Model\Locale\Manager')
89107
->disableOriginalConstructor()
90108
->setMethods(['switchBackendInterfaceLocale'])
91109
->getMock();
92-
93-
$this->_translatorMock = $this->getMockBuilder('Magento\Framework\TranslateInterface')
110+
$this->translatorMock = $this->getMockBuilder('Magento\Framework\TranslateInterface')
94111
->disableOriginalConstructor()
95112
->getMock();
96113

@@ -107,19 +124,19 @@ protected function setUp()
107124
->willReturn($resultRedirect);
108125

109126
$contextMock = $this->getMock('Magento\Backend\App\Action\Context', [], [], '', false);
110-
$contextMock->expects($this->any())->method('getRequest')->willReturn($this->_requestMock);
111-
$contextMock->expects($this->any())->method('getResponse')->willReturn($this->_responseMock);
112-
$contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->_objectManagerMock);
127+
$contextMock->expects($this->any())->method('getRequest')->willReturn($this->requestMock);
128+
$contextMock->expects($this->any())->method('getResponse')->willReturn($this->responseMock);
129+
$contextMock->expects($this->any())->method('getObjectManager')->willReturn($this->objectManagerMock);
113130
$contextMock->expects($this->any())->method('getFrontController')->willReturn($frontControllerMock);
114-
$contextMock->expects($this->any())->method('getHelper')->willReturn($this->_helperMock);
115-
$contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->_messagesMock);
116-
$contextMock->expects($this->any())->method('getTranslator')->willReturn($this->_translatorMock);
131+
$contextMock->expects($this->any())->method('getHelper')->willReturn($this->helperMock);
132+
$contextMock->expects($this->any())->method('getMessageManager')->willReturn($this->messagesMock);
133+
$contextMock->expects($this->any())->method('getTranslator')->willReturn($this->translatorMock);
117134
$contextMock->expects($this->once())->method('getResultFactory')->willReturn($resultFactory);
118135

119136
$args = ['context' => $contextMock];
120137

121138
$testHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
122-
$this->_controller = $testHelper->getObject('Magento\Backend\Controller\Adminhtml\System\Account\Save', $args);
139+
$this->controller = $testHelper->getObject('Magento\Backend\Controller\Adminhtml\System\Account\Save', $args);
123140
}
124141

125142
public function testSaveAction()
@@ -136,69 +153,50 @@ public function testSaveAction()
136153
\Magento\Backend\Block\System\Account\Edit\Form::IDENTITY_VERIFICATION_PASSWORD_FIELD => 'current_password',
137154
];
138155

139-
$testedMessage = 'You saved the account.';
140-
141-
$this->_authSessionMock->expects($this->any())->method('getUser')->will($this->returnValue($this->_userMock));
142-
143-
$this->_userMock->expects($this->any())->method('load')->will($this->returnSelf());
144-
$this->_validatorMock->expects(
145-
$this->once()
146-
)->method(
147-
'isValid'
148-
)->with(
149-
$this->equalTo($requestParams['interface_locale'])
150-
)->will(
151-
$this->returnValue(true)
152-
);
153-
$this->_managerMock->expects($this->any())->method('switchBackendInterfaceLocale');
154-
155-
$this->_objectManagerMock->expects(
156-
$this->at(0)
157-
)->method(
158-
'get'
159-
)->with(
160-
$this->equalTo('Magento\Backend\Model\Auth\Session')
161-
)->will(
162-
$this->returnValue($this->_authSessionMock)
163-
);
164-
$this->_objectManagerMock->expects(
165-
$this->at(1)
166-
)->method(
167-
'create'
168-
)->with(
169-
$this->equalTo('Magento\User\Model\User')
170-
)->will(
171-
$this->returnValue($this->_userMock)
172-
);
173-
$this->_objectManagerMock->expects(
174-
$this->at(2)
175-
)->method(
176-
'get'
177-
)->with(
178-
$this->equalTo('Magento\Framework\Validator\Locale')
179-
)->will(
180-
$this->returnValue($this->_validatorMock)
181-
);
182-
$this->_objectManagerMock->expects(
183-
$this->at(3)
184-
)->method(
185-
'get'
186-
)->with(
187-
$this->equalTo('Magento\Backend\Model\Locale\Manager')
188-
)->will(
189-
$this->returnValue($this->_managerMock)
190-
);
191-
192-
$this->_userMock->setUserId($userId);
193-
194-
$this->_userMock->expects($this->once())->method('save');
195-
$this->_userMock->expects($this->once())->method('verifyIdentity')->will($this->returnValue(true));
196-
$this->_userMock->expects($this->once())->method('sendPasswordResetNotificationEmail');
197-
198-
$this->_requestMock->setParams($requestParams);
199-
200-
$this->_messagesMock->expects($this->once())->method('addSuccess')->with($this->equalTo($testedMessage));
201-
202-
$this->_controller->execute();
156+
$testedMessage = __('You saved the account.');
157+
158+
$this->authSessionMock->expects($this->any())
159+
->method('getUser')
160+
->willReturn($this->userMock);
161+
$this->userMock->expects($this->any())
162+
->method('load')
163+
->will($this->returnSelf());
164+
$this->validatorMock->expects($this->once())
165+
->method('isValid')
166+
->with($this->equalTo($requestParams['interface_locale']))
167+
->willReturn(true);
168+
$this->managerMock->expects($this->any())
169+
->method('switchBackendInterfaceLocale');
170+
$this->objectManagerMock->expects($this->at(0))
171+
->method('get')
172+
->with($this->equalTo('Magento\Backend\Model\Auth\Session'))
173+
->willReturn($this->authSessionMock);
174+
$this->objectManagerMock->expects($this->at(1))
175+
->method('create')
176+
->with($this->equalTo('Magento\User\Model\User'))
177+
->willReturn($this->userMock);
178+
$this->objectManagerMock->expects($this->at(2))
179+
->method('get')
180+
->with($this->equalTo('Magento\Framework\Validator\Locale'))
181+
->willReturn($this->validatorMock);
182+
$this->objectManagerMock->expects($this->at(3))
183+
->method('get')
184+
->with($this->equalTo('Magento\Backend\Model\Locale\Manager'))
185+
->willReturn($this->managerMock);
186+
$this->userMock->expects($this->once())
187+
->method('save');
188+
$this->userMock->expects($this->once())
189+
->method('verifyIdentity')
190+
->willReturn(true);
191+
$this->userMock->expects($this->once())
192+
->method('sendPasswordResetNotificationEmail');
193+
$this->messagesMock->expects($this->once())
194+
->method('addSuccess')
195+
->with($this->equalTo($testedMessage));
196+
197+
$this->userMock->setUserId($userId);
198+
$this->requestMock->setParams($requestParams);
199+
200+
$this->controller->execute();
203201
}
204202
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,9 @@ Tags,Tags
606606
Options,Options
607607
"Magento Admin","Magento Admin"
608608
"Community Edition","Community Edition"
609+
"Last Orders","Last Orders"
610+
"Last Search Terms","Last Search Terms"
611+
"Top Search Terms","Top Search Terms"
612+
"Your Password","Your Password"
613+
"You saved the account.","You saved the account."
614+
"Current User Identity Verification","Current User Identity Verification"

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,3 +630,24 @@ Set,Set
630630
none,none
631631
Overview,Overview
632632
"Field ""%1"" was not found in DO ""%2"".","Field ""%1"" was not found in DO ""%2""."
633+
"Is Active","Is Active"
634+
"URL Key","URL Key"
635+
"Description","Description"
636+
"Image","Image"
637+
"Page Title","Page Title"
638+
"Meta Keywords","Meta Keywords"
639+
"Meta Description","Meta Description"
640+
"Include in Navigation Menu","Include in Navigation Menu"
641+
"Display Mode","Display Mode"
642+
"CMS Block","CMS Block"
643+
"Is Anchor","Is Anchor"
644+
"Available Product Listing Sort By","Available Product Listing Sort By"
645+
"Default Product Listing Sort By","Default Product Listing Sort By"
646+
"Layered Navigation Price Step","Layered Navigation Price Step"
647+
"Use Parent Category Settings","Use Parent Category Settings"
648+
"Apply To Products","Apply To Products"
649+
"Active From","Active From"
650+
"Active To","Active To"
651+
"Page Layout","Page Layout"
652+
"Custom Layout Update","Custom Layout Update"
653+
"Name","Name"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"Front-end development workflow","Front-end development workflow"
2+
"Workflow type","Workflow type"
3+
"Not available in production mode","Not available in production mode"
4+
"Developer Client Restrictions","Developer Client Restrictions"
5+
"Allowed IPs (comma separated)","Allowed IPs (comma separated)"
6+
"Leave empty for access from any location.","Leave empty for access from any location."
7+
"Debug","Debug"
8+
"Enabled Template Path Hints for Storefront","Enabled Template Path Hints for Storefront"
9+
"Enabled Template Path Hints for Admin","Enabled Template Path Hints for Admin"
10+
"Add Block Names to Hints","Add Block Names to Hints"
11+
"Template Settings","Template Settings"
12+
"Allow Symlinks","Allow Symlinks"
13+
"Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk.","Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk."
14+
"Minify Html","Minify Html"
15+
"Translate Inline","Translate Inline"
16+
"Enabled for Storefront","Enabled for Storefront"
17+
"Enabled for Admin","Enabled for Admin"
18+
"Translate, blocks and other output caches should be disabled for both Storefront and Admin inline translations.","Translate, blocks and other output caches should be disabled for both Storefront and Admin inline translations."
19+
"JavaScript Settings","JavaScript Settings"
20+
"Enable Javascript Bundling","Enable Javascript Bundling"
21+
"Merge JavaScript Files","Merge JavaScript Files"
22+
"Minify JavaScript Files","Minify JavaScript Files"
23+
"Translation Strategy","Translation Strategy"
24+
"Dictionary (Translation on Storefront side)","Dictionary (Translation on Storefront side)"
25+
"Embedded (Translation on Admin side)","Embedded (Translation on Admin side)"
26+
"Log JS Errors to Session Storage","Log JS Errors to Session Storage"
27+
"Log JS Errors to Session Storage Key","Log JS Errors to Session Storage Key"
28+
"CSS Settings","CSS Settings"
29+
"Merge CSS Files","Merge CSS Files"
30+
"Minify CSS Files","Minify CSS Files"
31+
"Image Processing Settings","Image Processing Settings"
32+
"Image Adapter","Image Adapter"
33+
"Static Files Settings","Static Files Settings"
34+
"Sign Static Files","Sign Static Files"
35+
"Grid Settings","Grid Settings"
36+
"Asynchronous indexing","Asynchronous indexing"
37+
"Client side less compilation","Client side less compilation"
38+
"Server side less compilation","Server side less compilation"
39+
"Disable","Disable"
40+
"Enable","Enable"

0 commit comments

Comments
 (0)