@@ -27,7 +27,7 @@ class ConfigurablePriceResolverTest extends \PHPUnit_Framework_TestCase
27
27
protected function setUp ()
28
28
{
29
29
$ className = 'Magento\ConfigurableProduct\Model\Product\Type\Configurable ' ;
30
- $ this ->configurable = $ this ->getMock ($ className , ['getUsedProductCollection ' ], [], '' , false );
30
+ $ this ->configurable = $ this ->getMock ($ className , ['getUsedProducts ' ], [], '' , false );
31
31
32
32
$ className = 'Magento\ConfigurableProduct\Pricing\Price\PriceResolverInterface ' ;
33
33
$ this ->priceResolver = $ this ->getMockForAbstractClass ($ className , [], '' , false , true , true , ['resolvePrice ' ]);
@@ -59,9 +59,8 @@ public function testResolvePriceWithNoPrices()
59
59
['getSku ' ]
60
60
);
61
61
$ product ->expects ($ this ->once ())->method ('getSku ' )->willReturn ('Kiwi ' );
62
- $ productCollection = $ this ->getProductCollection ([]);
63
62
64
- $ this ->configurable ->expects ($ this ->once ())->method ('getUsedProductCollection ' )->willReturn ($ productCollection );
63
+ $ this ->configurable ->expects ($ this ->once ())->method ('getUsedProducts ' )->willReturn ([] );
65
64
66
65
$ this ->resolver ->resolvePrice ($ product );
67
66
}
@@ -86,36 +85,12 @@ public function testResolvePrice($expectedValue)
86
85
);
87
86
$ product ->expects ($ this ->never ())->method ('getSku ' );
88
87
89
- $ productCollection = $ this ->getProductCollection ([$ product ]);
90
- $ this ->configurable ->expects ($ this ->once ())->method ('getUsedProductCollection ' )->willReturn ($ productCollection );
88
+ $ this ->configurable ->expects ($ this ->once ())->method ('getUsedProducts ' )->willReturn ([$ product ]);
91
89
$ this ->priceResolver ->expects ($ this ->atLeastOnce ())->method ('resolvePrice ' )->willReturn ($ price );
92
90
93
91
$ this ->assertEquals ($ expectedValue , $ this ->resolver ->resolvePrice ($ product ));
94
92
}
95
93
96
- /**
97
- * @param array $products
98
- * @return \PHPUnit_Framework_MockObject_MockObject
99
- */
100
- protected function getProductCollection ($ products )
101
- {
102
- $ productCollection = $ this ->getMockBuilder (
103
- 'Magento\ConfigurableProduct\Model\ResourceModel\Product\Type\Configurable\Product\Collection '
104
- )->setMethods (
105
- [
106
- 'setFlag ' ,
107
- 'addAttributeToSelect ' ,
108
- 'getIterator ' ,
109
- ]
110
- )->disableOriginalConstructor ()
111
- ->getMock ();
112
- $ productCollection ->expects ($ this ->once ())->method ('addAttributeToSelect ' )->willReturnSelf ();
113
- $ productCollection ->expects ($ this ->once ())->method ('setFlag ' )->willReturnSelf ();
114
- $ productCollection ->expects ($ this ->once ())->method ('getIterator ' )->willReturn (new \ArrayIterator ($ products ));
115
-
116
- return $ productCollection ;
117
- }
118
-
119
94
/**
120
95
* @return array
121
96
*/
0 commit comments