@@ -63,7 +63,9 @@ public function testGetProductsIfOneOfChildIsDisabled()
63
63
$ this ->productRepository ->save ($ lowestPriceChildProduct );
64
64
$ this ->storeManager ->setCurrentStore ($ currentStoreId );
65
65
66
- $ lowestPriceChildrenProducts = $ this ->lowestPriceOptionsProvider ->getProducts ($ configurableProduct );
66
+ $ lowestPriceOptionsProvider = $ this ->recreateLowestPriceOptionsProvider ();
67
+ $ lowestPriceChildrenProducts = $ lowestPriceOptionsProvider ->getProducts ($ configurableProduct );
68
+
67
69
$ this ->assertCount (1 , $ lowestPriceChildrenProducts );
68
70
$ lowestPriceChildrenProduct = reset ($ lowestPriceChildrenProducts );
69
71
$ this ->assertEquals (20 , $ lowestPriceChildrenProduct ->getPrice ());
@@ -95,7 +97,9 @@ public function testGetProductsIfOneOfChildIsDisabledPerStore()
95
97
$ this ->productRepository ->save ($ lowestPriceChildProduct );
96
98
$ this ->storeManager ->setCurrentStore ($ currentStoreId );
97
99
98
- $ lowestPriceChildrenProducts = $ this ->lowestPriceOptionsProvider ->getProducts ($ configurableProduct );
100
+ $ lowestPriceOptionsProvider = $ this ->recreateLowestPriceOptionsProvider ();
101
+ $ lowestPriceChildrenProducts = $ lowestPriceOptionsProvider ->getProducts ($ configurableProduct );
102
+
99
103
$ this ->assertCount (1 , $ lowestPriceChildrenProducts );
100
104
$ lowestPriceChildrenProduct = reset ($ lowestPriceChildrenProducts );
101
105
$ this ->assertEquals (20 , $ lowestPriceChildrenProduct ->getPrice ());
@@ -123,9 +127,21 @@ public function testGetProductsIfOneOfChildIsOutOfStock()
123
127
$ stockItem ->setIsInStock (0 );
124
128
$ this ->productRepository ->save ($ lowestPriceChildProduct );
125
129
126
- $ lowestPriceChildrenProducts = $ this ->lowestPriceOptionsProvider ->getProducts ($ configurableProduct );
130
+ $ lowestPriceOptionsProvider = $ this ->recreateLowestPriceOptionsProvider ();
131
+ $ lowestPriceChildrenProducts = $ lowestPriceOptionsProvider ->getProducts ($ configurableProduct );
132
+
127
133
$ this ->assertCount (1 , $ lowestPriceChildrenProducts );
128
134
$ lowestPriceChildrenProduct = reset ($ lowestPriceChildrenProducts );
129
135
$ this ->assertEquals (20 , $ lowestPriceChildrenProduct ->getPrice ());
130
136
}
137
+
138
+ /**
139
+ * @return LowestPriceOptionsProviderInterface
140
+ */
141
+ private function recreateLowestPriceOptionsProvider ()
142
+ {
143
+ return Bootstrap::getObjectManager ()->create (
144
+ LowestPriceOptionsProviderInterface::class
145
+ );
146
+ }
131
147
}
0 commit comments