Skip to content

Commit 3c869e7

Browse files
committed
Cover changes with interation tests
1 parent 22edbb9 commit 3c869e7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,38 @@ public function testGetCurrentUrl()
300300
$this->assertEquals('http://localhost/index.php/secondstore/', $secondStore->getCurrentUrl(false));
301301
}
302302

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+
303335
/**
304336
* @magentoAppIsolation enabled
305337
* @magentoAppArea adminhtml

0 commit comments

Comments
 (0)