Skip to content

Commit 17330ff

Browse files
author
Serhii Bohomaz
committed
MC-39704: Create automated test for: "Register simple product instead of Configurable"
1 parent 63434d2 commit 17330ff

File tree

1 file changed

+54
-0
lines changed
  • dev/tests/integration/testsuite/Magento/Swatches/Helper

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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\Swatches\Helper;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Framework\ObjectManagerInterface;
12+
use Magento\TestFramework\Helper\Bootstrap;
13+
use PHPUnit\Framework\TestCase;
14+
15+
/**
16+
* Tests for helper swatch attributes for product.
17+
*
18+
* @see \Magento\Swatches\Helper\Data
19+
* @magentoDbIsolation enabled
20+
*/
21+
class DataTest extends TestCase
22+
{
23+
/** @var ObjectManagerInterface */
24+
private $objectManager;
25+
26+
/** @var Data */
27+
private $helper;
28+
29+
/** @var ProductRepositoryInterface */
30+
private $productRepository;
31+
32+
/**
33+
* @inheritdoc
34+
*/
35+
protected function setUp(): void
36+
{
37+
parent::setUp();
38+
39+
$this->objectManager = Bootstrap::getObjectManager();
40+
$this->helper = $this->objectManager->get(Data::class);
41+
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
42+
}
43+
44+
/**
45+
* @magentoDataFixture Magento/Catalog/_files/second_product_simple.php
46+
* @return void
47+
*/
48+
public function testGetSwatchAttributesAsArray(): void
49+
{
50+
$product = $this->productRepository->get('simple2');
51+
$result = $this->helper->getSwatchAttributesAsArray($product);
52+
$this->assertEquals([], $result);
53+
}
54+
}

0 commit comments

Comments
 (0)