reverted: --- b/core/modules/editor/src/Tests/QuickEditIntegrationTest.php +++ a/core/modules/editor/src/Tests/QuickEditIntegrationTest.php @@ -10,7 +10,6 @@ use Drupal\Component\Serialization\Json; use Drupal\Core\EventSubscriber\AjaxResponseSubscriber; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\Session\AnonymousUserSession; use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit\Plugin\InPlaceEditorManager; @@ -161,7 +160,7 @@ $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->accessChecker = new MockEditEntityFieldAccessCheck(); $this->editorSelector = $this->container->get('quickedit.editor.selector'); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, new AnonymousUserSession()); // Create an entity with values for the field. $entity = entity_create('entity_test'); diff -u b/core/modules/quickedit/src/MetadataGenerator.php b/core/modules/quickedit/src/MetadataGenerator.php --- b/core/modules/quickedit/src/MetadataGenerator.php +++ b/core/modules/quickedit/src/MetadataGenerator.php @@ -5,13 +5,13 @@ use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Field\FieldItemListInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\quickedit\Access\EditEntityFieldAccessCheckInterface; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Field\FieldItemListInterface; -use Drupal\Core\Session\AccountInterface; use Drupal\quickedit\Access\EditEntityFieldAccessCheckInterface; use Drupal\Core\Entity\Entity\EntityViewDisplay; reverted: --- b/core/modules/quickedit/src/Tests/MetadataGeneratorTest.php +++ a/core/modules/quickedit/src/Tests/MetadataGeneratorTest.php @@ -8,7 +8,6 @@ namespace Drupal\quickedit\Tests; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\Session\AnonymousUserSession; use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit\Plugin\InPlaceEditorManager; @@ -48,13 +47,6 @@ protected $editorSelector; /** - * The mocked current user. - * - * @var \Drupal\Core\Session\AccountInterface - */ - protected $currentUser; - - /** * The access checker object to be used by the metadata generator object. * * @var \Drupal\quickedit\Access\EditEntityFieldAccessCheckInterface @@ -67,8 +59,7 @@ $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->accessChecker = new MockEditEntityFieldAccessCheck(); $this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter')); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); - $this->currentUser = new AnonymousUserSession(); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, $this->currentUser); } /** @@ -138,11 +129,11 @@ $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter')); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, $this->currentUser); $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter')); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, $this->currentUser); // Create a rich text field. $field_name = 'field_rich'; only in patch2: unchanged: --- a/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php +++ b/core/modules/editor/tests/src/Kernel/QuickEditIntegrationTest.php @@ -7,6 +7,8 @@ use Drupal\Core\Language\LanguageInterface; use Drupal\editor\Entity\Editor; use Drupal\entity_test\Entity\EntityTest; +use Drupal\Core\Session\AnonymousUserSession; +use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\Tests\quickedit\Kernel\QuickEditTestBase; use Drupal\quickedit_test\MockEditEntityFieldAccessCheck; @@ -167,7 +169,7 @@ public function testMetadata() { $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->accessChecker = new MockEditEntityFieldAccessCheck(); $this->editorSelector = $this->container->get('quickedit.editor.selector'); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, new AnonymousUserSession()); // Create an entity with values for the field. $entity = EntityTest::create(); only in patch2: unchanged: --- a/core/modules/quickedit/tests/src/Kernel/MetadataGeneratorTest.php +++ b/core/modules/quickedit/tests/src/Kernel/MetadataGeneratorTest.php @@ -3,6 +3,8 @@ namespace Drupal\Tests\quickedit\Kernel; use Drupal\entity_test\Entity\EntityTest; +use Drupal\Core\Language\LanguageInterface; +use Drupal\Core\Session\AnonymousUserSession; use Drupal\quickedit\EditorSelector; use Drupal\quickedit\MetadataGenerator; use Drupal\quickedit_test\MockEditEntityFieldAccessCheck; @@ -42,6 +44,13 @@ class MetadataGeneratorTest extends QuickEditTestBase { protected $editorSelector; /** + * The mocked current user. + * + * @var \Drupal\Core\Session\AccountInterface + */ + protected $currentUser; + + /** * The access checker object to be used by the metadata generator object. * * @var \Drupal\quickedit\Access\EditEntityFieldAccessCheckInterface @@ -54,7 +63,8 @@ protected function setUp() { $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->accessChecker = new MockEditEntityFieldAccessCheck(); $this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter')); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); + $this->currentUser = new AnonymousUserSession(); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, $this->currentUser); } /** @@ -122,11 +132,11 @@ public function testSimpleEntityType() { public function testEditorWithCustomMetadata() { $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter')); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, $this->currentUser); $this->editorManager = $this->container->get('plugin.manager.quickedit.editor'); $this->editorSelector = new EditorSelector($this->editorManager, $this->container->get('plugin.manager.field.formatter')); - $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager); + $this->metadataGenerator = new MetadataGenerator($this->accessChecker, $this->editorSelector, $this->editorManager, $this->currentUser); // Create a rich text field. $field_name = 'field_rich';