Skip to content

Commit 9e089f6

Browse files
committed
MC-39706: Create automated test for: "Change a text swatch attribute to dropdown attribute"
1 parent 56f7795 commit 9e089f6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dev/tests/integration/testsuite/Magento/Swatches/Model/Plugin/EavAttributeTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
1212
use Magento\Framework\ObjectManagerInterface;
1313
use Magento\Swatches\Model\ResourceModel\Swatch as SwatchResource;
14+
use Magento\Swatches\Model\Swatch;
1415
use Magento\TestFramework\Helper\Bootstrap;
1516
use Magento\TestFramework\Interception\PluginList;
1617
use PHPUnit\Framework\TestCase;
@@ -49,7 +50,7 @@ protected function setUp(): void
4950
/**
5051
* @return void
5152
*/
52-
public function testEavAttributePluginIsRegistered()
53+
public function testEavAttributePluginIsRegistered(): void
5354
{
5455
$pluginInfo = $this->objectManager->get(PluginList::class)->get(Attribute::class);
5556
$this->assertSame(EavAttribute::class, $pluginInfo['save_swatches_option_params']['instance']);
@@ -67,7 +68,7 @@ public function testChangeAttributeToDropdown(): void
6768
unset($options[0]);
6869
$optionsIds = $this->collectOptionsIds($options);
6970
$attribute->addData($this->prepareOptions($options));
70-
$attribute->setData('swatch_input_type', 'dropdown');
71+
$attribute->setData(Swatch::SWATCH_INPUT_TYPE_KEY, Swatch::SWATCH_INPUT_TYPE_DROPDOWN);
7172
$attribute->beforeSave();
7273
$this->assertEmpty($this->fetchSwatchOptions($optionsIds), 'Swatch options were not deleted');
7374
}
@@ -80,7 +81,6 @@ public function testChangeAttributeToDropdown(): void
8081
*/
8182
private function prepareOptions(array $options): array
8283
{
83-
unset($options[0]);
8484
foreach ($options as $key => $option) {
8585
$preparedOptions['option']['order'][$option->getValue()] = $key;
8686
$preparedOptions['option']['value'][$option->getValue()] = [$option->getLabel()];

0 commit comments

Comments
 (0)