Skip to content

Commit

Permalink
refactor integration tests, change fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Foxtrot authored and Nazar65 committed Feb 17, 2020
1 parent 94b6a17 commit f894321
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Magento\SalesSequence\Model\ResourceModel\Meta as ResourceMetadata;

/**
* Class DeleteByStore
* Delete Sequence by Store.
*/
class DeleteByStore
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Magento\SalesSequence\Model\Sequence\DeleteByStore;

/**
* Class SequenceRemovalObserver
* Observer for Sequence Removal.
*/
class SequenceRemovalObserver implements ObserverInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use PHPUnit\Framework\TestCase;

/**
* Class DeleteByStoreTest
* Test for \Magento\SalesSequence\Model\Sequence\DeleteByStore class.
*/
class DeleteByStoreTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ private function copyAppConfigFiles()
}
}
}

/**
* Copies global configuration file from the tests folder (see TESTS_GLOBAL_CONFIG_FILE)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public function testGetUrlInStore()
* @magentoConfigFixture fixturestore_store web/unsecure/base_url http://sample-second.com/
* @magentoConfigFixture fixturestore_store web/unsecure/base_link_url http://sample-second.com/
* @magentoDataFixture Magento/Catalog/_files/product_simple_multistore.php
* @magentoDbIsolation enabled
* @dataProvider getUrlsWithSecondStoreProvider
* @magentoDbIsolation disabled
* @magentoAppArea adminhtml
*/
public function testGetUrlInStoreWithSecondStore($storeCode, $expectedProductUrl)
Expand Down
23 changes: 12 additions & 11 deletions dev/tests/integration/testsuite/Magento/Store/Model/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ public function testIsCanDelete()

/**
* @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php
* @magentoDataFixture Magento/Catalog/_files/product_simple.php
* @magentoDbIsolation disabled
* @magentoDataFixture Magento/Catalog/_files/products.php
* @magentoAppIsolation enabled
*/
public function testGetCurrentUrl()
{
Expand Down Expand Up @@ -318,8 +318,9 @@ public function testGetCurrentUrl()
}

/**
* @magentoDataFixture Magento/Store/_files/second_store.php
* @magentoDataFixture Magento/Catalog/_files/category_product.php
* @magentoDataFixture Magento/Store/_files/core_second_third_fixturestore.php
* @magentoDataFixture Magento/Catalog/_files/products.php
* @magentoAppIsolation enabled
* @magentoDbIsolation enabled
*/
public function testGetCurrentUrlWithUseStoreInUrlFalse()
Expand All @@ -329,34 +330,34 @@ public function testGetCurrentUrlWithUseStoreInUrlFalse()
->setValue('web/url/use_store', false, ScopeInterface::SCOPE_STORE, 'default');

/** @var \Magento\Store\Model\Store $secondStore */
$secondStore = $objectManager->get(StoreRepositoryInterface::class)->get('fixture_second_store');
$secondStore = $objectManager->get(StoreRepositoryInterface::class)->get('secondstore');

/** @var \Magento\Catalog\Model\ProductRepository $productRepository */
$productRepository = $objectManager->create(ProductRepository::class);
$product = $productRepository->get('simple333');
$product = $productRepository->get('simple');

$product->setStoreId($secondStore->getId());
$url = $product->getUrlInStore();

/** @var \Magento\Catalog\Model\CategoryRepository $categoryRepository */
$categoryRepository = $objectManager->get(\Magento\Catalog\Model\CategoryRepository::class);
$category = $categoryRepository->get(333, $secondStore->getStoreId());
$category = $categoryRepository->get(2, $secondStore->getStoreId());

$this->assertEquals(
$secondStore->getBaseUrl() . 'catalog/category/view/s/category-1/id/333/',
$secondStore->getBaseUrl() . 'catalog/category/view/s/default-category/id/2/',
$category->getUrl()
);
$this->assertEquals(
$secondStore->getBaseUrl() .
'catalog/product/view/id/333/s/simple-product-three/?___store=fixture_second_store',
'catalog/product/view/id/1/s/simple-product/?___store=secondstore',
$url
);
$this->assertEquals(
$secondStore->getBaseUrl() . '?___store=fixture_second_store&___from_store=default',
$secondStore->getBaseUrl() . '?___store=secondstore&___from_store=default',
$secondStore->getCurrentUrl()
);
$this->assertEquals(
$secondStore->getBaseUrl() . '?___store=fixture_second_store',
$secondStore->getBaseUrl() . '?___store=secondstore',
$secondStore->getCurrentUrl(false)
);
}
Expand Down

0 comments on commit f894321

Please sign in to comment.