File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
app/code/Magento/SendFriend/Controller
dev/tests/integration/testsuite/Magento/SendFriend/Controller Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ protected function _initProduct()
102
102
}
103
103
try {
104
104
$ product = $ this ->productRepository ->getById ($ productId );
105
- if (!$ product ->isVisibleInCatalog ()) {
105
+ if (!$ product ->isVisibleInSiteVisibility () || ! $ product -> isVisibleInCatalog ()) {
106
106
return false ;
107
107
}
108
108
} catch (NoSuchEntityException $ noEntityException ) {
Original file line number Diff line number Diff line change @@ -85,6 +85,24 @@ public function testSendActionAsGuestWithInvalidData()
85
85
);
86
86
}
87
87
88
+ /**
89
+ * Share the product invisible in catalog to friend as guest customer
90
+ *
91
+ * @magentoDbIsolation enabled
92
+ * @magentoAppIsolation enabled
93
+ * @magentoConfigFixture default_store sendfriend/email/enabled 1
94
+ * @magentoConfigFixture default_store sendfriend/email/allow_guest 1
95
+ * @magentoDataFixture Magento/Catalog/_files/simple_products_not_visible_individually.php
96
+ */
97
+ public function testSendInvisibleProduct ()
98
+ {
99
+ $ product = $ this ->getInvisibleProduct ();
100
+ $ this ->prepareRequestData ();
101
+
102
+ $ this ->dispatch ('sendfriend/product/sendmail/id/ ' . $ product ->getId ());
103
+ $ this ->assert404NotFound ();
104
+ }
105
+
88
106
/**
89
107
* @return ProductInterface
90
108
*/
@@ -93,6 +111,14 @@ private function getProduct()
93
111
return $ this ->_objectManager ->get (ProductRepositoryInterface::class)->get ('custom-design-simple-product ' );
94
112
}
95
113
114
+ /**
115
+ * @return ProductInterface
116
+ */
117
+ private function getInvisibleProduct ()
118
+ {
119
+ return $ this ->_objectManager ->get (ProductRepositoryInterface::class)->get ('simple_not_visible_1 ' );
120
+ }
121
+
96
122
/**
97
123
* Login the user
98
124
*
You can’t perform that action at this time.
0 commit comments