29 $this->context = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponent\ContextInterface::class)
30 ->getMockForAbstractClass();
31 $processor = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponent\Processor::class)
32 ->disableOriginalConstructor()
34 $this->context->expects($this->never())->method(
'getProcessor')->willReturn(
$processor);
35 $this->uiComponentFactory = $this->createMock(\
Magento\Framework\View\Element\UiComponentFactory::class);
36 $this->attributeRepository = $this->createMock(
37 \
Magento\Customer\Ui\Component\Listing\AttributeRepository::class
39 $this->attributeMetadata = $this->getMockForAbstractClass(
40 \
Magento\Customer\Api\Data\AttributeMetadataInterface::class,
48 $this->uiComponentFactory,
49 $this->attributeRepository
51 $this->component->setData(
'name',
'gender');
57 $genderOptionLabel =
'Male';
66 'gender' => $genderOptionId
78 'gender' => $genderOptionLabel
84 $this->attributeRepository->expects($this->once())
85 ->method(
'getMetadataByCode')
88 'attribute_code' =>
'billing_attribute_code',
89 'frontend_input' =>
'frontend-input',
90 'frontend_label' =>
'frontend-label',
91 'backend_type' =>
'backend-type',
94 'label' => $genderOptionLabel,
95 'value' => $genderOptionId
98 'is_used_in_grid' =>
true,
99 'is_visible_in_grid' =>
true,
100 'is_filterable_in_grid' =>
true,
101 'is_searchable_in_grid' =>
true,
104 $dataSource = $this->component->prepareDataSource($dataSource);
106 $this->assertEquals($expectedSource, $dataSource);