From 47a5fb62717669384dffdc3eb68d413c402aadb9 Mon Sep 17 00:00:00 2001 From: Michael Lee <lee.5151@osu.edu> Date: Thu, 23 Jun 2022 14:23:01 -0400 Subject: [PATCH] Upgrading drupal/entity_browser (2.6.0 => 2.7.0) --- composer.json | 2 +- composer.lock | 16 ++++++++-------- vendor/composer/installed.json | 16 ++++++++-------- vendor/composer/installed.php | 10 +++++----- web/modules/entity_browser/drupalci.yml | 10 ++++++++++ .../entity_browser/entity_browser.info.yml | 6 +++--- .../entity_browser/entity_browser.module | 3 ++- .../entity_browser_entity_form.schema.yml | 2 +- .../entity_browser_entity_form.info.yml | 6 +++--- .../Plugin/EntityBrowser/Widget/EntityForm.php | 6 +++--- .../entity_browser_entity_form_test.info.yml | 6 +++--- .../InlineEntityIntegrationTest.php | 2 +- .../example/entity_browser_example.info.yml | 6 +++--- .../src/Form/EntityBrowserForm.php | 3 +++ .../FieldWidgetDisplay/RenderedEntity.php | 7 ++++++- .../EntityBrowser/Widget/MediaImageUpload.php | 4 ++-- .../src/Plugin/EntityBrowser/Widget/Upload.php | 6 +++--- .../src/Plugin/EntityBrowser/Widget/View.php | 4 ++-- .../EntityReferenceBrowserWidget.php | 3 ++- .../entity_browser/src/RouteSubscriber.php | 1 + .../update/entity_browser.update-hook-test.php | 1 + .../entity_browser_entity_embed_test.info.yml | 6 +++--- .../entity_browser_ief_test.info.yml | 6 +++--- .../entity_browser_test.info.yml | 6 +++--- .../EntityBrowser/Widget/DummyWidget.php | 2 +- .../EntityBrowser/Widget/PagerTestWidget.php | 4 ++-- .../entity_browser_test_configuration.info.yml | 6 +++--- .../entity_browser_test_entityqueue.info.yml | 6 +++--- .../entity_browser_test_paragraphs.info.yml | 6 +++--- .../tests/src/Functional/ConfigAccessTest.php | 2 +- .../Functional/EntityBrowserUpdateHookTest.php | 4 ++-- .../FunctionalJavascript/ConfigurationTest.php | 18 +++++++++--------- .../FunctionalJavascript/EntityBrowserTest.php | 2 +- .../EntityReferenceWidgetTest.php | 2 +- .../src/FunctionalJavascript/PluginsTest.php | 1 + .../src/Kernel/Extension/EntityBrowserTest.php | 2 +- 36 files changed, 108 insertions(+), 85 deletions(-) create mode 100644 web/modules/entity_browser/drupalci.yml rename web/modules/entity_browser/modules/entity_form/{src/Tests => tests/src/FunctionalJavascript}/InlineEntityIntegrationTest.php (98%) diff --git a/composer.json b/composer.json index efb8557421..4041217302 100644 --- a/composer.json +++ b/composer.json @@ -113,7 +113,7 @@ "drupal/editor_advanced_link": "1.9", "drupal/embed": "1.5", "drupal/entity": "1.2", - "drupal/entity_browser": "2.6", + "drupal/entity_browser": "2.7", "drupal/entity_clone": "1.0.0-beta5", "drupal/entity_embed": "1.2", "drupal/entity_reference_revisions": "1.9", diff --git a/composer.lock b/composer.lock index 7c76906141..b947a8750d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "696a833ee60a97e6e3bc92cebd73f1a7", + "content-hash": "18272fdf87dda228d9bd42e03cb12627", "packages": [ { "name": "alchemy/zippy", @@ -3838,17 +3838,17 @@ }, { "name": "drupal/entity_browser", - "version": "2.6.0", + "version": "2.7.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/entity_browser.git", - "reference": "8.x-2.6" + "reference": "8.x-2.7" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/entity_browser-8.x-2.6.zip", - "reference": "8.x-2.6", - "shasum": "95cad4ce9620ccb4f02afa0e8b8bbf7c73fc5aac" + "url": "https://ftp.drupal.org/files/projects/entity_browser-8.x-2.7.zip", + "reference": "8.x-2.7", + "shasum": "4d8606f9ab8dff8e484dd9417eafb6d97911892d" }, "require": { "drupal/core": "^8.8 || ^9" @@ -3865,8 +3865,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.6", - "datestamp": "1624401306", + "version": "8.x-2.7", + "datestamp": "1655931710", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b378522c28..14c56e801b 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -3949,18 +3949,18 @@ }, { "name": "drupal/entity_browser", - "version": "2.6.0", - "version_normalized": "2.6.0.0", + "version": "2.7.0", + "version_normalized": "2.7.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/entity_browser.git", - "reference": "8.x-2.6" + "reference": "8.x-2.7" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/entity_browser-8.x-2.6.zip", - "reference": "8.x-2.6", - "shasum": "95cad4ce9620ccb4f02afa0e8b8bbf7c73fc5aac" + "url": "https://ftp.drupal.org/files/projects/entity_browser-8.x-2.7.zip", + "reference": "8.x-2.7", + "shasum": "4d8606f9ab8dff8e484dd9417eafb6d97911892d" }, "require": { "drupal/core": "^8.8 || ^9" @@ -3977,8 +3977,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.6", - "datestamp": "1624401306", + "version": "8.x-2.7", + "datestamp": "1655931710", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 71ea943518..fdc711dcd5 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'osu-asc-webservices/d8-upstream', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'eacb230d5cea81dd1e10abc31ef939a2f5cb5614', + 'reference' => '1f9f455a37d9501f0de830f50f9a2a058a690f13', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -875,9 +875,9 @@ 'dev_requirement' => false, ), 'drupal/entity_browser' => array( - 'pretty_version' => '2.6.0', - 'version' => '2.6.0.0', - 'reference' => '8.x-2.6', + 'pretty_version' => '2.7.0', + 'version' => '2.7.0.0', + 'reference' => '8.x-2.7', 'type' => 'drupal-module', 'install_path' => __DIR__ . '/../../web/modules/entity_browser', 'aliases' => array(), @@ -2098,7 +2098,7 @@ 'osu-asc-webservices/d8-upstream' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'eacb230d5cea81dd1e10abc31ef939a2f5cb5614', + 'reference' => '1f9f455a37d9501f0de830f50f9a2a058a690f13', 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/web/modules/entity_browser/drupalci.yml b/web/modules/entity_browser/drupalci.yml new file mode 100644 index 0000000000..2ae545e6c8 --- /dev/null +++ b/web/modules/entity_browser/drupalci.yml @@ -0,0 +1,10 @@ +build: + assessment: + testing: + run_tests: + # Run all tests together with high concurrency. + types: 'PHPUnit-Unit,PHPUnit-Kernel,PHPUnit-Functional,PHPUnit-FunctionalJavascript' + testgroups: '--all' + suppress-deprecations: true + halt-on-fail: false + concurrency: 15 diff --git a/web/modules/entity_browser/entity_browser.info.yml b/web/modules/entity_browser/entity_browser.info.yml index db2ac484e6..2c2707d3e9 100644 --- a/web/modules/entity_browser/entity_browser.info.yml +++ b/web/modules/entity_browser/entity_browser.info.yml @@ -5,7 +5,7 @@ package: Media core_version_requirement: ^8.8 || ^9 configure: entity.entity_browser.collection -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/entity_browser.module b/web/modules/entity_browser/entity_browser.module index db086afefd..ea32040963 100644 --- a/web/modules/entity_browser/entity_browser.module +++ b/web/modules/entity_browser/entity_browser.module @@ -6,6 +6,7 @@ */ use Drupal\Core\Entity\Display\EntityViewDisplayInterface; +use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; @@ -70,7 +71,7 @@ function entity_browser_theme() { */ function entity_browser_form_alter(&$form, FormStateInterface &$form_state) { $entity_browser_dialog_edit = \Drupal::service('request_stack')->getCurrentRequest()->get('_route'); - if ($entity_browser_dialog_edit == 'entity_browser.edit_form') { + if ($entity_browser_dialog_edit == 'entity_browser.edit_form' && $form_state->getFormObject() instanceof EntityForm) { // Let's allow the save button only. foreach (Element::children($form['actions']) as $key) { $form['actions'][$key]['#access'] = $key == 'submit'; diff --git a/web/modules/entity_browser/modules/entity_form/config/schema/entity_browser_entity_form.schema.yml b/web/modules/entity_browser/modules/entity_form/config/schema/entity_browser_entity_form.schema.yml index 16928a1173..0a9dcacf60 100644 --- a/web/modules/entity_browser/modules/entity_form/config/schema/entity_browser_entity_form.schema.yml +++ b/web/modules/entity_browser/modules/entity_form/config/schema/entity_browser_entity_form.schema.yml @@ -11,7 +11,7 @@ entity_browser.browser.widget.entity_form: label: 'Entity form widget configuration' mapping: submit_text: - type: string + type: label label: 'Submit button text' entity_type: type: string diff --git a/web/modules/entity_browser/modules/entity_form/entity_browser_entity_form.info.yml b/web/modules/entity_browser/modules/entity_form/entity_browser_entity_form.info.yml index 25222ac9d7..7a16fb85d6 100644 --- a/web/modules/entity_browser/modules/entity_form/entity_browser_entity_form.info.yml +++ b/web/modules/entity_browser/modules/entity_form/entity_browser_entity_form.info.yml @@ -7,7 +7,7 @@ dependencies: - entity_browser:entity_browser - inline_entity_form:inline_entity_form -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php b/web/modules/entity_browser/modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php index af08d77d3f..771aeaaaae 100644 --- a/web/modules/entity_browser/modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php +++ b/web/modules/entity_browser/modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php @@ -87,12 +87,12 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function defaultConfiguration() { - return [ + return array_merge(parent::defaultConfiguration(), [ + 'submit_text' => $this->t('Save entity'), 'entity_type' => NULL, 'bundle' => NULL, 'form_mode' => 'default', - 'submit_text' => $this->t('Save entity'), - ] + parent::defaultConfiguration(); + ]); } /** diff --git a/web/modules/entity_browser/modules/entity_form/tests/modules/entity_browser_entity_form_test/entity_browser_entity_form_test.info.yml b/web/modules/entity_browser/modules/entity_form/tests/modules/entity_browser_entity_form_test/entity_browser_entity_form_test.info.yml index 5d5e02d3a2..6145a1ff14 100644 --- a/web/modules/entity_browser/modules/entity_form/tests/modules/entity_browser_entity_form_test/entity_browser_entity_form_test.info.yml +++ b/web/modules/entity_browser/modules/entity_form/tests/modules/entity_browser_entity_form_test/entity_browser_entity_form_test.info.yml @@ -8,7 +8,7 @@ dependencies: - entity_browser_test:entity_browser_test - drupal:views -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/modules/entity_form/src/Tests/InlineEntityIntegrationTest.php b/web/modules/entity_browser/modules/entity_form/tests/src/FunctionalJavascript/InlineEntityIntegrationTest.php similarity index 98% rename from web/modules/entity_browser/modules/entity_form/src/Tests/InlineEntityIntegrationTest.php rename to web/modules/entity_browser/modules/entity_form/tests/src/FunctionalJavascript/InlineEntityIntegrationTest.php index 59e3687ac8..11c4122770 100644 --- a/web/modules/entity_browser/modules/entity_form/src/Tests/InlineEntityIntegrationTest.php +++ b/web/modules/entity_browser/modules/entity_form/tests/src/FunctionalJavascript/InlineEntityIntegrationTest.php @@ -1,6 +1,6 @@ <?php -namespace Drupal\entity_browser_entity_form\Tests; +namespace Drupal\Tests\entity_browser_entity_form\FunctionalJavascript; use Drupal\FunctionalJavascriptTests\WebDriverTestBase; diff --git a/web/modules/entity_browser/modules/example/entity_browser_example.info.yml b/web/modules/entity_browser/modules/example/entity_browser_example.info.yml index 9dbf52a462..a5fd327a64 100644 --- a/web/modules/entity_browser/modules/example/entity_browser_example.info.yml +++ b/web/modules/entity_browser/modules/example/entity_browser_example.info.yml @@ -11,7 +11,7 @@ dependencies: - drupal:node - drupal:image -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/src/Form/EntityBrowserForm.php b/web/modules/entity_browser/src/Form/EntityBrowserForm.php index 1f274c9ef3..06435a188c 100644 --- a/web/modules/entity_browser/src/Form/EntityBrowserForm.php +++ b/web/modules/entity_browser/src/Form/EntityBrowserForm.php @@ -162,6 +162,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { return $form; } + // Allow submission in non-default workspace. + $form_state->set('workspace_safe', TRUE); + $this->entityBrowser ->getWidgetSelector() ->setDefaultWidget($current_widget_id); diff --git a/web/modules/entity_browser/src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php b/web/modules/entity_browser/src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php index fb43de237c..f0a3e67483 100644 --- a/web/modules/entity_browser/src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php +++ b/web/modules/entity_browser/src/Plugin/EntityBrowser/FieldWidgetDisplay/RenderedEntity.php @@ -76,7 +76,12 @@ public function view(EntityInterface $entity) { ->view($entity, $this->configuration['view_mode']); $build['#entity_browser_suppress_contextual'] = TRUE; - $build['#cache']['keys'][] = 'entity_browser'; + + // If the entity is render cached, add another cache key to differentiate + // it from other places using the same view mode. + if (!empty($build['#cache']['keys'])) { + $build['#cache']['keys'][] = 'entity_browser'; + } return $build; } diff --git a/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/MediaImageUpload.php b/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/MediaImageUpload.php index 5baf1c80b0..f417018b65 100644 --- a/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/MediaImageUpload.php +++ b/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/MediaImageUpload.php @@ -23,10 +23,10 @@ class MediaImageUpload extends FileUpload { * {@inheritdoc} */ public function defaultConfiguration() { - return [ + return array_merge(parent::defaultConfiguration(), [ 'extensions' => 'jpg jpeg png gif', 'media_type' => NULL, - ] + parent::defaultConfiguration(); + ]); } /** diff --git a/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/Upload.php b/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/Upload.php index a0b7edfd61..8883104663 100644 --- a/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/Upload.php +++ b/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/Upload.php @@ -85,12 +85,12 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function defaultConfiguration() { - return [ + return array_merge(parent::defaultConfiguration(), [ + 'submit_text' => $this->t('Select files'), 'upload_location' => 'public://', 'multiple' => TRUE, - 'submit_text' => $this->t('Select files'), 'extensions' => 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp', - ] + parent::defaultConfiguration(); + ]); } /** diff --git a/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/View.php b/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/View.php index 51b7ba227d..1e939824eb 100644 --- a/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/View.php +++ b/web/modules/entity_browser/src/Plugin/EntityBrowser/Widget/View.php @@ -41,10 +41,10 @@ class View extends WidgetBase implements ContainerFactoryPluginInterface { * {@inheritdoc} */ public function defaultConfiguration() { - return [ + return array_merge(parent::defaultConfiguration(), [ 'view' => NULL, 'view_display' => NULL, - ] + parent::defaultConfiguration(); + ]); } /** diff --git a/web/modules/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php b/web/modules/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php index 0901eba5f3..42c9da7b0f 100644 --- a/web/modules/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php +++ b/web/modules/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php @@ -815,7 +815,8 @@ protected function formElementEntities(FieldItemListInterface $items, array $ele $field_name_key = end($trigger['#parents']) === 'target_id' ? 2 : static::$deleteDepth + 1; $field_name_key = count($trigger['#parents']) - $field_name_key; $is_relevant_submit &= ($trigger['#parents'][$field_name_key] === $this->fieldDefinition->getName()) && - (array_slice($trigger['#parents'], 0, count($element['#field_parents'])) == $element['#field_parents']); + (array_slice($trigger['#parents'], 0, count($element['#field_parents'])) == $element['#field_parents']) && + (array_slice($trigger['#parents'], 0, $field_name_key) == $element['#field_parents']); } }; diff --git a/web/modules/entity_browser/src/RouteSubscriber.php b/web/modules/entity_browser/src/RouteSubscriber.php index 6d307b3827..75cb3b2789 100644 --- a/web/modules/entity_browser/src/RouteSubscriber.php +++ b/web/modules/entity_browser/src/RouteSubscriber.php @@ -74,6 +74,7 @@ protected function getBrowserIDsWithRoute() { } return $this->browserStorage->getQuery() + ->accessCheck(TRUE) ->condition('status', TRUE) ->condition("display", $ids, 'IN') ->execute(); diff --git a/web/modules/entity_browser/tests/fixtures/update/entity_browser.update-hook-test.php b/web/modules/entity_browser/tests/fixtures/update/entity_browser.update-hook-test.php index 215f7a5769..26b35b4c6d 100644 --- a/web/modules/entity_browser/tests/fixtures/update/entity_browser.update-hook-test.php +++ b/web/modules/entity_browser/tests/fixtures/update/entity_browser.update-hook-test.php @@ -61,6 +61,7 @@ ->execute(); $config = Yaml::decode(file_get_contents(__DIR__ . '/../../modules/entity_browser_test/config/install/views.view.test_deprecated_field.yml')); +$config['uuid'] = '3374cfd0-6708-4047-b3ee-51c0349fb11e'; $connection->insert('config') ->fields([ 'collection', diff --git a/web/modules/entity_browser/tests/modules/entity_browser_entity_embed_test/entity_browser_entity_embed_test.info.yml b/web/modules/entity_browser/tests/modules/entity_browser_entity_embed_test/entity_browser_entity_embed_test.info.yml index 84db40104d..04b59a5182 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_entity_embed_test/entity_browser_entity_embed_test.info.yml +++ b/web/modules/entity_browser/tests/modules/entity_browser_entity_embed_test/entity_browser_entity_embed_test.info.yml @@ -17,7 +17,7 @@ dependencies: - entity_browser:entity_browser - entity_browser_test:entity_browser_test -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/tests/modules/entity_browser_ief_test/entity_browser_ief_test.info.yml b/web/modules/entity_browser/tests/modules/entity_browser_ief_test/entity_browser_ief_test.info.yml index a52717ca4a..37e26054fa 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_ief_test/entity_browser_ief_test.info.yml +++ b/web/modules/entity_browser/tests/modules/entity_browser_ief_test/entity_browser_ief_test.info.yml @@ -12,7 +12,7 @@ dependencies: - inline_entity_form:inline_entity_form - drupal:views -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/tests/modules/entity_browser_test/entity_browser_test.info.yml b/web/modules/entity_browser/tests/modules/entity_browser_test/entity_browser_test.info.yml index b02578a5a0..be0ce225fd 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_test/entity_browser_test.info.yml +++ b/web/modules/entity_browser/tests/modules/entity_browser_test/entity_browser_test.info.yml @@ -10,7 +10,7 @@ dependencies: - drupal:node - drupal:views -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php b/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php index 820d27149c..0a3be46fa6 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php +++ b/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php @@ -29,7 +29,7 @@ class DummyWidget extends WidgetBase { * {@inheritdoc} */ public function defaultConfiguration() { - return ['text' => ''] + parent::defaultConfiguration(); + return array_merge(parent::defaultConfiguration(), ['text' => '']); } /** diff --git a/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/PagerTestWidget.php b/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/PagerTestWidget.php index 551aaef082..b4bf36b729 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/PagerTestWidget.php +++ b/web/modules/entity_browser/tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/PagerTestWidget.php @@ -58,7 +58,7 @@ public function getForm(array &$original_form, FormStateInterface $form_state, a /** * Submit callback for first page reset button. */ - public function submitFirst(array &$form, FormStateInterface $form_state) { + public static function submitFirst(array &$form, FormStateInterface $form_state) { EntityBrowserPagerElement::setCurrentPage($form_state); $form_state->setRebuild(); } @@ -66,7 +66,7 @@ public function submitFirst(array &$form, FormStateInterface $form_state) { /** * Submit callback for last page reset button. */ - public function submitLast(array &$form, FormStateInterface $form_state) { + public static function submitLast(array &$form, FormStateInterface $form_state) { EntityBrowserPagerElement::setCurrentPage($form_state, 4); $form_state->setRebuild(); } diff --git a/web/modules/entity_browser/tests/modules/entity_browser_test_configuration/entity_browser_test_configuration.info.yml b/web/modules/entity_browser/tests/modules/entity_browser_test_configuration/entity_browser_test_configuration.info.yml index dc2b9e6512..33480c177b 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_test_configuration/entity_browser_test_configuration.info.yml +++ b/web/modules/entity_browser/tests/modules/entity_browser_test_configuration/entity_browser_test_configuration.info.yml @@ -10,7 +10,7 @@ dependencies: - drupal:views - drupal:user -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/tests/modules/entity_browser_test_entityqueue/entity_browser_test_entityqueue.info.yml b/web/modules/entity_browser/tests/modules/entity_browser_test_entityqueue/entity_browser_test_entityqueue.info.yml index 329e37d014..85ed041330 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_test_entityqueue/entity_browser_test_entityqueue.info.yml +++ b/web/modules/entity_browser/tests/modules/entity_browser_test_entityqueue/entity_browser_test_entityqueue.info.yml @@ -10,7 +10,7 @@ dependencies: - entity_browser:entity_browser - entity_browser_test:entity_browser_test -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/tests/modules/entity_browser_test_paragraphs/entity_browser_test_paragraphs.info.yml b/web/modules/entity_browser/tests/modules/entity_browser_test_paragraphs/entity_browser_test_paragraphs.info.yml index df491c484b..07e7910e1c 100644 --- a/web/modules/entity_browser/tests/modules/entity_browser_test_paragraphs/entity_browser_test_paragraphs.info.yml +++ b/web/modules/entity_browser/tests/modules/entity_browser_test_paragraphs/entity_browser_test_paragraphs.info.yml @@ -13,7 +13,7 @@ dependencies: - drupal:views - drupal:user -# Information added by Drupal.org packaging script on 2021-06-22 -version: '8.x-2.6' +# Information added by Drupal.org packaging script on 2022-06-22 +version: '8.x-2.7' project: 'entity_browser' -datestamp: 1624401308 +datestamp: 1655931713 diff --git a/web/modules/entity_browser/tests/src/Functional/ConfigAccessTest.php b/web/modules/entity_browser/tests/src/Functional/ConfigAccessTest.php index cab07600c3..f56738dd6f 100644 --- a/web/modules/entity_browser/tests/src/Functional/ConfigAccessTest.php +++ b/web/modules/entity_browser/tests/src/Functional/ConfigAccessTest.php @@ -83,7 +83,7 @@ public function testEntityBrowserEditFormAccess() { $this->drupalGet('/admin/config/content/entity_browser'); $this->clickLink('Delete'); $this->assertSession()->responseContains('This action cannot be undone.', 'Delete question found.'); - $this->drupalPostForm(NULL, [], 'Delete Entity Browser'); + $this->submitForm([], 'Delete Entity Browser'); $this->assertSession()->responseContains('Entity browser <em class="placeholder">Test entity browser</em> was deleted.', 'Confirmation message found.'); $this->assertSession()->responseContains('There are no entity browser entities yet.', 'Entity browsers table is empty.'); diff --git a/web/modules/entity_browser/tests/src/Functional/EntityBrowserUpdateHookTest.php b/web/modules/entity_browser/tests/src/Functional/EntityBrowserUpdateHookTest.php index 34041f31b2..2a47b4df15 100644 --- a/web/modules/entity_browser/tests/src/Functional/EntityBrowserUpdateHookTest.php +++ b/web/modules/entity_browser/tests/src/Functional/EntityBrowserUpdateHookTest.php @@ -45,8 +45,8 @@ protected function setUp() { */ protected function doSelectionTest() { parent::doSelectionTest(); - $this->assertSession()->responseContains('8001 - Updates submit text for existing Entity browsers.'); - $this->assertSession()->responseContains('8002 - Migrates duplicated Views entity_browser_select fields.'); + $this->assertSession()->responseContains('8001 - Updates submit text for existing Entity browsers.'); + $this->assertSession()->responseContains('8002 - Migrates duplicated Views entity_browser_select fields.'); } /** diff --git a/web/modules/entity_browser/tests/src/FunctionalJavascript/ConfigurationTest.php b/web/modules/entity_browser/tests/src/FunctionalJavascript/ConfigurationTest.php index a18abaf74a..4d2b443358 100644 --- a/web/modules/entity_browser/tests/src/FunctionalJavascript/ConfigurationTest.php +++ b/web/modules/entity_browser/tests/src/FunctionalJavascript/ConfigurationTest.php @@ -81,7 +81,7 @@ public function testEntityBrowserEditForm() { $this->assertSession()->fieldExists('display_configuration[link_text]')->setValue('Select some entities'); $this->assertSession()->selectExists('widget_selector')->selectOption('tabs'); $this->assertSession()->selectExists('selection_display')->selectOption('no_display'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been added. Now you may configure the widgets you would like to use.'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/widgets'); @@ -112,7 +112,7 @@ public function testEntityBrowserEditForm() { $this->assertSession()->fieldExists('display_configuration[width]')->setValue('100'); $this->assertSession()->fieldExists('display_configuration[height]')->setValue('100'); $this->assertSession()->fieldExists('display_configuration[link_text]')->setValue('All animals are created equal'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/edit'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been updated.'); @@ -137,7 +137,7 @@ public function testEntityBrowserEditForm() { $this->assertSession()->selectExists('display')->selectOption('standalone'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertSession()->fieldExists('display_configuration[path]')->setValue('/all-animals'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/edit'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been updated.'); $this->clickLink('General Settings'); @@ -155,10 +155,10 @@ public function testEntityBrowserEditForm() { // Test validation of leading forward slash. $this->assertSession()->fieldExists('display_configuration[path]')->setValue('no-forward-slash'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->responseContains('The Path field must begin with a forward slash.'); $this->assertSession()->fieldExists('display_configuration[path]')->setValue('/all-animals'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been updated.'); $this->getSession()->executeScript("jQuery('details').attr('open', 'open');"); @@ -229,7 +229,7 @@ public function testWidgetsConfig() { $this->getSession()->executeScript("jQuery('.visually-hidden').removeClass('visually-hidden');"); $this->assertSession()->fieldExists('name')->setValue('test_entity_browser'); // Use defaults and save to go to WidgetsConfig form. - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/widgets'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been added. Now you may configure the widgets you would like to use.'); $widgetSelect = $this->assertSession()->selectExists('widget'); @@ -251,7 +251,7 @@ public function testWidgetsConfig() { $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertSession()->selectExists("table[$uuid][form][bundle][select]")->selectOption('foo'); $this->assertSession()->selectExists("table[$uuid][form][form_mode][form_select]"); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/widgets'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been updated.'); @@ -282,7 +282,7 @@ public function testWidgetsConfig() { $this->assertSession()->fieldExists("table[$uuid][form][submit_text]"); $this->assertSession()->fieldExists("table[$uuid][form][auto_select]")->check(); $this->assertSession()->selectExists("table[$uuid][form][view]")->selectOption('nodes_entity_browser.entity_browser_1'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/widgets'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been updated.'); @@ -315,7 +315,7 @@ public function testWidgetsConfig() { $this->assertSession()->fieldExists("table[$uuid][form][multiple]"); $this->assertSession()->fieldExists("table[$uuid][form][upload_location]"); $this->assertSession()->elementExists('css', 'a.token-dialog.use-ajax'); - $this->drupalPostForm(NULL, [], 'Save'); + $this->submitForm([], 'Save'); $this->assertSession()->addressEquals('/admin/config/content/entity_browser/test_entity_browser/widgets'); $this->assertSession()->pageTextContains('The entity browser Test entity browser has been updated.'); diff --git a/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityBrowserTest.php b/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityBrowserTest.php index e32d35d2f3..f2bc3877df 100644 --- a/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityBrowserTest.php +++ b/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityBrowserTest.php @@ -175,7 +175,7 @@ public function testTabsWidgetSelector() { // $edit = [ // 'files[upload][]' => $uri, // ]; - // $this->drupalPostForm(NULL, $edit, 'Select files');. + // $this->submitForm($edit, 'Select files');. \Drupal::state()->set('eb_test_dummy_widget_access', FALSE); $this->drupalGet('entity-browser/iframe/test_entity_browser_file'); $this->assertSession()->linkNotExists('dummy'); diff --git a/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php b/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php index 53f309eec2..612a5a0ee5 100644 --- a/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php +++ b/web/modules/entity_browser/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php @@ -105,7 +105,7 @@ public function testEntityReferenceWidget() { $this->assertSession()->buttonExists('Save')->press(); $this->assertSession()->pageTextContains('Article Referencing node 1 has been created.'); - $nid = \Drupal::entityQuery('node')->condition('title', 'Referencing node 1')->execute(); + $nid = \Drupal::entityQuery('node')->accessCheck(TRUE)->condition('title', 'Referencing node 1')->execute(); $nid = reset($nid); // Assert correct translation appears. diff --git a/web/modules/entity_browser/tests/src/FunctionalJavascript/PluginsTest.php b/web/modules/entity_browser/tests/src/FunctionalJavascript/PluginsTest.php index 1c8155d37d..4903d2d3f7 100644 --- a/web/modules/entity_browser/tests/src/FunctionalJavascript/PluginsTest.php +++ b/web/modules/entity_browser/tests/src/FunctionalJavascript/PluginsTest.php @@ -244,6 +244,7 @@ protected function getLastUploadedFile() { $results = $entity_type_manager ->getStorage('file')->getQuery() + ->accessCheck(TRUE) ->range(0, 1) ->sort('fid', 'DESC') ->execute(); diff --git a/web/modules/entity_browser/tests/src/Kernel/Extension/EntityBrowserTest.php b/web/modules/entity_browser/tests/src/Kernel/Extension/EntityBrowserTest.php index a21bcef593..613b49b8ee 100644 --- a/web/modules/entity_browser/tests/src/Kernel/Extension/EntityBrowserTest.php +++ b/web/modules/entity_browser/tests/src/Kernel/Extension/EntityBrowserTest.php @@ -486,7 +486,7 @@ public function testViewWidgetAccess() { $role = $this->container->get('entity_type.manager') ->getStorage('user_role') ->create([ - 'name' => $this->randomString(), + 'label' => $this->randomString(), 'id' => $this->randomMachineName(), ]); $role->grantPermission('access content'); -- GitLab