core/lib/Drupal/Core/Config/ConfigManager.php | 6 ++--- .../Core/Config/Entity/ConfigDependencyManager.php | 10 ++++----- .../Drupal/Core/Config/Entity/ConfigEntityBase.php | 3 ++- .../Core/Config/Entity/ConfigEntityDependency.php | 4 ++-- .../block/Tests/BlockConfigEntityUnitTest.php | 2 +- .../Tests/BreakpointConfigEntityUnitTest.php | 1 + .../Tests/BreakpointGroupConfigEntityUnitTest.php | 1 + .../Drupal/config/Tests/ConfigDependencyTest.php | 23 ++++++++++---------- .../Drupal/config/Tests/ConfigOtherModuleTest.php | 2 +- .../editor/lib/Drupal/editor/Entity/Editor.php | 2 +- .../entity/lib/Drupal/entity/EntityDisplayBase.php | 2 +- .../lib/Drupal/entity/Tests/EntityDisplayTest.php | 2 +- .../node/config/search.page.node_search.yml | 2 +- .../rdf/lib/Drupal/rdf/Entity/RdfMapping.php | 2 +- 14 files changed, 33 insertions(+), 29 deletions(-) diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php index a2c3f20..f6f4448 100644 --- a/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -189,10 +189,10 @@ public function findConfigEntityDependentsAsEntities($type, array $names) { foreach ($dependencies as $config_name => $dependency) { // Group by entity type so we can use load multiple. $entity_type_id = $this->getEntityTypeIdByName($config_name); - // It is possible that a non configuration entity will be returned if a - // simple configuration object has a uuid key. This would occur if the + // It is possible that a non-configuration entity will be returned if a + // simple configuration object has a UUID key. This would occur if the // dependents of the system module are calculated since system.site has - // a uuid key. + // a UUID key. if ($entity_type_id) { $id = substr($config_name, strlen($definitions[$entity_type_id]->getConfigPrefix()) + 1); $entities[$entity_type_id][] = $id; diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php index 8f7eb1b..fe702b2 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigDependencyManager.php @@ -79,7 +79,7 @@ public function getDependentEntities($type, $name) { $dependent_entities = array(); if ($type == 'module' || $type == 'theme') { - $dependent_entities = array_filter($this->data, function (ConfigEntityDependency $entity) use ($type, $name) { + $dependent_entities = array_filter($this->data, function (ConfigEntityDependency $entity) use ($type, $name) { return $entity->hasDependency($type, $name); }); } @@ -96,14 +96,14 @@ public function getDependentEntities($type, $name) { } } - return array_merge($dependent_entities, $this->graphConfigEntityDependencies($entities_to_check)); + return array_merge($dependent_entities, $this->createGraphConfigEntityDependencies($entities_to_check)); } /** * Sorts the dependencies in order of most dependent last. * * @return array - * The list of entities in order of most dependent last otherwise + * The list of entities in order of most dependent last, otherwise * alphabetical. */ public function sortAll() { @@ -143,10 +143,10 @@ public function sortGraph(array $a, array $b) { * The entities to supply dependencies for. * * @return \Drupal\Core\Config\Entity\ConfigEntityDependency[] - * An array of config entity dependency objects that are dependent on the + * A graph of config entity dependency objects that are dependent on the * supplied entities to check. */ - protected function graphConfigEntityDependencies($entities_to_check) { + protected function createGraphConfigEntityDependencies($entities_to_check) { $dependent_entities = array(); $graph = $this->getGraph(); diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index e092d88..518d379 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -333,7 +333,7 @@ public function url($rel = 'edit-form', $options = array()) { * @return $this */ protected function addDependency($type, $name) { - // A config entity is always dependent on it's provider. There is no need to + // A config entity is always dependent on its provider. There is no need to // explicitly declare the dependency. // @see \Drupal\Core\Config\Entity\ConfigEntityDependency::hasDependency() if ($type == 'module' && $this->getEntityType()->getProvider() == $name) { @@ -360,4 +360,5 @@ protected function addDependency($type, $name) { public function getConfigDependencyName() { return $this->getEntityType()->getConfigPrefix() . '.' . $this->id(); } + } diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php index 0cc191f..66f9c82 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityDependency.php @@ -59,7 +59,7 @@ public function getDependencies($type) { $dependencies = $this->dependencies[$type]; } if ($type == 'module') { - $dependencies[] = substr($this->name,0, strpos($this->name, '.')); + $dependencies[] = substr($this->name, 0, strpos($this->name, '.')); } return $dependencies; } @@ -77,7 +77,7 @@ public function getDependencies($type) { * @return bool */ public function hasDependency($type, $name) { - // A config entity is always dependent on it's provider. + // A config entity is always dependent on its provider. if ($type == 'module' && strpos($this->name, $name . '.') === 0) { return TRUE; } diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php index ff2c614..34d8373 100644 --- a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php @@ -88,7 +88,7 @@ public function setUp() { */ public function testCalculateDependencies() { $values = array('theme' => 'stark'); - // Mock the entity under test so that we can mock the getPluginBag method. + // Mock the entity under test so that we can mock getPluginBag(). $entity = $this->getMockBuilder('\Drupal\block\Entity\Block') ->setConstructorArgs(array($values, $this->entityTypeId)) ->setMethods(array('getPluginBag')) diff --git a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php index e07a39c..68ff25a 100644 --- a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php +++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php @@ -16,6 +16,7 @@ * * @group Drupal * @group Config + * @group Breakpoint */ class BreakpointConfigEntityUnitTest extends UnitTestCase { diff --git a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php index 154e8e8..a78280d 100644 --- a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php +++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php @@ -16,6 +16,7 @@ * * @group Drupal * @group Config + * @group Breakpoint */ class BreakpointGroupConfigEntityUnitTest extends UnitTestCase { diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php index 3c2a21c..2c423b5 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigDependencyTest.php @@ -83,17 +83,17 @@ public function testDependencyMangement() { // Test getting $entity1's dependencies as configuration dependency objects. $dependents = $config_manager->findConfigEntityDependents('entity', array($entity1->getConfigDependencyName())); $this->assertFalse(isset($dependents['config_test.dynamic.entity1']), 'config_test.dynamic.entity1 does not have a dependency on itself.'); - $this->assertTrue(isset($dependents['config_test.dynamic.entity2']), 'config_test.dynamic.entity1 has a dependency on config_test.dynamic.entity1.'); - $this->assertTrue(isset($dependents['config_test.dynamic.entity3']), 'config_test.dynamic.entity1 has a dependency on config_test.dynamic.entity1.'); - $this->assertTrue(isset($dependents['config_test.dynamic.entity4']), 'config_test.dynamic.entity1 has a dependency on config_test.dynamic.entity1.'); + $this->assertTrue(isset($dependents['config_test.dynamic.entity2']), 'config_test.dynamic.entity2 has a dependency on config_test.dynamic.entity1.'); + $this->assertTrue(isset($dependents['config_test.dynamic.entity3']), 'config_test.dynamic.entity3 has a dependency on config_test.dynamic.entity1.'); + $this->assertTrue(isset($dependents['config_test.dynamic.entity4']), 'config_test.dynamic.entity4 has a dependency on config_test.dynamic.entity1.'); // Test getting $entity2's dependencies as entities. $dependents = $config_manager->findConfigEntityDependentsAsEntities('entity', array($entity2->getConfigDependencyName())); $dependent_ids = $this->getDependentIds($dependents); - $this->assertFalse(in_array('config_test:entity1', $dependent_ids), 'config_test.dynamic.entity2 does not have a dependency on config_test.dynamic.entity1.'); + $this->assertFalse(in_array('config_test:entity1', $dependent_ids), 'config_test.dynamic.entity1 does not have a dependency on config_test.dynamic.entity1.'); $this->assertFalse(in_array('config_test:entity2', $dependent_ids), 'config_test.dynamic.entity2 does not have a dependency on itself.'); - $this->assertTrue(in_array('config_test:entity3', $dependent_ids), 'config_test.dynamic.entity2 has a dependency on config_test.dynamic.entity2.'); - $this->assertTrue(in_array('config_test:entity4', $dependent_ids), 'config_test.dynamic.entity2 has a dependency on config_test.dynamic.entity2.'); + $this->assertTrue(in_array('config_test:entity3', $dependent_ids), 'config_test.dynamic.entity3 has a dependency on config_test.dynamic.entity2.'); + $this->assertTrue(in_array('config_test:entity4', $dependent_ids), 'config_test.dynamic.entity4 has a dependency on config_test.dynamic.entity2.'); // Test getting node module's dependencies as configuration dependency // objects. @@ -104,7 +104,8 @@ public function testDependencyMangement() { $this->assertTrue(isset($dependents['config_test.dynamic.entity4']), 'config_test.dynamic.entity4 has a dependency on the Node module.'); // Test getting node module's dependencies as configuration dependency - // objects after making $entity3 also dependent on node. + // objects after making $entity3 also dependent on node module but $entity_1 + // no longer depend on node module. $entity1->test_dependencies = array(); $entity1->save(); $entity3->test_dependencies['module'] = array('node'); @@ -115,8 +116,8 @@ public function testDependencyMangement() { $this->assertTrue(isset($dependents['config_test.dynamic.entity3']), 'config_test.dynamic.entity3 has a dependency on the Node module.'); $this->assertTrue(isset($dependents['config_test.dynamic.entity4']), 'config_test.dynamic.entity4 has a dependency on the Node module.'); - // Create an configuration entity of a different type with the same ID as - // one of the entities already created. + // Create a configuration entity of a different type with the same ID as one + // of the entities already created. $alt_storage = $this->container->get('entity.manager')->getStorageController('config_query_test'); $alt_storage->create(array('id' => 'entity1', 'test_dependencies' => array('entity' => array($entity1->getConfigDependencyName()))))->save(); $alt_storage->create(array('id' => 'entity2', 'test_dependencies' => array('module' => array('views'))))->save(); @@ -135,7 +136,7 @@ public function testDependencyMangement() { $this->assertFalse(in_array('config_test:entity1', $dependent_ids), 'config_test.dynamic.entity1 does not have a dependency on Views or Node.'); $this->assertFalse(in_array('config_test:entity2', $dependent_ids), 'config_test.dynamic.entity2 does not have a dependency on Views or Node.'); $this->assertTrue(in_array('config_test:entity3', $dependent_ids), 'config_test.dynamic.entity3 has a dependency on Views or Node.'); - $this->assertTrue(in_array('config_test:entity3', $dependent_ids), 'config_test.dynamic.entity4 has a dependency on Views or Node.'); + $this->assertTrue(in_array('config_test:entity4', $dependent_ids), 'config_test.dynamic.entity4 has a dependency on Views or Node.'); $this->assertFalse(in_array('config_query_test:entity1', $dependent_ids), 'config_test.query.entity1 does not have a dependency on Views or Node.'); $this->assertTrue(in_array('config_query_test:entity2', $dependent_ids), 'config_test.query.entity2 has a dependency on Views or Node.'); @@ -144,7 +145,7 @@ public function testDependencyMangement() { $this->assertTrue(in_array('config_test:entity1', $dependent_ids), 'config_test.dynamic.entity1 has a dependency on config_test module.'); $this->assertTrue(in_array('config_test:entity2', $dependent_ids), 'config_test.dynamic.entity2 has a dependency on config_test module.'); $this->assertTrue(in_array('config_test:entity3', $dependent_ids), 'config_test.dynamic.entity3 has a dependency on config_test module.'); - $this->assertTrue(in_array('config_test:entity3', $dependent_ids), 'config_test.dynamic.entity4 has a dependency on config_test module.'); + $this->assertTrue(in_array('config_test:entity4', $dependent_ids), 'config_test.dynamic.entity4 has a dependency on config_test module.'); $this->assertTrue(in_array('config_query_test:entity1', $dependent_ids), 'config_test.query.entity1 has a dependency on config_test module.'); $this->assertTrue(in_array('config_query_test:entity2', $dependent_ids), 'config_test.query.entity2 has a dependency on config_test module.'); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php index 3342808..60c9b28 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php @@ -94,7 +94,7 @@ public function testInstallConfigEnityModuleFirst() { } /** - * Tests uninstalling node removes views which are dependent on them. + * Tests uninstalling node module removes views which are dependent on it. */ public function testUninstall() { $this->moduleHandler->install(array('views')); diff --git a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php index 0a36b43..07dcc4b 100644 --- a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php @@ -91,7 +91,7 @@ public function __construct(array $values, $entity_type) { */ public function calculateDependencies() { parent::calculateDependencies(); - // Create a dependency of the linked filter. + // Create a dependency on the associated FilterFormat. $this->addDependency('entity', $this->getFilterFormat()->getConfigDependencyName()); // @todo use EntityWithPluginBagInterface so configuration between config // entity and dependency on provider is managed automatically. diff --git a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php index 2b361d0..036348a 100644 --- a/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php +++ b/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php @@ -156,7 +156,7 @@ public function calculateDependencies() { $bundle_entity_type_id = $target_entity_type->getBundleEntityType(); if ($bundle_entity_type_id != 'bundle') { - // If the target entity type uses bundles the depend on the bundle entity. + // If the target entity type uses bundles then depend on the bundle entity. $bundle_entity = \Drupal::entityManager()->getStorageController($bundle_entity_type_id)->load($this->bundle); $this->addDependency('entity', $bundle_entity->getConfigDependencyName()); } diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php index 09d023d..d8b6fd4 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php @@ -76,7 +76,7 @@ public function testEntityDisplayCRUD() { // Check that CreateCopy() creates a new component that can be correclty // saved. - entity_create('view_mode', array('id' => $display->targetEntityType .'.other_view_mode', 'targetEntityType' => $display->targetEntityType))->save(); + entity_create('view_mode', array('id' => $display->targetEntityType . '.other_view_mode', 'targetEntityType' => $display->targetEntityType))->save(); $new_display = $display->createCopy('other_view_mode'); $new_display->save(); $new_display = entity_load('entity_view_display', $new_display->id()); diff --git a/core/modules/node/config/search.page.node_search.yml b/core/modules/node/config/search.page.node_search.yml index 76456e5..440c135 100644 --- a/core/modules/node/config/search.page.node_search.yml +++ b/core/modules/node/config/search.page.node_search.yml @@ -9,4 +9,4 @@ configuration: rankings: { } dependencies: module: - - node \ No newline at end of file + - node diff --git a/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php b/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php index e1abd09..9813820 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php +++ b/core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php @@ -165,7 +165,7 @@ public function calculateDependencies() { $this->addDependency('module', $entity_type->getProvider()); $bundle_entity_type_id = $entity_type->getBundleEntityType(); if ($bundle_entity_type_id != 'bundle') { - // If the target entity type uses bundles the depend on the bundle entity. + // If the target entity type uses bundles then depend on the bundle entity. $bundle_entity = \Drupal::entityManager()->getStorageController($bundle_entity_type_id)->load($this->bundle); $this->addDependency('entity', $bundle_entity->getConfigDependencyName()); }