File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
app/code/Magento/SendFriend/Controller
dev/tests/integration/testsuite/Magento/SendFriend/Controller Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ public function __construct(
61
61
62
62
/**
63
63
* Check if module is enabled
64
+ *
64
65
* If allow only for customer - redirect to login page
65
66
*
66
67
* @param RequestInterface $request
@@ -102,7 +103,7 @@ protected function _initProduct()
102
103
}
103
104
try {
104
105
$ product = $ this ->productRepository ->getById ($ productId );
105
- if (!$ product ->isVisibleInCatalog ()) {
106
+ if (!$ product ->isVisibleInSiteVisibility () || ! $ product -> isVisibleInCatalog ()) {
106
107
return false ;
107
108
}
108
109
} 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