Skip to content

Commit 6f4f96a

Browse files
committed
MAGETWO-48820: Refactor UI component to merge metadata
1 parent 568b2cd commit 6f4f96a

File tree

1 file changed

+0
-87
lines changed

1 file changed

+0
-87
lines changed

app/code/Magento/Ui/Test/Unit/Component/Listing/ColumnsTest.php

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -72,91 +72,4 @@ public function testGetComponentName()
7272

7373
$this->assertEquals($columns->getComponentName(), Columns::NAME);
7474
}
75-
76-
/**
77-
* Run test prepare method
78-
*
79-
* @return void
80-
*/
81-
public function testPrepare()
82-
{
83-
/** @var Column|\PHPUnit_Framework_MockObject_MockObject $componentMock */
84-
$columnMock = $this->getMock(
85-
'Magento\Ui\Component\Listing\Columns\Column',
86-
[],
87-
[],
88-
'',
89-
false
90-
);
91-
/** @var DataProviderInterface|\PHPUnit_Framework_MockObject_MockObject $dataProviderMock */
92-
$dataProviderMock = $this->getMockForAbstractClass(
93-
'Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface',
94-
[],
95-
'',
96-
false
97-
);
98-
99-
$data = [
100-
'name' => 'test_name',
101-
'js_config' => ['extends' => 'test_config_extends'],
102-
'config' => ['dataType' => 'test_type', 'sortable' => true]
103-
];
104-
$saveUrl = 'module/controller/save';
105-
106-
$this->contextMock->expects($this->once())
107-
->method('getDataProvider')
108-
->willReturn($dataProviderMock);
109-
$this->contextMock->expects($this->once())
110-
->method('addComponentDefinition')
111-
->with('columns', ['extends' => 'test_config_extends']);
112-
113-
$dataProviderMock->expects($this->once())
114-
->method('getFieldMetaInfo')
115-
->with('test_name', 'test_column_name')
116-
->willReturn(['test_meta' => 'test_meta_value']);
117-
118-
$columnMock->expects($this->once())
119-
->method('getName')
120-
->willReturn('test_column_name');
121-
$columnMock->expects($this->once())
122-
->method('getData')
123-
->with('config')
124-
->willReturn(['test_config_data' => 'test_config_value']);
125-
$columnMock->expects($this->once())
126-
->method('setData')
127-
->with('config', ['test_config_data' => 'test_config_value', 'test_meta' => 'test_meta_value']);
128-
129-
/** @var Columns $columns */
130-
$columns = $this->objectManager->getObject(
131-
'Magento\Ui\Component\Listing\Columns',
132-
[
133-
'components' => [$columnMock],
134-
'context' => $this->contextMock,
135-
'data' => $data
136-
]
137-
);
138-
$columns->setData(
139-
'config',
140-
[
141-
'test_config_data' => 'test_config_value',
142-
'editorConfig' => [
143-
'clientConfig' => [
144-
'saveUrl' => $saveUrl,
145-
]
146-
]
147-
]
148-
);
149-
$columns->prepare();
150-
$this->assertEquals(
151-
[
152-
'test_config_data' => 'test_config_value',
153-
'editorConfig' => [
154-
'clientConfig' => [
155-
'saveUrl' => $saveUrl,
156-
]
157-
]
158-
],
159-
$columns->getData('config')
160-
);
161-
}
16275
}

0 commit comments

Comments
 (0)