public function testHandleUpdateNotAllowed() { $massActionMock = $this->getMock(MassActionInterface::class); $datagridMock = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\DatagridInterface'); $iteratorMock = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datasource\\Orm\\IterableResultInterface'); $entityName = 'Test\\EntityName'; $hasConfig = true; $isEnabled = true; $isGranted = false; $data = []; $this->actionRepoMock->expects($this->once())->method('getEntityName')->with($datagridMock)->will($this->returnValue($entityName)); $this->configMock->expects($this->once())->method('hasConfig')->with($entityName)->will($this->returnValue($hasConfig)); $this->configMock->expects($this->once())->method('getConfig')->with($entityName)->will($this->returnValue(new Config(new EntityConfigId('extend', $entityName), ['update_mass_action_enabled' => $isEnabled]))); $this->securityMock->expects($this->once())->method('isGranted')->with('EDIT', 'entity:' . $entityName)->will($this->returnValue($isGranted)); $this->actionRepoMock->expects($this->never())->method('batchUpdate'); $this->transMock->expects($this->once())->method('trans')->will($this->returnValue(uniqid())); $options = ActionConfiguration::create(['success_message' => '', 'error_message' => '']); $massActionMock->expects($this->any())->method('getOptions')->will($this->returnValue($options)); $this->transMock->expects($this->once())->method('trans')->with('', ['%error%' => 'Action not configured or not allowed']); $this->loggerMock->expects($this->once())->method('debug'); $actionResponse = $this->handler->handle(new MassActionHandlerArgs($massActionMock, $datagridMock, $iteratorMock, $data)); $this->assertFalse($actionResponse->isSuccessful()); }