5
5
*/
6
6
namespace Magento \Catalog \Test \Unit \Ui \DataProvider \Product \Form \Modifier ;
7
7
8
- use Magento \Catalog \Model \ Product \Type ;
8
+ use Magento \Catalog \Ui \ DataProvider \ Product \Form \ Modifier \ Images ;
9
9
10
10
/**
11
- * @method \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\ Images getModel
11
+ * @method Images getModel
12
12
*/
13
13
class ImagesTest extends AbstractModifierTest
14
14
{
@@ -17,20 +17,22 @@ class ImagesTest extends AbstractModifierTest
17
17
*/
18
18
protected function createModel ()
19
19
{
20
- return $ this ->objectManager ->getObject (\ Magento \ Catalog \ Ui \ DataProvider \ Product \ Form \ Modifier \ Images::class, [
20
+ return $ this ->objectManager ->getObject (Images::class, [
21
21
'locator ' => $ this ->locatorMock ,
22
22
]);
23
23
}
24
24
25
25
public function testModifyData ()
26
26
{
27
- $ this ->assertSame ($ this ->getSampleData (), $ this ->getModel ()->modifyData ($ this ->getSampleData ()));
27
+ $ this ->productMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (2051 );
28
+ $ actualResult = $ this ->getModel ()->modifyData ($ this ->getSampleData ());
29
+ $ this ->assertSame ('' , $ actualResult [2051 ]['product ' ]['media_gallery ' ]['images ' ][0 ]['label ' ]);
28
30
}
29
31
30
32
public function testModifyMeta ()
31
33
{
32
34
$ meta = [
33
- \ Magento \ Catalog \ Ui \ DataProvider \ Product \ Form \ Modifier \ Images::CODE_IMAGE_MANAGEMENT_GROUP => [
35
+ Images::CODE_IMAGE_MANAGEMENT_GROUP => [
34
36
'children ' => [],
35
37
'label ' => __ ('Images ' ),
36
38
'sortOrder ' => '20 ' ,
@@ -40,4 +42,24 @@ public function testModifyMeta()
40
42
41
43
$ this ->assertSame ([], $ this ->getModel ()->modifyMeta ($ meta ));
42
44
}
45
+
46
+ /**
47
+ * {@inheritdoc}
48
+ */
49
+ protected function getSampleData ()
50
+ {
51
+ return [
52
+ 2051 => [
53
+ 'product ' => [
54
+ 'media_gallery ' => [
55
+ 'images ' => [
56
+ [
57
+ 'label ' => null
58
+ ]
59
+ ]
60
+ ]
61
+ ]
62
+ ]
63
+ ];
64
+ }
43
65
}
0 commit comments