Skip to content

Commit 693adf1

Browse files
committed
ACP2E-741: Scheduled update settings not saved if originally added by running update
- add test
1 parent 25df10d commit 693adf1

File tree

1 file changed

+60
-0
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization

1 file changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
use PHPUnit\Framework\TestCase;
13+
14+
/**
15+
* Test for Initialization Helper
16+
*/
17+
class HelperTest extends TestCase
18+
{
19+
/**
20+
* @var Helper
21+
*/
22+
private $helper;
23+
24+
/**
25+
* @inheritdoc
26+
*/
27+
protected function setUp(): void
28+
{
29+
$this->helper = Bootstrap::getObjectManager()->get(Helper::class);
30+
}
31+
32+
/**
33+
* Test that method resets product data
34+
*
35+
* @magentoDataFixture Magento/Catalog/_files/multiple_products.php
36+
*/
37+
public function testInitializeFromData()
38+
{
39+
/** @var ProductRepositoryInterface $productRepository */
40+
$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
41+
$product = $productRepository->get('simple1');
42+
43+
$productData = [
44+
'weight' => null,
45+
'special_price' => null,
46+
'cost' => null,
47+
'description' => null,
48+
'short_description' => null,
49+
'meta_description' => null,
50+
'meta_keyword' => null,
51+
'meta_title' => null,
52+
];
53+
54+
$resultProduct = $this->helper->initializeFromData($product, $productData);
55+
56+
foreach (array_keys($productData) as $key) {
57+
$this->assertEquals(null, $resultProduct->getData($key));
58+
}
59+
}
60+
}

0 commit comments

Comments
 (0)