public function testPrepareDataSource() { $genderOptionId = 1; $genderOptionLabel = 'Male'; $dataSource = ['data' => ['items' => [['name' => 'testName'], ['gender' => $genderOptionId]]]]; $expectedSource = ['data' => ['items' => [['name' => 'testName'], ['gender' => $genderOptionLabel]]]]; $this->attributeRepository->expects($this->once())->method('getMetadataByCode')->with('gender')->willReturn(['attribute_code' => 'billing_attribute_code', 'frontend_input' => 'frontend-input', 'frontend_label' => 'frontend-label', 'backend_type' => 'backend-type', 'options' => [['label' => $genderOptionLabel, 'value' => $genderOptionId]], 'is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true]); $dataSource = $this->component->prepareDataSource($dataSource); $this->assertEquals($expectedSource, $dataSource); }