File tree Expand file tree Collapse file tree 3 files changed +5
-15
lines changed
app/code/Magento/CatalogInventory Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,12 @@ public function __construct(
69
69
* Assign stock status information to product
70
70
*
71
71
* @param Product $product
72
- * @param int $stockStatus
72
+ * @param int $status
73
73
* @return void
74
74
*/
75
- public function assignStatusToProduct (Product $ product , $ stockStatus = null )
75
+ public function assignStatusToProduct (Product $ product , $ status = null )
76
76
{
77
- if ($ stockStatus === null ) {
77
+ if ($ status === null ) {
78
78
$ websiteId = $ product ->getStore ()->getWebsiteId ();
79
79
$ stockStatus = $ this ->stockRegistryProvider ->getStockStatus ($ product ->getId (), $ websiteId );
80
80
$ status = $ stockStatus ->getStockStatus ();
Original file line number Diff line number Diff line change @@ -34,10 +34,7 @@ public function execute(EventObserver $observer)
34
34
{
35
35
$ product = $ observer ->getEvent ()->getProduct ();
36
36
if ($ product instanceof \Magento \Catalog \Model \Product) {
37
- $ this ->stockHelper ->assignStatusToProduct (
38
- $ product ,
39
- $ product ->getStockStatus ()
40
- );
37
+ $ this ->stockHelper ->assignStatusToProduct ($ product );
41
38
}
42
39
}
43
40
}
Original file line number Diff line number Diff line change @@ -57,24 +57,17 @@ protected function setUp()
57
57
58
58
public function testAddInventoryData ()
59
59
{
60
- $ stockStatus = true ;
61
-
62
60
$ product = $ this ->getMockBuilder ('Magento\Catalog\Model\Product ' )
63
61
->disableOriginalConstructor ()
64
- ->setMethods (['getStockStatus ' ])
65
62
->getMock ();
66
63
67
- $ product ->expects ($ this ->once ())
68
- ->method ('getStockStatus ' )
69
- ->will ($ this ->returnValue ($ stockStatus ));
70
-
71
64
$ this ->event ->expects ($ this ->once ())
72
65
->method ('getProduct ' )
73
66
->will ($ this ->returnValue ($ product ));
74
67
75
68
$ this ->stockHelper ->expects ($ this ->once ())
76
69
->method ('assignStatusToProduct ' )
77
- ->with ($ product, $ stockStatus )
70
+ ->with ($ product )
78
71
->will ($ this ->returnSelf ());
79
72
80
73
$ this ->observer ->execute ($ this ->eventObserver );
You can’t perform that action at this time.
0 commit comments