Skip to content

Commit e5ee92e

Browse files
committed
MAGETWO-35324: Success message for contact us form does not disappear even after closing browser
1 parent 512614b commit e5ee92e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

app/code/Magento/Contact/Block/ContactForm.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public function __construct(Template\Context $context, array $data = [])
2323
}
2424

2525
/**
26+
* Returns action url for contact form
27+
*
2628
* @return string
2729
*/
2830
public function getFormAction()

app/code/Magento/Contact/Test/Unit/Block/ContactFormTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,29 @@ class ContactFormTest extends \PHPUnit_Framework_TestCase
2020
*/
2121
protected $contextMock;
2222

23+
/**
24+
* @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject
25+
*/
26+
protected $urlBuilderMock;
27+
2328
/**
2429
* {@inheritDoc}
2530
*/
2631
protected function setUp()
2732
{
2833
$this->contextMock = $this->getMockBuilder('Magento\Framework\View\Element\Template\Context')
2934
->disableOriginalConstructor()
35+
->setMethods(['getUrlBuilder'])
3036
->getMock();
3137

38+
$this->urlBuilderMock = $this->getMockBuilder('Magento\Framework\UrlInterface')
39+
->disableOriginalConstructor()
40+
->getMock();
41+
42+
$this->contextMock->expects($this->any())
43+
->method('getUrlBuilder')
44+
->willReturn($this->urlBuilderMock);
45+
3246
$this->contactForm = new ContactForm(
3347
$this->contextMock
3448
);
@@ -41,4 +55,15 @@ public function testScope()
4155
{
4256
$this->assertTrue($this->contactForm->isScopePrivate());
4357
}
58+
59+
/**
60+
* @return void
61+
*/
62+
public function testGetFormAction()
63+
{
64+
$this->urlBuilderMock->expects($this->once())
65+
->method('getUrl')
66+
->with('contact/index/post', ['_secure' => true]);
67+
$this->contactForm->getFormAction();
68+
}
4469
}

0 commit comments

Comments
 (0)