11
11
use Magento \Catalog \Model \ResourceModel \Eav \Attribute ;
12
12
use Magento \Framework \ObjectManagerInterface ;
13
13
use Magento \Swatches \Model \ResourceModel \Swatch as SwatchResource ;
14
+ use Magento \Swatches \Model \Swatch ;
14
15
use Magento \TestFramework \Helper \Bootstrap ;
15
16
use Magento \TestFramework \Interception \PluginList ;
16
17
use PHPUnit \Framework \TestCase ;
@@ -49,7 +50,7 @@ protected function setUp(): void
49
50
/**
50
51
* @return void
51
52
*/
52
- public function testEavAttributePluginIsRegistered ()
53
+ public function testEavAttributePluginIsRegistered (): void
53
54
{
54
55
$ pluginInfo = $ this ->objectManager ->get (PluginList::class)->get (Attribute::class);
55
56
$ this ->assertSame (EavAttribute::class, $ pluginInfo ['save_swatches_option_params ' ]['instance ' ]);
@@ -67,7 +68,7 @@ public function testChangeAttributeToDropdown(): void
67
68
unset($ options [0 ]);
68
69
$ optionsIds = $ this ->collectOptionsIds ($ options );
69
70
$ 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 );
71
72
$ attribute ->beforeSave ();
72
73
$ this ->assertEmpty ($ this ->fetchSwatchOptions ($ optionsIds ), 'Swatch options were not deleted ' );
73
74
}
@@ -80,7 +81,6 @@ public function testChangeAttributeToDropdown(): void
80
81
*/
81
82
private function prepareOptions (array $ options ): array
82
83
{
83
- unset($ options [0 ]);
84
84
foreach ($ options as $ key => $ option ) {
85
85
$ preparedOptions ['option ' ]['order ' ][$ option ->getValue ()] = $ key ;
86
86
$ preparedOptions ['option ' ]['value ' ][$ option ->getValue ()] = [$ option ->getLabel ()];
0 commit comments