diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php index 4ec775a..84ceecc 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewListController.php @@ -12,8 +12,10 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Config\Entity\ConfigEntityListController; use Drupal\Core\Entity\EntityControllerInterface; +use Drupal\Core\Entity\EntityOperationsProviderInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -35,9 +37,11 @@ public static function createInstance(ContainerInterface $container, $entity_typ return new static( $entity_type, $container->get('entity.manager')->getStorageController($entity_type), + $container->get('entity.manager')->getOperationsProvider($entity_type), $entity_info, $container->get('plugin.manager.views.display'), - $container->get('module_handler') + $container->get('module_handler'), + $container->get('current_user') ); } @@ -48,15 +52,19 @@ public static function createInstance(ContainerInterface $container, $entity_typ * The type of entity to be listed. * @param \Drupal\Core\Entity\EntityStorageControllerInterface $storage. * The entity storage controller class. + * @param \Drupal\Core\Entity\EntityOperationsProviderInterface $operations + * The entity operations provider. * @param array $entity_info * An array of entity info for this entity type. * @param \Drupal\Component\Plugin\PluginManagerInterface $display_manager * The views display plugin manager to use. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. + * @param |Drupal\Core\Session\AccountInterface $current_user + * The current user. */ - public function __construct($entity_type, EntityStorageControllerInterface $storage, $entity_info, PluginManagerInterface $display_manager, ModuleHandlerInterface $module_handler) { - parent::__construct($entity_type, $entity_info, $storage, $module_handler); + public function __construct($entity_type, EntityStorageControllerInterface $storage, EntityOperationsProviderInterface $operations, $entity_info, PluginManagerInterface $display_manager, ModuleHandlerInterface $module_handler, AccountInterface $current_user) { + parent::__construct($entity_type, $entity_info, $storage, $operations, $module_handler, $current_user); $this->displayManager = $display_manager; } diff --git a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewListControllerTest.php b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewListControllerTest.php index b30bb34..4dd1596 100644 --- a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewListControllerTest.php +++ b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewListControllerTest.php @@ -124,9 +124,21 @@ public function testBuildRowEntityList() { ->disableOriginalConstructor() ->getMock(); + $operations = $this->getMock('\Drupal\Core\Entity\EntityOperationsProviderInterface'); + $operations->expects($this->once()) + ->method('getOperations') + ->will($this->returnValue(array( + 'foo' => array( + 'href' => 'bar', + 'title' => 'Baz', + ), + ))); + + $current_user = $this->getMock('\Drupal\Core\Session\AccountInterface'); + // Setup a view list controller with a mocked buildOperations method, // because t() is called on there. - $view_list_controller = $this->getMock('Drupal\views_ui\ViewListController', array('buildOperations'), array('view', $storage_controller, $entity_info, $display_manager, $module_handler)); + $view_list_controller = $this->getMock('Drupal\views_ui\ViewListController', array('buildOperations'), array('view', $storage_controller, $operations, $entity_info, $display_manager, $module_handler, $current_user)); $view_list_controller->expects($this->any()) ->method('buildOperations') ->will($this->returnValue(array())); diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityListControllerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityListControllerTest.php index c8b07d6..d5841a2 100644 --- a/core/tests/Drupal/Tests/Core/Entity/EntityListControllerTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityListControllerTest.php @@ -74,11 +74,23 @@ protected function setUp() { ->disableOriginalConstructor() ->getMock(); + $operations = $this->getMock('\Drupal\Core\Entity\EntityOperationsProviderInterface'); + $operations->expects($this->once()) + ->method('getOperations') + ->will($this->returnValue(array( + 'foo' => array( + 'href' => 'bar', + 'title' => 'Baz', + ), + ))); + + $current_user = $this->getMock('\Drupal\Core\Session\AccountInterface'); + $module_handler = $this->getMockBuilder('Drupal\Core\Extension\ModuleHandler') ->disableOriginalConstructor() ->getMock(); - $this->entityListController = $this->getMock('Drupal\entity_test\EntityTestListController', array('buildOperations'), array('user_role', static::$entityInfo, $role_storage_controller, $module_handler)); + $this->entityListController = $this->getMock('Drupal\entity_test\EntityTestListController', array('buildOperations'), array('user_role', static::$entityInfo, $role_storage_controller, $operations, $module_handler, $current_user)); $this->entityListController->expects($this->any()) ->method('buildOperations')