@@ -300,6 +300,38 @@ public function testGetCurrentUrl()
300
300
$ this ->assertEquals ('http://localhost/index.php/secondstore/ ' , $ secondStore ->getCurrentUrl (false ));
301
301
}
302
302
303
+ /**
304
+ * @magentoDataFixture Magento/Store/_files/second_store.php
305
+ * @magentoDataFixture Magento/Catalog/_files/category_product.php
306
+ * @magentoDbIsolation disabled
307
+ */
308
+ public function testGetCurrentUrlWithUseStoreInUrlFalse ()
309
+ {
310
+ $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
311
+ $ objectManager ->get (\Magento \Framework \App \Config \ReinitableConfigInterface::class)
312
+ ->setValue ('web/url/use_store ' , false , ScopeInterface::SCOPE_STORE , 'default ' );
313
+
314
+ /** @var \Magento\Store\Model\Store $secondStore */
315
+ $ secondStore = $ objectManager ->get (StoreRepositoryInterface::class)->get ('fixture_second_store ' );
316
+
317
+ /** @var \Magento\Catalog\Model\ProductRepository $productRepository */
318
+ $ productRepository = $ objectManager ->create (ProductRepository::class);
319
+ $ product = $ productRepository ->get ('simple333 ' );
320
+
321
+ $ product ->setStoreId ($ secondStore ->getId ());
322
+ $ url = $ product ->getUrlInStore ();
323
+
324
+ /** @var \Magento\Catalog\Model\CategoryRepository $categoryRepository */
325
+ $ categoryRepository = $ objectManager ->get (\Magento \Catalog \Model \CategoryRepository::class);
326
+ $ category = $ categoryRepository ->get (333 ,$ secondStore ->getStoreId ());
327
+
328
+ $ this ->assertEquals ('http://localhost/index.php/catalog/category/view/s/category-1/id/333/ ' ,$ category ->getUrl ());
329
+ $ this ->assertEquals ('http://localhost/index.php/catalog/product/view/id/333/s/simple-product-three/?___store=fixture_second_store ' , $ url );
330
+ $ this ->assertEquals ('http://localhost/index.php/?___store=fixture_second_store&___from_store=default ' , $ secondStore ->getCurrentUrl ());
331
+ $ this ->assertEquals ('http://localhost/index.php/?___store=fixture_second_store ' , $ secondStore ->getCurrentUrl (false ));
332
+
333
+ }
334
+
303
335
/**
304
336
* @magentoAppIsolation enabled
305
337
* @magentoAppArea adminhtml
0 commit comments