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,9 +17,9 @@ 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, [
21
- ' locator ' => $ this ->locatorMock ,
22
- ]);
20
+ $ this ->productMock -> expects ( $ this -> once ())-> method ( ' getId ' )-> willReturn ( 2051 );
21
+ $ actualResult = $ this ->getModel ()-> modifyData ( $ this -> getSampleData ());
22
+ $ this -> assertSame ( '' , $ actualResult [ 2051 ][ ' product ' ][ ' media_gallery ' ][ ' images ' ][ 0 ][ ' label ' ]);
23
23
}
24
24
25
25
public function testModifyData ()
@@ -30,7 +30,7 @@ public function testModifyData()
30
30
public function testModifyMeta ()
31
31
{
32
32
$ meta = [
33
- \ Magento \ Catalog \ Ui \ DataProvider \ Product \ Form \ Modifier \ Images::CODE_IMAGE_MANAGEMENT_GROUP => [
33
+ Images::CODE_IMAGE_MANAGEMENT_GROUP => [
34
34
'children ' => [],
35
35
'label ' => __ ('Images ' ),
36
36
'sortOrder ' => '20 ' ,
@@ -40,4 +40,24 @@ public function testModifyMeta()
40
40
41
41
$ this ->assertSame ([], $ this ->getModel ()->modifyMeta ($ meta ));
42
42
}
43
+
44
+ /**
45
+ * {@inheritdoc}
46
+ */
47
+ protected function getSampleData ()
48
+ {
49
+ return [
50
+ 2051 => [
51
+ 'product ' => [
52
+ 'media_gallery ' => [
53
+ 'images ' => [
54
+ [
55
+ 'label ' => null
56
+ ]
57
+ ]
58
+ ]
59
+ ]
60
+ ]
61
+ ];
62
+ }
43
63
}
0 commit comments