Skip to content

Commit d582414

Browse files
vkholoshenkoOlexii Korshenko
authored and
Olexii Korshenko
committed
MAGETWO-37044: [GITHUB] I'm not getting default values (name & email) in contact form when i logged in #1200
1 parent 25391d3 commit d582414

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Contact\Block;
7+
8+
use Magento\Framework\View\Element\Template;
9+
10+
/**
11+
* Main contact form block
12+
*/
13+
class ContactForm extends Template
14+
{
15+
/**
16+
* @param Template\Context $context
17+
* @param array $data
18+
*/
19+
public function __construct(Template\Context $context, array $data = [])
20+
{
21+
parent::__construct($context, $data);
22+
$this->_isScopePrivate = true;
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Contact\Test\Unit\Block;
8+
9+
use Magento\Contact\Block\ContactForm;
10+
11+
class ContactFormTest extends \PHPUnit_Framework_TestCase
12+
{
13+
/**
14+
* @var \Magento\Contact\Block\ContactForm
15+
*/
16+
protected $contactForm;
17+
18+
/**
19+
* @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject
20+
*/
21+
protected $contextMock;
22+
23+
/**
24+
* {@inheritDoc}
25+
*/
26+
protected function setUp()
27+
{
28+
$this->contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
29+
->disableOriginalConstructor()
30+
->getMock();
31+
32+
$this->contactForm = new ContactForm(
33+
$this->contextMock
34+
);
35+
}
36+
37+
/**
38+
*
39+
*/
40+
public function testScope()
41+
{
42+
$this->assertTrue($this->contactForm->isScopePrivate());
43+
}
44+
}

app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</head>
1212
<body>
1313
<referenceContainer name="content">
14-
<block class="Magento\Framework\View\Element\Template" name="contactForm" template="Magento_Contact::form.phtml">
14+
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
1515
<container name="form.additional.info" label="Form Additional Info"/>
1616
</block>
1717
</referenceContainer>

0 commit comments

Comments
 (0)