@@ -19,9 +19,6 @@ class BundleTest extends \PHPUnit_Framework_TestCase
19
19
/** @var \Magento\Bundle\Model\Product\PriceFactory|\PHPUnit_Framework_MockObject_MockObject */
20
20
private $ bundleProductPriceFactory ;
21
21
22
- /** @var \Magento\Catalog\Block\Product\Context|\PHPUnit_Framework_MockObject_MockObject */
23
- private $ context ;
24
-
25
22
/** @var \Magento\Framework\Json\Encoder|\PHPUnit_Framework_MockObject_MockObject */
26
23
private $ jsonEncoder ;
27
24
@@ -50,9 +47,6 @@ protected function setUp()
50
47
->setMethods (['create ' ])
51
48
->getMock ();
52
49
53
- $ this ->context = $ this ->getMockBuilder (\Magento \Catalog \Block \Product \Context::class)
54
- ->disableOriginalConstructor ()
55
- ->getMock ();
56
50
$ this ->product = $ this ->getMockBuilder (\Magento \Catalog \Model \Product::class)
57
51
->disableOriginalConstructor ()
58
52
->setMethods (
@@ -75,12 +69,6 @@ protected function setUp()
75
69
$ this ->eventManager = $ this ->getMockBuilder (\Magento \Framework \Event \ManagerInterface::class)
76
70
->disableOriginalConstructor ()
77
71
->getMock ();
78
- $ this ->context ->expects ($ this ->any ())
79
- ->method ('getEventManager ' )
80
- ->willReturn ($ this ->eventManager );
81
- $ this ->context ->expects ($ this ->any ())
82
- ->method ('getRegistry ' )
83
- ->willReturn ($ registry );
84
72
$ this ->jsonEncoder = $ this ->getMockBuilder (\Magento \Framework \Json \Encoder::class)
85
73
->disableOriginalConstructor ()
86
74
->getMock ();
@@ -91,7 +79,8 @@ protected function setUp()
91
79
$ this ->bundleBlock = $ objectHelper ->getObject (
92
80
\Magento \Bundle \Block \Catalog \Product \View \Type \Bundle::class,
93
81
[
94
- 'context ' => $ this ->context ,
82
+ 'registry ' => $ registry ,
83
+ 'eventManager ' => $ this ->eventManager ,
95
84
'jsonEncoder ' => $ this ->jsonEncoder ,
96
85
'productPrice ' => $ this ->bundleProductPriceFactory ,
97
86
'catalogProduct ' => $ this ->catalogProduct
@@ -105,7 +94,7 @@ public function testGetOptionHtmlNoRenderer()
105
94
->setMethods (['getType ' ])
106
95
->disableOriginalConstructor ()
107
96
->getMock ();
108
- $ option ->expects ($ this ->exactly ( 2 ))->method ('getType ' )->willReturn ('checkbox ' );
97
+ $ option ->expects ($ this ->any ( ))->method ('getType ' )->willReturn ('checkbox ' );
109
98
110
99
$ layout = $ this ->getMockBuilder (\Magento \Framework \View \Layout::class)
111
100
->setMethods (['getChildName ' , 'getBlock ' ])
@@ -126,7 +115,7 @@ public function testGetOptionHtml()
126
115
->setMethods (['getType ' ])
127
116
->disableOriginalConstructor ()
128
117
->getMock ();
129
- $ option ->expects ($ this ->exactly ( 1 ))->method ('getType ' )->willReturn ('checkbox ' );
118
+ $ option ->expects ($ this ->once ( ))->method ('getType ' )->willReturn ('checkbox ' );
130
119
131
120
$ optionBlock = $ this ->getMockBuilder (
132
121
\Magento \Bundle \Block \Catalog \Product \View \Type \Bundle \Option \Checkbox::class
0 commit comments