public function testCreate() { $columnName = 'created_at'; $config = ['data' => ['js_config' => ['component' => 'Magento_Ui/js/grid/columns/column'], 'config' => ['label' => __('Label'), 'dataType' => 'text', 'align' => 'left', 'visible' => true, 'options' => [['label' => 'Label', 'value' => 'Value']], 'component' => 'Magento_Ui/js/grid/columns/column']], 'context' => $this->context]; $attributeData = ['attribute_code' => 'billing_attribute_code', 'frontend_input' => 'text', 'frontend_label' => 'Label', 'backend_type' => 'backend-type', 'options' => [['label' => 'Label', 'value' => 'Value']], 'is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true, 'entity_type_code' => 'customer', 'validation_rules' => [], 'required' => false]; $this->inlineEditUpdater->expects($this->once())->method('applyEditing')->with($this->column, 'text', []); $this->componentFactory->expects($this->once())->method('create')->with($columnName, 'column', $config)->willReturn($this->column); $this->assertSame($this->column, $this->columnFactory->create($attributeData, $columnName, $this->context)); }
public function testPrepareWithUpdateStaticColumn() { $attributeCode = 'billing_attribute_code'; $backendType = 'static'; $attributeData = ['attribute_code' => 'billing_attribute_code', 'frontend_input' => 'text', 'frontend_label' => 'frontend-label', 'backend_type' => $backendType, 'options' => [['label' => 'Label', 'value' => 'Value']], 'is_used_in_grid' => true, 'is_visible_in_grid' => true, 'is_filterable_in_grid' => true, 'is_searchable_in_grid' => true, 'validation_rules' => [], 'required' => false, 'entity_type_code' => 'customer']; $this->inlineEditUpdater->expects($this->once())->method('applyEditing')->with($this->column, 'text', [], false); $this->attributeRepository->expects($this->atLeastOnce())->method('getList')->willReturn([$attributeCode => $attributeData]); $this->columnFactory->expects($this->once())->method('create')->willReturn($this->column); $this->column->expects($this->once())->method('prepare'); $this->column->expects($this->atLeastOnce())->method('getData')->with('config')->willReturn(['editor' => 'text']); $this->column->expects($this->at(3))->method('setData')->with('config', ['editor' => 'text', 'options' => [['label' => 'Label', 'value' => 'Value']]]); $this->column->expects($this->at(6))->method('setData')->with('config', ['editor' => 'text', 'visible' => true]); $this->component->addColumn($attributeData, $attributeCode); $this->component->prepare(); }