@@ -19,8 +19,8 @@ class AttributeColumnTest extends \PHPUnit_Framework_TestCase
19
19
/** @var \Magento\Framework\View\Element\UiComponentFactory|\PHPUnit_Framework_MockObject_MockObject */
20
20
protected $ uiComponentFactory ;
21
21
22
- /** @var CustomerMetadataInterface |\PHPUnit_Framework_MockObject_MockObject */
23
- protected $ customerMetadata ;
22
+ /** @var \Magento\Customer\Ui\Component\Listing\AttributeRepository |\PHPUnit_Framework_MockObject_MockObject */
23
+ protected $ attributeRepository ;
24
24
25
25
/** @var \Magento\Customer\Api\Data\AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject */
26
26
protected $ attributeMetadata ;
@@ -43,14 +43,15 @@ public function setup()
43
43
'' ,
44
44
false
45
45
);
46
- $ this ->customerMetadata = $ this ->getMockForAbstractClass (
47
- 'Magento\Customer\Api\CustomerMetadataInterface ' ,
46
+ $ this ->attributeRepository = $ this ->getMock (
47
+ 'Magento\Customer\Ui\Component\Listing\AttributeRepository ' ,
48
+ [],
48
49
[],
49
50
'' ,
50
51
false
51
52
);
52
53
$ this ->attributeMetadata = $ this ->getMockForAbstractClass (
53
- 'Magento\Customer\Api\Data\AttributeMetadataInterface ' ,
54
+ '\ Magento\Customer\Api\Data\AttributeMetadataInterface ' ,
54
55
[],
55
56
'' ,
56
57
false
@@ -65,7 +66,7 @@ public function setup()
65
66
$ this ->component = new AttributeColumn (
66
67
$ this ->context ,
67
68
$ this ->uiComponentFactory ,
68
- $ this ->customerMetadata
69
+ $ this ->attributeRepository
69
70
);
70
71
$ this ->component ->setData ('name ' , 'gender ' );
71
72
}
@@ -77,9 +78,8 @@ public function testPrepareDataSourceWithoutItems()
77
78
78
79
]
79
80
];
80
- $ this ->customerMetadata ->expects ($ this ->never ())
81
- ->method ('getAttributeMetadata ' )
82
- ->with ('gender ' );
81
+ $ this ->attributeRepository ->expects ($ this ->never ())
82
+ ->method ('getMetadataByCode ' );
83
83
84
84
$ this ->component ->prepareDataSource ($ dataSource );
85
85
}
@@ -114,12 +114,11 @@ public function testPrepareDataSource()
114
114
]
115
115
];
116
116
117
-
118
- $ this ->customerMetadata ->expects ($ this ->once ())
119
- ->method ('getAttributeMetadata ' )
117
+ $ this ->attributeRepository ->expects ($ this ->once ())
118
+ ->method ('getMetadataByCode ' )
120
119
->with ('gender ' )
121
120
->willReturn ($ this ->attributeMetadata );
122
- $ this ->attributeMetadata ->expects ($ this ->once ())
121
+ $ this ->attributeMetadata ->expects ($ this ->atLeastOnce ())
123
122
->method ('getOptions ' )
124
123
->willReturn ([$ this ->genderOption ]);
125
124
$ this ->genderOption ->expects ($ this ->once ())
0 commit comments