9
9
*/
10
10
namespace Magento \Catalog \Controller ;
11
11
12
+ use Magento \Framework \App \ActionInterface ;
13
+ use Magento \TestFramework \ObjectManager ;
14
+
12
15
/**
13
16
* @magentoAppIsolation enabled
14
17
*/
@@ -25,7 +28,7 @@ protected function setUp()
25
28
public function assert404NotFound ()
26
29
{
27
30
parent ::assert404NotFound ();
28
- /** @var $objectManager \Magento\TestFramework\ ObjectManager */
31
+ /** @var $objectManager ObjectManager */
29
32
$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
30
33
$ this ->assertNull ($ objectManager ->get (\Magento \Framework \Registry::class)->registry ('current_product ' ));
31
34
}
@@ -49,7 +52,7 @@ protected function _getProductImageFile()
49
52
*/
50
53
public function testViewAction ()
51
54
{
52
- /** @var $objectManager \Magento\TestFramework\ ObjectManager */
55
+ /** @var $objectManager ObjectManager */
53
56
$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
54
57
/**
55
58
* @var $repository \Magento\Catalog\Model\ProductRepository
@@ -100,7 +103,7 @@ public function testViewAction()
100
103
*/
101
104
public function testViewActionConfigurable ()
102
105
{
103
- /** @var $objectManager \Magento\TestFramework\ ObjectManager */
106
+ /** @var $objectManager ObjectManager */
104
107
$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
105
108
/**
106
109
* @var $repository \Magento\Catalog\Model\ProductRepository
@@ -136,7 +139,7 @@ public function testViewActionRedirect()
136
139
*/
137
140
public function testGalleryAction ()
138
141
{
139
- /** @var $objectManager \Magento\TestFramework\ ObjectManager */
142
+ /** @var $objectManager ObjectManager */
140
143
$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
141
144
/**
142
145
* @var $repository \Magento\Catalog\Model\ProductRepository
@@ -186,4 +189,27 @@ public function testImageActionNoImage()
186
189
187
190
$ this ->assert404NotFound ();
188
191
}
192
+
193
+ /**
194
+ * Test changing Store View on Product page.
195
+ *
196
+ * @magentoAppIsolation enabled
197
+ * @magentoDbIsolation enabled
198
+ * @magentoDataFixture Magento/Catalog/_files/enable_using_store_codes.php
199
+ * @magentoDataFixture Magento/Catalog/_files/product_simple_multistore.php
200
+ */
201
+ public function testChangeStoreView ()
202
+ {
203
+ /** @var $objectManager ObjectManager */
204
+ $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
205
+
206
+ /** @var $repository \Magento\Catalog\Model\ProductRepository */
207
+ $ repository = $ objectManager ->create (\Magento \Catalog \Model \ProductRepository::class);
208
+ $ product = $ repository ->get ('simple ' );
209
+ $ this ->getRequest ()->setMethod ('POST ' );
210
+ $ this ->getRequest ()->setPostValue ([ActionInterface::PARAM_NAME_URL_ENCODED => 1 ]);
211
+ $ this ->dispatch (sprintf ('fixturestore/catalog/product/view/id/%s?___from_store=default ' , $ product ->getId ()));
212
+ $ html = $ this ->getResponse ()->getBody ();
213
+ $ this ->assertContains ('<span>Fixture Store</span> ' , $ html );
214
+ }
189
215
}
0 commit comments