6 declare(strict_types=1);
11 use \Magento\Ui\Component\Filters;
22 private $uiComponentInterface;
25 private $uiComponentFactory;
36 $this->uiComponentInterface = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponentInterface::class)
37 ->disableOriginalConstructor()
39 $this->uiComponentFactory = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponentFactory::class)
40 ->disableOriginalConstructor()
42 $this->context = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponent\ContextInterface::class)
43 ->disableOriginalConstructor()
48 'columnFilters' => [
'select' => $this->uiComponentInterface],
49 'uiComponentFactory' => $this->uiComponentFactory,
50 'context' => $this->context,
57 $componentName =
'component_name';
58 $componentConfig = [0, 1, 2];
59 $columnInterface = $this->getMockBuilder(\
Magento\Ui\Component\
Listing\
Columns\ColumnInterface::class)
60 ->disableOriginalConstructor()
61 ->setMethods([
'getData',
'getName',
'getConfiguration'])
62 ->getMockForAbstractClass();
63 $columnInterface->expects($this->atLeastOnce())->method(
'getData')->with(
'config/filter')->willReturn(
'text');
64 $columnInterface->expects($this->atLeastOnce())->method(
'getName')->willReturn($componentName);
65 $columnInterface->expects($this->once())->method(
'getConfiguration')->willReturn($componentConfig);
66 $filterComponent = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponentInterface::class)
67 ->disableOriginalConstructor()
68 ->setMethods([
'setData',
'prepare'])
69 ->getMockForAbstractClass();
70 $filterComponent->expects($this->once())->method(
'setData')->with(
'config', $componentConfig)
72 $filterComponent->expects($this->once())->method(
'prepare')->willReturnSelf();
73 $this->uiComponentFactory->expects($this->once())->method(
'create')
74 ->with($componentName,
'filterInput', [
'context' => $this->context])
75 ->willReturn($filterComponent);
77 $this->filters->update($columnInterface);
79 $this->filters->update($columnInterface);