diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index f61ce08..0e39577 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -232,7 +232,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { // Load all of the configuration entities. $result = array(); - foreach (\Drupal::service('config.factory')->loadMultiple($names) as $config) { + foreach ($this->configStorage->loadMultiple($names) as $config) { $result[$config->get($this->idKey)] = new $config_class($config->get(), $this->entityType); } return $result; diff --git a/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php b/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php index 7537bf7..8884b25 100644 --- a/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php +++ b/core/modules/user/tests/Drupal/user/Tests/Views/Argument/RolesRidTest.php @@ -10,6 +10,7 @@ use Drupal\Component\Utility\String; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Tests\UnitTestCase; +use Drupal\user\Plugin\Core\Entity\Role; use Drupal\user\Plugin\views\argument\RolesRid; /** @@ -47,24 +48,24 @@ public static function getInfo() { * @see \Drupal\user\Plugin\views\argument\RolesRid::title_query() */ public function testTitleQuery() { - $config = array( - 'user.role.test_rid_1' => array( - 'id' => 'test_rid_1', - 'label' => 'test rid 1' - ), - 'user.role.test_rid_2' => array( - 'id' => 'test_rid_2', - 'label' => 'test rid 2', - ), - ); - $config_factory = $this->getConfigFactoryStub($config); - $config_storage = $this->getConfigStorageStub($config); - - // Creates a stub role storage controller and replace the attachLoad() - // method with an empty version, because attachLoad() calls - // module_implements(). - $role_storage_controller = $this->getMock('Drupal\user\RoleStorageController', array('attachLoad'), array('user_role', static::$entityInfo, $config_factory, $config_storage)); - + $role1 = new Role(array( + 'id' => 'test_rid_1', + 'label' => 'test rid 1' + ), 'user_role'); + $role2 = new Role(array( + 'id' => 'test_rid_2', + 'label' => 'test rid 2', + ), 'user_role'); + + // Creates a stub entity storage controller; + $role_storage_controller = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityStorageControllerInterface'); + $role_storage_controller->expects($this->any()) + ->method('load') + ->will($this->returnValueMap(array( + array(array(), array()), + array(array('test_rid_1'), array('test_rid_1' => $role1)), + array(array('test_rid_1', 'test_rid_2'), array('test_rid_1' => $role1, 'test_rid_2' => $role2)), + ))); $entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager') ->disableOriginalConstructor() @@ -88,7 +89,7 @@ public function testTitleQuery() { $container->set('plugin.manager.entity', $entity_manager); \Drupal::setContainer($container); - $roles_rid_argument = new RolesRid($config, 'users_roles_rid', array(), $entity_manager); + $roles_rid_argument = new RolesRid(array(), 'users_roles_rid', array(), $entity_manager); $roles_rid_argument->value = array(); $titles = $roles_rid_argument->title_query();