3
3
* Copyright © 2016 Magento. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
-
7
6
namespace Magento \Directory \Test \Unit \Block ;
8
7
9
8
class CurrencyTest extends \PHPUnit_Framework_TestCase
@@ -16,29 +15,31 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase
16
15
/**
17
16
* @var \PHPUnit_Framework_MockObject_MockObject
18
17
*/
19
- protected $ postDataHelper ;
18
+ protected $ postDataHelperMock ;
20
19
21
20
/**
22
21
* @var \PHPUnit_Framework_MockObject_MockObject
23
22
*/
24
- protected $ urlBuilder ;
23
+ protected $ urlBuilderMock ;
25
24
26
25
protected function setUp ()
27
26
{
28
- $ this ->urlBuilder = $ this ->getMock (
27
+ $ this ->urlBuilderMock = $ this ->getMock (
29
28
\Magento \Framework \UrlInterface::class,
30
29
[],
31
30
[],
32
31
'' ,
33
32
false
34
33
);
35
- $ this ->urlBuilder ->expects ($ this ->any ())->method ('getUrl ' )->will ($ this ->returnArgument (0 ));
34
+ $ this ->urlBuilderMock ->expects ($ this ->any ())->method ('getUrl ' )->will ($ this ->returnArgument (0 ));
36
35
37
- /** @var $context \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject */
38
- $ context = $ this ->getMockBuilder (\Magento \Framework \View \Element \Template \Context::class)
36
+ /**
37
+ * @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject $contextMock
38
+ */
39
+ $ contextMock = $ this ->getMockBuilder (\Magento \Framework \View \Element \Template \Context::class)
39
40
->disableOriginalConstructor ()
40
41
->getMock ();
41
- $ context ->expects ($ this ->any ())->method ('getUrlBuilder ' )->will ($ this ->returnValue ($ this ->urlBuilder ));
42
+ $ contextMock ->expects ($ this ->any ())->method ('getUrlBuilder ' )->will ($ this ->returnValue ($ this ->urlBuilderMock ));
42
43
43
44
$ escaperMock = $ this ->getMockBuilder (\Magento \Framework \Escaper::class)
44
45
->disableOriginalConstructor ()
@@ -49,22 +50,22 @@ function ($string) {
49
50
return 'escapeUrl ' . $ string ;
50
51
}
51
52
);
52
- $ context ->expects ($ this ->once ())
53
+ $ contextMock ->expects ($ this ->once ())
53
54
->method ('getEscaper ' )
54
55
->willReturn ($ escaperMock );
55
56
56
- /** @var \Magento\Directory\Model\CurrencyFactory $currencyFactory */
57
- $ currencyFactory = $ this ->getMock (\Magento \Directory \Model \CurrencyFactory::class, [], [], '' , false );
58
- $ this ->postDataHelper = $ this ->getMock (\Magento \Framework \Data \Helper \PostHelper::class, [], [], '' , false );
57
+ /** @var \Magento\Directory\Model\CurrencyFactory $currencyFactoryMock */
58
+ $ currencyFactoryMock = $ this ->getMock (\Magento \Directory \Model \CurrencyFactory::class, [], [], '' , false );
59
+ $ this ->postDataHelperMock = $ this ->getMock (\Magento \Framework \Data \Helper \PostHelper::class, [], [], '' , false );
59
60
60
- /** @var \Magento\Framework\Locale\ResolverInterface $localeResolver */
61
- $ localeResolver = $ this ->getMock (\Magento \Framework \Locale \ResolverInterface::class, [], [], '' , false );
61
+ /** @var \Magento\Framework\Locale\ResolverInterface $localeResolverMock */
62
+ $ localeResolverMock = $ this ->getMock (\Magento \Framework \Locale \ResolverInterface::class, [], [], '' , false );
62
63
63
64
$ this ->object = new \Magento \Directory \Block \Currency (
64
- $ context ,
65
- $ currencyFactory ,
66
- $ this ->postDataHelper ,
67
- $ localeResolver
65
+ $ contextMock ,
66
+ $ currencyFactoryMock ,
67
+ $ this ->postDataHelperMock ,
68
+ $ localeResolverMock
68
69
);
69
70
}
70
71
@@ -74,7 +75,7 @@ public function testGetSwitchCurrencyPostData()
74
75
$ expectedCurrencyCode = 'test ' ;
75
76
$ switchUrl = 'escapeUrldirectory/currency/switch ' ;
76
77
77
- $ this ->postDataHelper ->expects ($ this ->once ())
78
+ $ this ->postDataHelperMock ->expects ($ this ->once ())
78
79
->method ('getPostData ' )
79
80
->with ($ this ->equalTo ($ switchUrl ), $ this ->equalTo (['currency ' => $ expectedCurrencyCode ]))
80
81
->will ($ this ->returnValue ($ expectedResult ));
0 commit comments