core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php b/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php index 8b3cb90..66b6a08 100644 --- a/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php +++ b/core/modules/editor/tests/src/Kernel/EditorFileUsageTest.php @@ -199,19 +199,21 @@ public function testEditorEntityHooks() { $this->assertIdentical(['editor' => ['node' => [1 => '2']]], $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 2 usages.'); } - // Populate both the body and summary. Because this will be the same - // revision of the same node, it will record only one usage. + // Populate both the body and summary. Despite this being the same revision, + // this will record 2 usages, because two different field properties are + // referencing the same file, and both field properties can be updated + // independently. foreach ($original_values as $key => $original_value) { $node->body[$key]->value = $original_value; $node->body[$key]->summary = $original_value; } $node->save(); foreach ($image_entities as $key => $image_entity) { - $this->assertIdentical(['editor' => ['node' => [1 => '2']]], $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 2 usages.'); + $this->assertIdentical(['editor' => ['node' => [1 => '3']]], $file_usage->listUsage($image_entity), 'The image ' . $image_paths[$key] . ' has 3 usages.'); } // Empty out the body value, but keep the summary. The number of usages - // should not change. + // should be decremented. foreach ($original_values as $key => $original_value) { $node->body[$key]->value = ''; $node->body[$key]->summary = $original_value;