@@ -27,27 +27,37 @@ protected function setUp()
27
27
$ this ->inputtypeModel = $ this ->objectManagerHelper ->getObject (
28
28
\Magento \Catalog \Model \Product \Attribute \Source \Inputtype::class,
29
29
[
30
- 'coreRegistry ' => $ this ->registry
30
+ 'coreRegistry ' => $ this ->registry ,
31
+ 'optionsArray ' => $ this ->getInputTypeSet ()
31
32
]
32
33
);
33
34
}
34
35
35
36
public function testToOptionArray ()
36
37
{
37
- $ inputTypesSet = [
38
+
39
+ $ extraValues = [
40
+ ['value ' => 'price ' , 'label ' => 'Price ' ],
41
+ ['value ' => 'media_image ' , 'label ' => 'Media Image ' ]
42
+ ];
43
+ $ inputTypesSet = $ this ->getInputTypeSet ();
44
+ $ inputTypesSet = array_merge ($ inputTypesSet , $ extraValues );
45
+
46
+ $ this ->registry ->expects ($ this ->once ())->method ('registry ' );
47
+ $ this ->registry ->expects ($ this ->once ())->method ('register ' );
48
+ $ this ->assertEquals ($ inputTypesSet , $ this ->inputtypeModel ->toOptionArray ());
49
+ }
50
+
51
+ private function getInputTypeSet ()
52
+ {
53
+ return [
38
54
['value ' => 'text ' , 'label ' => 'Text Field ' ],
39
55
['value ' => 'textarea ' , 'label ' => 'Text Area ' ],
40
56
['value ' => 'texteditor ' , 'label ' => 'Text Editor ' ],
41
57
['value ' => 'date ' , 'label ' => 'Date ' ],
42
58
['value ' => 'boolean ' , 'label ' => 'Yes/No ' ],
43
59
['value ' => 'multiselect ' , 'label ' => 'Multiple Select ' ],
44
- ['value ' => 'select ' , 'label ' => 'Dropdown ' ],
45
- ['value ' => 'price ' , 'label ' => 'Price ' ],
46
- ['value ' => 'media_image ' , 'label ' => 'Media Image ' ],
60
+ ['value ' => 'select ' , 'label ' => 'Dropdown ' ]
47
61
];
48
-
49
- $ this ->registry ->expects ($ this ->once ())->method ('registry ' );
50
- $ this ->registry ->expects ($ this ->once ())->method ('register ' );
51
- $ this ->assertEquals ($ inputTypesSet , $ this ->inputtypeModel ->toOptionArray ());
52
62
}
53
63
}
0 commit comments