Skip to content

Commit 02e1801

Browse files
committed
Merge pull request #656 from magento-troll/Bugfixes_S45
[Troll] Bugfixes S45
2 parents d2dc4bb + 5d906fb commit 02e1801

File tree

7 files changed

+47
-36
lines changed

7 files changed

+47
-36
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ public function __construct(Template\Context $context, array $data = [])
2121
parent::__construct($context, $data);
2222
$this->_isScopePrivate = true;
2323
}
24+
25+
/**
26+
* Returns action url for contact form
27+
*
28+
* @return string
29+
*/
30+
public function getFormAction()
31+
{
32+
return $this->getUrl('contact/index/post', ['_secure' => true]);
33+
}
2434
}

app/code/Magento/Contact/Controller/Index/Index.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ class Index extends \Magento\Contact\Controller\Index
1616
public function execute()
1717
{
1818
$this->_view->loadLayout();
19-
$this->_view->getLayout()
20-
->getBlock('contactForm')
21-
->setFormAction($this->_url->getUrl('*/*/post', ['_secure' => true]));
2219
$this->_view->renderLayout();
2320
}
2421
}

app/code/Magento/Contact/Controller/Index/Post.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ public function execute()
6565
$this->messageManager->addSuccess(
6666
__('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.')
6767
);
68-
$this->_redirect('*/*/');
68+
$this->_redirect('contact/index');
6969
return;
7070
} catch (\Exception $e) {
7171
$this->inlineTranslation->resume();
7272
$this->messageManager->addError(
7373
__('We can\'t process your request right now. Sorry, that\'s all we know.')
7474
);
75-
$this->_redirect('*/*/');
75+
$this->_redirect('contact/index');
7676
return;
7777
}
7878
}

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
}

app/code/Magento/Contact/Test/Unit/Controller/Index/IndexTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -93,31 +93,9 @@ public function setUp()
9393

9494
public function testExecute()
9595
{
96-
$layout = $this->getMock(
97-
'\Magento\Framework\View\Layout',
98-
['getBlock', 'initMessages'],
99-
[],
100-
'',
101-
false
102-
);
103-
$block = $this->getMockForAbstractClass(
104-
'\Magento\Framework\View\Element\AbstractBlock',
105-
['setFormAction'],
106-
'',
107-
false
108-
);
109-
$layout->expects($this->once())
110-
->method('getBlock')
111-
->with('contactForm')
112-
->will($this->returnValue($block));
113-
11496
$this->_view->expects($this->once())
11597
->method('loadLayout');
11698

117-
$this->_view->expects($this->exactly(1))
118-
->method('getLayout')
119-
->will($this->returnValue($layout));
120-
12199
$this->_view->expects($this->once())
122100
->method('renderLayout');
123101

app/code/Magento/Contact/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"php": "~5.5.0|~5.6.0|~7.0.0",
66
"magento/module-config": "1.0.0-beta",
77
"magento/module-store": "1.0.0-beta",
8+
"magento/module-backend": "1.0.0-beta",
89
"magento/module-customer": "1.0.0-beta",
910
"magento/module-cms": "1.0.0-beta",
1011
"magento/framework": "1.0.0-beta",

app/code/Magento/Swatches/view/frontend/web/js/SwatchRenderer.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ define(["jquery", "jquery/ui"], function ($) {
173173
moreButton: 'swatch-more',
174174
loader: 'swatch-option-loading'
175175
},
176-
jsonConfig: {}, // option's json config
177-
jsonSwatchConfig: {}, // swatch's json config
178-
selectorProduct: '.product-info-main', // selector of parental block of prices and swatches (need to know where to seek for price block)
179-
selectorProductPrice: '.price', // selector of price wrapper (need to know where set price)
180-
numberToShow: false, // number of controls to show (false or zero = show all)
181-
onlySwatches: false, // show only swatch controls
182-
enableControlLabel: true, // enable label for control
183-
moreButtonText: 'More', // text for more button
184-
mediaCallback: '' // Callback url for media
176+
jsonConfig: {}, // option's json config
177+
jsonSwatchConfig: {}, // swatch's json config
178+
selectorProduct: '.product-info-main', // selector of parental block of prices and swatches (need to know where to seek for price block)
179+
selectorProductPrice: '.price-final-price .price', // selector of price wrapper (need to know where set price)
180+
numberToShow: false, // number of controls to show (false or zero = show all)
181+
onlySwatches: false, // show only swatch controls
182+
enableControlLabel: true, // enable label for control
183+
moreButtonText: 'More', // text for more button
184+
mediaCallback: '' // Callback url for media
185185
},
186186

187187
/**

0 commit comments

Comments
 (0)