Skip to content

Commit

Permalink
MAGETWO-37044: [GITHUB] I'm not getting default values (name & email)…
Browse files Browse the repository at this point in the history
… in contact form when i logged in #1200
  • Loading branch information
vkholoshenko authored and Olexii Korshenko committed May 15, 2015
1 parent 25391d3 commit d582414
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
24 changes: 24 additions & 0 deletions app/code/Magento/Contact/Block/ContactForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Contact\Block;

use Magento\Framework\View\Element\Template;

/**
* Main contact form block
*/
class ContactForm extends Template
{
/**
* @param Template\Context $context
* @param array $data
*/
public function __construct(Template\Context $context, array $data = [])
{
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
}
44 changes: 44 additions & 0 deletions app/code/Magento/Contact/Test/Unit/Block/ContactFormTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Contact\Test\Unit\Block;

use Magento\Contact\Block\ContactForm;

class ContactFormTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Magento\Contact\Block\ContactForm
*/
protected $contactForm;

/**
* @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject
*/
protected $contextMock;

/**
* {@inheritDoc}
*/
protected function setUp()
{
$this->contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
->disableOriginalConstructor()
->getMock();

$this->contactForm = new ContactForm(
$this->contextMock
);
}

/**
*
*/
public function testScope()
{
$this->assertTrue($this->contactForm->isScopePrivate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>
<body>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" name="contactForm" template="Magento_Contact::form.phtml">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<container name="form.additional.info" label="Form Additional Info"/>
</block>
</referenceContainer>
Expand Down

0 comments on commit d582414

Please sign in to comment.