-
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.
#12259: Save and Duplicated product not working
- Loading branch information
1 parent
321278b
commit ac4dd33
Showing
3 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
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
68 changes: 68 additions & 0 deletions
68
dev/tests/integration/testsuite/Magento/Catalog/Model/Product/CopierTest.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,68 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Catalog\Model\Product; | ||
|
||
|
||
use Magento\Catalog\Model\ProductRepository; | ||
|
||
class CopierTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var \Magento\Framework\ObjectManagerInterface | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var \Magento\Catalog\Model\Product\Copier | ||
*/ | ||
private $copier; | ||
|
||
/** | ||
* @var \Magento\Catalog\Model\ProductRepository | ||
*/ | ||
private $productRepository; | ||
|
||
/** | ||
* Tests multiple duplication of the same product. | ||
* | ||
* @magentoDataFixture Magento/Catalog/_files/product_simple.php | ||
* @magentoAppArea adminhtml | ||
* @magentoDbIsolation disabled | ||
* @magentoAppIsolation enabled | ||
*/ | ||
public function testDoubleCopy() | ||
{ | ||
$product = $this->productRepository->get('simple'); | ||
|
||
$product1 = $this->copier->copy($product); | ||
$this->assertEquals( | ||
'simple-1', | ||
$product1->getSku() | ||
); | ||
$this->assertEquals( | ||
'simple-product-1', | ||
$product1->getUrlKey() | ||
); | ||
|
||
$product2 = $this->copier->copy($product); | ||
$this->assertEquals( | ||
'simple-2', | ||
$product2->getSku() | ||
); | ||
$this->assertEquals( | ||
'simple-product-2', | ||
$product2->getUrlKey() | ||
); | ||
} | ||
|
||
protected function setUp() | ||
{ | ||
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); | ||
$this->copier = $this->objectManager->get(Copier::class); | ||
$this->productRepository = $this->objectManager->get(ProductRepository::class); | ||
} | ||
} |
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