34 $this->contextMock = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponent\ContextInterface::class)
35 ->getMockForAbstractClass();
43 public function testGetComponentName()
45 $this->contextMock->expects($this->never())->method(
'getProcessor');
47 $massAction = $this->objectManager->getObject(
48 \
Magento\Ui\Component\MassAction::class,
50 'context' => $this->contextMock,
66 public function testPrepare($componentName, $componentData)
68 $processor = $this->getMockBuilder(\
Magento\Framework\View\Element\UiComponent\Processor::class)
69 ->disableOriginalConstructor()
71 $this->contextMock->expects($this->atLeastOnce())->method(
'getProcessor')->willReturn(
$processor);
73 $action = $this->objectManager->getObject(
74 \
Magento\Ui\Component\MassAction::class,
76 'context' => $this->contextMock,
78 'name' => $componentName,
79 'config' => $componentData,
84 $massAction = $this->objectManager->getObject(
85 \
Magento\Ui\Component\MassAction::class,
87 'context' => $this->contextMock,
91 $massAction->addComponent(
'action', $action);
92 $massAction->prepare();
93 $this->assertEquals([
'actions' => [$action->getConfiguration()]], $massAction->getConfiguration());
105 'type' =>
'first_action',
106 'label' =>
'First Action',
107 'url' =>
'/module/controller/firstAction' 113 'type' =>
'second_action',
114 'label' =>
'Second Action',
117 'type' =>
'second_sub_action1',
118 'label' =>
'Second Sub Action 1',
119 'url' =>
'/module/controller/secondSubAction1' 122 'type' =>
'second_sub_action2',
123 'label' =>
'Second Sub Action 2',
124 'url' =>
'/module/controller/secondSubAction2'