-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGETWO-98729: [2.3] [Magento Cloud] Translated Arabic URL's are retu…
…rning 404's - fixed - modified tests - reduced nesting level - eliminated cyclomatic complexity - eliminated npath complexity - eliminated long function
- Loading branch information
Showing
7 changed files
with
431 additions
and
179 deletions.
There are no files selected for viewing
343 changes: 197 additions & 146 deletions
343
app/code/Magento/CatalogImportExport/Model/Import/Product.php
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...ts/integration/testsuite/Magento/Catalog/_files/product_simple_with_non_latin_url_key.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
use Magento\Catalog\Api\ProductRepositoryInterface; | ||
use Magento\Catalog\Api\Data\ProductInterface; | ||
use Magento\Catalog\Model\Product\Attribute\Source\Status; | ||
use Magento\Catalog\Model\Product\Type; | ||
use Magento\Catalog\Model\Product\Visibility; | ||
use Magento\Framework\ObjectManagerInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$stockDataConfig = [ | ||
'use_config_manage_stock' => 1, | ||
'qty' => 100, | ||
'is_qty_decimal' => 0, | ||
'is_in_stock' => 1 | ||
]; | ||
|
||
/** @var ObjectManagerInterface $objectManager */ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
|
||
/** @var ProductRepositoryInterface $productRepository */ | ||
$productRepository = $objectManager->create(ProductRepositoryInterface::class); | ||
|
||
/** @var ProductInterface $product */ | ||
$product = $objectManager->create(ProductInterface::class); | ||
$product->setTypeId(Type::TYPE_SIMPLE) | ||
->setAttributeSetId(4) | ||
->setWebsiteIds([1]) | ||
->setName('Чудовий продукт без Url Key') | ||
->setSku('ukrainian-without-url-key') | ||
->setPrice(10) | ||
->setVisibility(Visibility::VISIBILITY_BOTH) | ||
->setStatus(Status::STATUS_ENABLED) | ||
->setCategoryIds([2]) | ||
->setStockData($stockDataConfig); | ||
try { | ||
$productRepository->save($product); | ||
} catch (\Exception $e) { | ||
// problems during save | ||
}; | ||
|
||
/** @var ProductInterface $product */ | ||
$product = $objectManager->create(ProductInterface::class); | ||
$product->setTypeId(Type::TYPE_SIMPLE) | ||
->setAttributeSetId(4) | ||
->setWebsiteIds([1]) | ||
->setName('Надзвичайний продукт з Url Key') | ||
->setSku('ukrainian-with-url-key') | ||
->setPrice(10) | ||
->setVisibility(Visibility::VISIBILITY_BOTH) | ||
->setStatus(Status::STATUS_ENABLED) | ||
->setCategoryIds([2]) | ||
->setStockData($stockDataConfig) | ||
->setUrlKey('надзвичайний продукт на кожен день'); | ||
try { | ||
$productRepository->save($product); | ||
} catch (\Exception $e) { | ||
// problems during save | ||
}; |
37 changes: 37 additions & 0 deletions
37
...ation/testsuite/Magento/Catalog/_files/product_simple_with_non_latin_url_key_rollback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
use Magento\Catalog\Api\ProductRepositoryInterface; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Magento\Framework\Registry; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
Bootstrap::getInstance()->getInstance()->reinitialize(); | ||
|
||
/** @var Registry $registry */ | ||
$registry = Bootstrap::getObjectManager()->get(Registry::class); | ||
$registry->unregister('isSecureArea'); | ||
$registry->register('isSecureArea', true); | ||
|
||
/** @var ProductRepositoryInterface $productRepository */ | ||
$productRepository = Bootstrap::getObjectManager() | ||
->get(ProductRepositoryInterface::class); | ||
|
||
$productSkus = [ | ||
'ukrainian-with-url-key', | ||
'ukrainian-without-url-key', | ||
]; | ||
try { | ||
foreach ($productSkus as $sku) { | ||
$product = $productRepository->get($sku, false, null, true); | ||
$productRepository->delete($product); | ||
} | ||
} catch (NoSuchEntityException $e) { | ||
// nothing to delete | ||
} | ||
|
||
$registry->unregister('isSecureArea'); | ||
$registry->register('isSecureArea', false); |
Oops, something went wrong.