From d0e0c299212eb3810979c151e4aef9a219a5eb8d Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Wed, 20 Dec 2023 14:13:10 -0400 Subject: [PATCH 01/15] Issue 1000 (#1001) * Change to Boolean logic * added forward slash to path * Made Viewer display configurable --------- Co-authored-by: Rosie Le Faive --- .../config/schema/islandora_iiif.schema.yml | 7 ++++-- .../src/Form/IslandoraIIIFConfigForm.php | 14 +++++++++++ .../src/Plugin/views/style/IIIFManifest.php | 24 ++++++++++++++++--- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml b/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml index f9e870ef..1f91450f 100644 --- a/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml +++ b/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml @@ -6,8 +6,11 @@ islandora_iiif.settings: type: string label: 'IIIF Server Url' use_relative_paths: - type: boolean - label: 'Use relative paths in manifest.' + type: boolean + label: 'Use relative paths in manifest.' + show_title: + type: string + label: 'Show title in view' views.style.iiif_manifest: type: views_style diff --git a/modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php b/modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php index a99539a3..41bd84a4 100644 --- a/modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php +++ b/modules/islandora_iiif/src/Form/IslandoraIIIFConfigForm.php @@ -66,6 +66,11 @@ class IslandoraIIIFConfigForm extends ConfigFormBase { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + $options = [ + 'none' => $this->t('None'), + 'view' => $this->t("From view title"), + 'node' => $this->t("From node title"), + ]; $config = $this->config('islandora_iiif.settings'); $form['iiif_server'] = [ '#type' => 'url', @@ -84,6 +89,14 @@ class IslandoraIIIFConfigForm extends ConfigFormBase { '#default_value' => $config->get('use_relative_paths'), ]; + $form['show_title'] = [ + '#type' => 'select', + '#options' => $options, + '#title' => $this->t("Show title in viewer."), + '#description' => $this->t("Show title on your viewer, if viewer allows"), + '#default_value' => $config->get('show_title'), + ]; + return parent::buildForm($form, $form_state); } @@ -111,6 +124,7 @@ class IslandoraIIIFConfigForm extends ConfigFormBase { $this->config('islandora_iiif.settings') ->set('iiif_server', $form_state->getValue('iiif_server')) ->set('use_relative_paths', $form_state->getValue('use_relative_paths')) + ->set('show_title', $form_state->getValue('show_title')) ->save(); } diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php index 4360e2c2..2fc8a431 100644 --- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php +++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php @@ -167,15 +167,33 @@ class IIIFManifest extends StylePluginBase { // @todo assumming the view is a path like /node/1/manifest.json $url_components = explode('/', trim($request_url, '/')); array_pop($url_components); - $content_path = implode('/', $url_components); - $iiif_base_id = $request_host . '/' . $content_path; + $content_path = '/' . implode('/', $url_components); + $iiif_base_id = "{$request_host}{$content_path}"; + $display = $this->iiifConfig->get('show_title'); + switch ($display) { + case 'none': + $label = ''; + break; + + case 'view': + $label = $this->view->getTitle(); + break; + + case 'node': + $label = $this->getEntityTitle($content_path); + + break; + + default: + $label = $this->t("IIIF Manifest"); + } // @see https://iiif.io/api/presentation/2.1/#manifest $json += [ '@type' => 'sc:Manifest', '@id' => $request_url, // If the View has a title, set the View title as the manifest label. - 'label' => $this->view->getTitle() ?: $this->getEntityTitle($content_path), + 'label' => $label, '@context' => 'http://iiif.io/api/presentation/2/context.json', // @see https://iiif.io/api/presentation/2.1/#sequence 'sequences' => [ From 3065c87874b7da0440fff494d0e51c938b855fd7 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 29 Dec 2023 12:47:29 -0500 Subject: [PATCH 02/15] Remove Feature-ness of Islandora Core Feature. (#968) * Remove Feature-ness of Islandora Core Feature. * Remove features bundle config. * Remove from composer.json. * Remove dependency on Features UI. * Rename install dir to optional. * Update text_extraction_defaults and remove 'fim' from workflows. --- .github/workflows/build-2.x.yml | 1 - composer.json | 1 - islandora.info.yml | 1 - .../install/features.bundle.islandora.yml | 100 ------------------ .../core.entity_view_mode.media.source.yml | 0 ...islandora_media_use.field_external_uri.yml | 0 ...rm.islandora_models.field_external_uri.yml | 0 .../field.storage.media.field_file_size.yml | 0 .../field.storage.media.field_height.yml | 0 ...d.storage.media.field_media_audio_file.yml | 0 ...eld.storage.media.field_media_document.yml | 0 .../field.storage.media.field_media_file.yml | 0 .../field.storage.media.field_media_image.yml | 0 .../field.storage.media.field_media_of.yml | 0 .../field.storage.media.field_media_use.yml | 0 ...d.storage.media.field_media_video_file.yml | 0 .../field.storage.media.field_mime_type.yml | 0 ...ield.storage.media.field_original_name.yml | 0 .../field.storage.media.field_width.yml | 0 .../field.storage.node.field_member_of.yml | 0 .../field.storage.node.field_model.yml | 0 .../field.storage.node.field_weight.yml | 0 ...orage.taxonomy_term.field_external_uri.yml | 0 .../filehash.settings.yml | 0 .../migrate_plus.migration.islandora_tags.yml | 0 ...migrate_plus.migration_group.islandora.yml | 0 .../rest.resource.entity.file.yml | 0 .../rest.resource.entity.media.yml | 0 .../rest.resource.entity.node.yml | 0 .../rest.resource.entity.taxonomy_term.yml | 0 ...delete_file_as_fedora_external_content.yml | 0 ...m.action.delete_media_from_triplestore.yml | 0 .../system.action.delete_node_from_fedora.yml | 0 ...em.action.delete_node_from_triplestore.yml | 0 ....action.delete_taxonomy_term_in_fedora.yml | 0 ...on.delete_taxonomy_term_in_triplestore.yml | 0 ....index_file_as_fedora_external_content.yml | 0 .../system.action.index_media_in_fedora.yml | 0 ...stem.action.index_media_in_triplestore.yml | 0 .../system.action.index_node_in_fedora.yml | 0 ...ystem.action.index_node_in_triplestore.yml | 0 ...m.action.index_taxonomy_term_in_fedora.yml | 0 ...index_taxonomy_term_in_the_triplestore.yml | 0 ...axonomy.vocabulary.islandora_media_use.yml | 0 .../taxonomy.vocabulary.islandora_models.yml | 0 .../views.view.all_taxonomy_terms.yml | 0 .../views.view.display_media.yml | 0 .../views.view.file_checksum.yml | 0 .../views.view.manage_members.yml | 0 .../views.view.media_of.yml | 0 .../views.view.non_fedora_files.yml | 0 .../views.view.reorder_children.yml | 0 .../islandora_core_feature.features.yml | 16 --- .../islandora_core_feature.info.yml | 1 - ...m_display.media.extracted_text.default.yml | 0 ...w_display.media.extracted_text.default.yml | 0 ...media.extracted_text.field_edited_text.yml | 0 ....media.extracted_text.field_media_file.yml | 0 ...ld.media.extracted_text.field_media_of.yml | 0 ...d.media.extracted_text.field_media_use.yml | 0 ...d.media.extracted_text.field_mime_type.yml | 0 .../field.storage.media.field_edited_text.yml | 0 ....content_settings.media.extracted_text.yml | 0 .../media.type.extracted_text.yml | 0 .../rdf.mapping.media.extracted_text.yml | 0 .../system.action.get_ocr_from_image.yml | 0 ...dora_text_extraction_defaults.features.yml | 2 - 67 files changed, 122 deletions(-) delete mode 100644 modules/islandora_core_feature/config/install/features.bundle.islandora.yml rename modules/islandora_core_feature/config/{install => optional}/core.entity_view_mode.media.source.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.field.taxonomy_term.islandora_models.field_external_uri.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_file_size.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_height.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_audio_file.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_document.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_file.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_image.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_of.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_use.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_media_video_file.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_mime_type.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_original_name.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.media.field_width.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.node.field_member_of.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.node.field_model.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.node.field_weight.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/field.storage.taxonomy_term.field_external_uri.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/filehash.settings.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/migrate_plus.migration.islandora_tags.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/migrate_plus.migration_group.islandora.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/rest.resource.entity.file.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/rest.resource.entity.media.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/rest.resource.entity.node.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/rest.resource.entity.taxonomy_term.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.delete_file_as_fedora_external_content.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.delete_media_from_triplestore.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.delete_node_from_fedora.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.delete_node_from_triplestore.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.delete_taxonomy_term_in_fedora.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.delete_taxonomy_term_in_triplestore.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_file_as_fedora_external_content.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_media_in_fedora.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_media_in_triplestore.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_node_in_fedora.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_node_in_triplestore.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_taxonomy_term_in_fedora.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/system.action.index_taxonomy_term_in_the_triplestore.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/taxonomy.vocabulary.islandora_media_use.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/taxonomy.vocabulary.islandora_models.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.all_taxonomy_terms.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.display_media.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.file_checksum.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.manage_members.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.media_of.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.non_fedora_files.yml (100%) rename modules/islandora_core_feature/config/{install => optional}/views.view.reorder_children.yml (100%) delete mode 100755 modules/islandora_core_feature/islandora_core_feature.features.yml rename modules/islandora_text_extraction_defaults/config/{install => optional}/core.entity_form_display.media.extracted_text.default.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/core.entity_view_display.media.extracted_text.default.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/field.field.media.extracted_text.field_edited_text.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/field.field.media.extracted_text.field_media_file.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/field.field.media.extracted_text.field_media_of.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/field.field.media.extracted_text.field_media_use.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/field.field.media.extracted_text.field_mime_type.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/field.storage.media.field_edited_text.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/language.content_settings.media.extracted_text.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/media.type.extracted_text.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/rdf.mapping.media.extracted_text.yml (100%) rename modules/islandora_text_extraction_defaults/config/{install => optional}/system.action.get_ocr_from_image.yml (100%) delete mode 100644 modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.features.yml diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 8e4e19be..2ab3a539 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -109,7 +109,6 @@ jobs: run: | cd $DRUPAL_DIR/web drush --uri=127.0.0.1:8282 en -y islandora_audio islandora_breadcrumbs islandora_iiif islandora_image islandora_video islandora_text_extraction_defaults - drush --uri=127.0.0.1:8282 fim -y islandora_core_feature,islandora_text_extraction_defaults - name: Copy PHPunit file run: cp $PHPUNIT_FILE $DRUPAL_DIR/web/core/phpunit.xml diff --git a/composer.json b/composer.json index 34107d37..cb95bbc6 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,6 @@ "drupal/context": "^4 || ^5@RC", "drupal/ctools": "^3.8 || ^4", "drupal/eva" : "^3.0", - "drupal/features" : "^3.13", "drupal/file_replace": "^1.1", "drupal/filehash": "^2", "drupal/flysystem" : "^2.0@alpha", diff --git a/islandora.info.yml b/islandora.info.yml index 34e8118a..6dd0597f 100644 --- a/islandora.info.yml +++ b/islandora.info.yml @@ -22,7 +22,6 @@ dependencies: - drupal:text - drupal:views_ui - eva:eva - - features:features_ui - file_replace:file_replace - filehash:filehash - flysystem:flysystem diff --git a/modules/islandora_core_feature/config/install/features.bundle.islandora.yml b/modules/islandora_core_feature/config/install/features.bundle.islandora.yml deleted file mode 100644 index 9c358731..00000000 --- a/modules/islandora_core_feature/config/install/features.bundle.islandora.yml +++ /dev/null @@ -1,100 +0,0 @@ -langcode: en -status: true -dependencies: - enforced: - module: - - islandora_core_feature -name: Islandora -machine_name: islandora -description: 'Features for islandora' -assignments: - alter: - core: true - uuid: true - user_permissions: true - enabled: true - weight: 0 - base: - types: - config: - comment_type: comment_type - node_type: node_type - content: - user: user - enabled: true - weight: -2 - core: - types: - config: - date_format: date_format - field_storage_config: field_storage_config - entity_form_mode: entity_form_mode - image_style: image_style - menu: menu - responsive_image_style: responsive_image_style - user_role: user_role - entity_view_mode: entity_view_mode - enabled: true - weight: 5 - dependency: - enabled: true - weight: 15 - exclude: - types: - config: - features_bundle: features_bundle - curated: true - module: - installed: true - profile: true - namespace: true - namespace_any: false - enabled: true - weight: -5 - existing: - enabled: true - weight: 12 - forward_dependency: - enabled: true - weight: 4 - namespace: - enabled: true - weight: 0 - optional: - types: - config: { } - enabled: true - weight: 0 - packages: - enabled: true - weight: -20 - profile: - curated: true - standard: - files: true - dependencies: true - types: - config: - block: block - language_content_settings: language_content_settings - configurable_language: configurable_language - migration: migration - shortcut_set: shortcut_set - tour: tour - enabled: true - weight: 10 - site: - types: - config: - action: action - contact_form: contact_form - block_content_type: block_content_type - rdf_mapping: rdf_mapping - search_page: search_page - taxonomy_vocabulary: taxonomy_vocabulary - editor: editor - filter_format: filter_format - enabled: true - weight: 7 -profile_name: '' -is_profile: false diff --git a/modules/islandora_core_feature/config/install/core.entity_view_mode.media.source.yml b/modules/islandora_core_feature/config/optional/core.entity_view_mode.media.source.yml similarity index 100% rename from modules/islandora_core_feature/config/install/core.entity_view_mode.media.source.yml rename to modules/islandora_core_feature/config/optional/core.entity_view_mode.media.source.yml diff --git a/modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml b/modules/islandora_core_feature/config/optional/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml rename to modules/islandora_core_feature/config/optional/field.field.taxonomy_term.islandora_media_use.field_external_uri.yml diff --git a/modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_models.field_external_uri.yml b/modules/islandora_core_feature/config/optional/field.field.taxonomy_term.islandora_models.field_external_uri.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.field.taxonomy_term.islandora_models.field_external_uri.yml rename to modules/islandora_core_feature/config/optional/field.field.taxonomy_term.islandora_models.field_external_uri.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_file_size.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_file_size.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_file_size.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_file_size.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_height.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_height.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_height.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_height.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_audio_file.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_audio_file.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_audio_file.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_audio_file.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_document.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_document.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_document.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_document.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_file.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_file.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_file.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_file.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_image.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_image.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_image.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_image.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_of.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_of.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_of.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_of.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_use.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_use.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_use.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_use.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_media_video_file.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_media_video_file.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_media_video_file.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_media_video_file.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_mime_type.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_mime_type.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_mime_type.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_mime_type.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_original_name.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_original_name.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_original_name.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_original_name.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.media.field_width.yml b/modules/islandora_core_feature/config/optional/field.storage.media.field_width.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.media.field_width.yml rename to modules/islandora_core_feature/config/optional/field.storage.media.field_width.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.node.field_member_of.yml b/modules/islandora_core_feature/config/optional/field.storage.node.field_member_of.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.node.field_member_of.yml rename to modules/islandora_core_feature/config/optional/field.storage.node.field_member_of.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.node.field_model.yml b/modules/islandora_core_feature/config/optional/field.storage.node.field_model.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.node.field_model.yml rename to modules/islandora_core_feature/config/optional/field.storage.node.field_model.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.node.field_weight.yml b/modules/islandora_core_feature/config/optional/field.storage.node.field_weight.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.node.field_weight.yml rename to modules/islandora_core_feature/config/optional/field.storage.node.field_weight.yml diff --git a/modules/islandora_core_feature/config/install/field.storage.taxonomy_term.field_external_uri.yml b/modules/islandora_core_feature/config/optional/field.storage.taxonomy_term.field_external_uri.yml similarity index 100% rename from modules/islandora_core_feature/config/install/field.storage.taxonomy_term.field_external_uri.yml rename to modules/islandora_core_feature/config/optional/field.storage.taxonomy_term.field_external_uri.yml diff --git a/modules/islandora_core_feature/config/install/filehash.settings.yml b/modules/islandora_core_feature/config/optional/filehash.settings.yml similarity index 100% rename from modules/islandora_core_feature/config/install/filehash.settings.yml rename to modules/islandora_core_feature/config/optional/filehash.settings.yml diff --git a/modules/islandora_core_feature/config/install/migrate_plus.migration.islandora_tags.yml b/modules/islandora_core_feature/config/optional/migrate_plus.migration.islandora_tags.yml similarity index 100% rename from modules/islandora_core_feature/config/install/migrate_plus.migration.islandora_tags.yml rename to modules/islandora_core_feature/config/optional/migrate_plus.migration.islandora_tags.yml diff --git a/modules/islandora_core_feature/config/install/migrate_plus.migration_group.islandora.yml b/modules/islandora_core_feature/config/optional/migrate_plus.migration_group.islandora.yml similarity index 100% rename from modules/islandora_core_feature/config/install/migrate_plus.migration_group.islandora.yml rename to modules/islandora_core_feature/config/optional/migrate_plus.migration_group.islandora.yml diff --git a/modules/islandora_core_feature/config/install/rest.resource.entity.file.yml b/modules/islandora_core_feature/config/optional/rest.resource.entity.file.yml similarity index 100% rename from modules/islandora_core_feature/config/install/rest.resource.entity.file.yml rename to modules/islandora_core_feature/config/optional/rest.resource.entity.file.yml diff --git a/modules/islandora_core_feature/config/install/rest.resource.entity.media.yml b/modules/islandora_core_feature/config/optional/rest.resource.entity.media.yml similarity index 100% rename from modules/islandora_core_feature/config/install/rest.resource.entity.media.yml rename to modules/islandora_core_feature/config/optional/rest.resource.entity.media.yml diff --git a/modules/islandora_core_feature/config/install/rest.resource.entity.node.yml b/modules/islandora_core_feature/config/optional/rest.resource.entity.node.yml similarity index 100% rename from modules/islandora_core_feature/config/install/rest.resource.entity.node.yml rename to modules/islandora_core_feature/config/optional/rest.resource.entity.node.yml diff --git a/modules/islandora_core_feature/config/install/rest.resource.entity.taxonomy_term.yml b/modules/islandora_core_feature/config/optional/rest.resource.entity.taxonomy_term.yml similarity index 100% rename from modules/islandora_core_feature/config/install/rest.resource.entity.taxonomy_term.yml rename to modules/islandora_core_feature/config/optional/rest.resource.entity.taxonomy_term.yml diff --git a/modules/islandora_core_feature/config/install/system.action.delete_file_as_fedora_external_content.yml b/modules/islandora_core_feature/config/optional/system.action.delete_file_as_fedora_external_content.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.delete_file_as_fedora_external_content.yml rename to modules/islandora_core_feature/config/optional/system.action.delete_file_as_fedora_external_content.yml diff --git a/modules/islandora_core_feature/config/install/system.action.delete_media_from_triplestore.yml b/modules/islandora_core_feature/config/optional/system.action.delete_media_from_triplestore.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.delete_media_from_triplestore.yml rename to modules/islandora_core_feature/config/optional/system.action.delete_media_from_triplestore.yml diff --git a/modules/islandora_core_feature/config/install/system.action.delete_node_from_fedora.yml b/modules/islandora_core_feature/config/optional/system.action.delete_node_from_fedora.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.delete_node_from_fedora.yml rename to modules/islandora_core_feature/config/optional/system.action.delete_node_from_fedora.yml diff --git a/modules/islandora_core_feature/config/install/system.action.delete_node_from_triplestore.yml b/modules/islandora_core_feature/config/optional/system.action.delete_node_from_triplestore.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.delete_node_from_triplestore.yml rename to modules/islandora_core_feature/config/optional/system.action.delete_node_from_triplestore.yml diff --git a/modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_fedora.yml b/modules/islandora_core_feature/config/optional/system.action.delete_taxonomy_term_in_fedora.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_fedora.yml rename to modules/islandora_core_feature/config/optional/system.action.delete_taxonomy_term_in_fedora.yml diff --git a/modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_triplestore.yml b/modules/islandora_core_feature/config/optional/system.action.delete_taxonomy_term_in_triplestore.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.delete_taxonomy_term_in_triplestore.yml rename to modules/islandora_core_feature/config/optional/system.action.delete_taxonomy_term_in_triplestore.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_file_as_fedora_external_content.yml b/modules/islandora_core_feature/config/optional/system.action.index_file_as_fedora_external_content.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_file_as_fedora_external_content.yml rename to modules/islandora_core_feature/config/optional/system.action.index_file_as_fedora_external_content.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_media_in_fedora.yml b/modules/islandora_core_feature/config/optional/system.action.index_media_in_fedora.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_media_in_fedora.yml rename to modules/islandora_core_feature/config/optional/system.action.index_media_in_fedora.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_media_in_triplestore.yml b/modules/islandora_core_feature/config/optional/system.action.index_media_in_triplestore.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_media_in_triplestore.yml rename to modules/islandora_core_feature/config/optional/system.action.index_media_in_triplestore.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_node_in_fedora.yml b/modules/islandora_core_feature/config/optional/system.action.index_node_in_fedora.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_node_in_fedora.yml rename to modules/islandora_core_feature/config/optional/system.action.index_node_in_fedora.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_node_in_triplestore.yml b/modules/islandora_core_feature/config/optional/system.action.index_node_in_triplestore.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_node_in_triplestore.yml rename to modules/islandora_core_feature/config/optional/system.action.index_node_in_triplestore.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_fedora.yml b/modules/islandora_core_feature/config/optional/system.action.index_taxonomy_term_in_fedora.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_fedora.yml rename to modules/islandora_core_feature/config/optional/system.action.index_taxonomy_term_in_fedora.yml diff --git a/modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_the_triplestore.yml b/modules/islandora_core_feature/config/optional/system.action.index_taxonomy_term_in_the_triplestore.yml similarity index 100% rename from modules/islandora_core_feature/config/install/system.action.index_taxonomy_term_in_the_triplestore.yml rename to modules/islandora_core_feature/config/optional/system.action.index_taxonomy_term_in_the_triplestore.yml diff --git a/modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_media_use.yml b/modules/islandora_core_feature/config/optional/taxonomy.vocabulary.islandora_media_use.yml similarity index 100% rename from modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_media_use.yml rename to modules/islandora_core_feature/config/optional/taxonomy.vocabulary.islandora_media_use.yml diff --git a/modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_models.yml b/modules/islandora_core_feature/config/optional/taxonomy.vocabulary.islandora_models.yml similarity index 100% rename from modules/islandora_core_feature/config/install/taxonomy.vocabulary.islandora_models.yml rename to modules/islandora_core_feature/config/optional/taxonomy.vocabulary.islandora_models.yml diff --git a/modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml b/modules/islandora_core_feature/config/optional/views.view.all_taxonomy_terms.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.all_taxonomy_terms.yml rename to modules/islandora_core_feature/config/optional/views.view.all_taxonomy_terms.yml diff --git a/modules/islandora_core_feature/config/install/views.view.display_media.yml b/modules/islandora_core_feature/config/optional/views.view.display_media.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.display_media.yml rename to modules/islandora_core_feature/config/optional/views.view.display_media.yml diff --git a/modules/islandora_core_feature/config/install/views.view.file_checksum.yml b/modules/islandora_core_feature/config/optional/views.view.file_checksum.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.file_checksum.yml rename to modules/islandora_core_feature/config/optional/views.view.file_checksum.yml diff --git a/modules/islandora_core_feature/config/install/views.view.manage_members.yml b/modules/islandora_core_feature/config/optional/views.view.manage_members.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.manage_members.yml rename to modules/islandora_core_feature/config/optional/views.view.manage_members.yml diff --git a/modules/islandora_core_feature/config/install/views.view.media_of.yml b/modules/islandora_core_feature/config/optional/views.view.media_of.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.media_of.yml rename to modules/islandora_core_feature/config/optional/views.view.media_of.yml diff --git a/modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml b/modules/islandora_core_feature/config/optional/views.view.non_fedora_files.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.non_fedora_files.yml rename to modules/islandora_core_feature/config/optional/views.view.non_fedora_files.yml diff --git a/modules/islandora_core_feature/config/install/views.view.reorder_children.yml b/modules/islandora_core_feature/config/optional/views.view.reorder_children.yml similarity index 100% rename from modules/islandora_core_feature/config/install/views.view.reorder_children.yml rename to modules/islandora_core_feature/config/optional/views.view.reorder_children.yml diff --git a/modules/islandora_core_feature/islandora_core_feature.features.yml b/modules/islandora_core_feature/islandora_core_feature.features.yml deleted file mode 100755 index 5af003a7..00000000 --- a/modules/islandora_core_feature/islandora_core_feature.features.yml +++ /dev/null @@ -1,16 +0,0 @@ -bundle: islandora -excluded: - - language.content_settings.taxonomy_term.islandora_media_use - - language.content_settings.taxonomy_term.islandora_models -required: - - features.bundle.islandora - - field.storage.media.field_file_size - - field.storage.media.field_height - - field.storage.media.field_media_of - - field.storage.media.field_media_use - - field.storage.media.field_mime_type - - field.storage.media.field_width - - field.storage.node.field_member_of - - field.storage.node.field_model - - field.storage.node.field_weight - - field.storage.taxonomy_term.field_external_uri diff --git a/modules/islandora_core_feature/islandora_core_feature.info.yml b/modules/islandora_core_feature/islandora_core_feature.info.yml index 6976eb8c..38992ea7 100755 --- a/modules/islandora_core_feature/islandora_core_feature.info.yml +++ b/modules/islandora_core_feature/islandora_core_feature.info.yml @@ -6,7 +6,6 @@ dependencies: - drupal:basic_auth - drupal:content_translation - drupal:eva - - drupal:features - drupal:field - drupal:file - drupal:filehash diff --git a/modules/islandora_text_extraction_defaults/config/install/core.entity_form_display.media.extracted_text.default.yml b/modules/islandora_text_extraction_defaults/config/optional/core.entity_form_display.media.extracted_text.default.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/core.entity_form_display.media.extracted_text.default.yml rename to modules/islandora_text_extraction_defaults/config/optional/core.entity_form_display.media.extracted_text.default.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/core.entity_view_display.media.extracted_text.default.yml b/modules/islandora_text_extraction_defaults/config/optional/core.entity_view_display.media.extracted_text.default.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/core.entity_view_display.media.extracted_text.default.yml rename to modules/islandora_text_extraction_defaults/config/optional/core.entity_view_display.media.extracted_text.default.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_edited_text.yml b/modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_edited_text.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_edited_text.yml rename to modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_edited_text.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_file.yml b/modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_file.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_file.yml rename to modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_file.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_of.yml b/modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_of.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_of.yml rename to modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_of.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_use.yml b/modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_use.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_media_use.yml rename to modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_media_use.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_mime_type.yml b/modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_mime_type.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/field.field.media.extracted_text.field_mime_type.yml rename to modules/islandora_text_extraction_defaults/config/optional/field.field.media.extracted_text.field_mime_type.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/field.storage.media.field_edited_text.yml b/modules/islandora_text_extraction_defaults/config/optional/field.storage.media.field_edited_text.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/field.storage.media.field_edited_text.yml rename to modules/islandora_text_extraction_defaults/config/optional/field.storage.media.field_edited_text.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/language.content_settings.media.extracted_text.yml b/modules/islandora_text_extraction_defaults/config/optional/language.content_settings.media.extracted_text.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/language.content_settings.media.extracted_text.yml rename to modules/islandora_text_extraction_defaults/config/optional/language.content_settings.media.extracted_text.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/media.type.extracted_text.yml b/modules/islandora_text_extraction_defaults/config/optional/media.type.extracted_text.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/media.type.extracted_text.yml rename to modules/islandora_text_extraction_defaults/config/optional/media.type.extracted_text.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/rdf.mapping.media.extracted_text.yml b/modules/islandora_text_extraction_defaults/config/optional/rdf.mapping.media.extracted_text.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/rdf.mapping.media.extracted_text.yml rename to modules/islandora_text_extraction_defaults/config/optional/rdf.mapping.media.extracted_text.yml diff --git a/modules/islandora_text_extraction_defaults/config/install/system.action.get_ocr_from_image.yml b/modules/islandora_text_extraction_defaults/config/optional/system.action.get_ocr_from_image.yml similarity index 100% rename from modules/islandora_text_extraction_defaults/config/install/system.action.get_ocr_from_image.yml rename to modules/islandora_text_extraction_defaults/config/optional/system.action.get_ocr_from_image.yml diff --git a/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.features.yml b/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.features.yml deleted file mode 100644 index 9e48e9fd..00000000 --- a/modules/islandora_text_extraction_defaults/islandora_text_extraction_defaults.features.yml +++ /dev/null @@ -1,2 +0,0 @@ -bundle: islandora -required: true From e30cdbf6812febe2b38e8d22020c2fc352f28638 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 09:44:50 -0400 Subject: [PATCH 03/15] Update testing drupal and php versions --- .github/workflows/build-2.x.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 2ab3a539..4750ba4d 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -23,10 +23,10 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ["8.1", "8.2"] + php-versions: ["8.1", "8.2", "8.3"] # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver. test-suite: ["kernel", "functional", "functional-javascript"] - drupal-version: ["10.0.x", "10.1.x", "10.2.x-dev"] + drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"] mysql: ["8.0"] allowed_failure: [false] From 3784def28765a08f6df616aa9fb91731000dccd5 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 11:03:10 -0400 Subject: [PATCH 04/15] Tests use strings not translateable markup to select interface buttons. --- .../src/Functional/GenerateAudioDerivativeTest.php | 6 +++--- .../src/Functional/GenerateImageDerivativeTest.php | 6 +++--- .../src/Functional/GenerateVideoDerivativeTest.php | 6 +++--- tests/src/Functional/ContentEntityTypeTest.php | 2 +- tests/src/Functional/DerivativeReactionTest.php | 2 +- tests/src/Functional/EmitNodeEventTest.php | 2 +- tests/src/Functional/EntityBundleTest.php | 2 +- .../src/Functional/FormDisplayAlterReactionTest.php | 2 +- tests/src/Functional/IndexingTest.php | 2 +- tests/src/Functional/IslandoraSettingsFormTest.php | 10 +++++----- .../Functional/JsonldSelfReferenceReactionTest.php | 2 +- tests/src/Functional/JsonldTypeAlterReactionTest.php | 12 ++++++------ 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php index 6b85cd1b..094a7856 100644 --- a/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php +++ b/modules/islandora_audio/tests/src/Functional/GenerateAudioDerivativeTest.php @@ -40,7 +40,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase { // Create an action to generate a audio derivative. $this->drupalGet('admin/config/system/actions'); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a audio derivative"); - $this->getSession()->getPage()->pressButton($this->t('Create')); + $this->getSession()->getPage()->pressButton('Create'); $this->assertSession()->statusCodeEquals(200); $this->getSession()->getPage()->fillField('edit-label', "Generate audio test derivative"); @@ -53,7 +53,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase { $this->getSession()->getPage()->fillField('edit-args', "-f mp3"); $this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov"); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); // Create a context and add the action as a derivative reaction. @@ -69,7 +69,7 @@ class GenerateAudioDerivativeTest extends GenerateDerivativeTestBase { 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $expected = [ 'source_uri' => 'test_file.txt', diff --git a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php index 44cdda58..17c1beae 100644 --- a/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php +++ b/modules/islandora_image/tests/src/Functional/GenerateImageDerivativeTest.php @@ -42,7 +42,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase { // Create an action to generate a jpeg thumbnail. $this->drupalGet('admin/config/system/actions'); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate an image derivative"); - $this->getSession()->getPage()->pressButton($this->t('Create')); + $this->getSession()->getPage()->pressButton('Create'); $this->assertSession()->statusCodeEquals(200); $this->getSession()->getPage()->fillField('edit-label', "Generate image test derivative"); @@ -55,7 +55,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase { $this->getSession()->getPage()->fillField('edit-args', "-thumbnail 20x20"); $this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-path', "derp.jpeg"); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); // Create a context and add the action as a derivative reaction. @@ -71,7 +71,7 @@ class GenerateImageDerivativeTest extends GenerateDerivativeTestBase { 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $expected = [ 'source_uri' => 'test_file.txt', diff --git a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php index de06ba2f..2f79e18e 100644 --- a/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php +++ b/modules/islandora_video/tests/src/Functional/GenerateVideoDerivativeTest.php @@ -37,7 +37,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase { // Create an action to generate a jpeg thumbnail. $this->drupalGet('admin/config/system/actions'); $this->getSession()->getPage()->findById("edit-action")->selectOption("Generate a video derivative"); - $this->getSession()->getPage()->pressButton($this->t('Create')); + $this->getSession()->getPage()->pressButton('Create'); $this->assertSession()->statusCodeEquals(200); $this->getSession()->getPage()->fillField('edit-label', "Generate video test derivative"); @@ -50,7 +50,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase { $this->getSession()->getPage()->fillField('edit-args', "-f mp4"); $this->getSession()->getPage()->fillField('edit-scheme', "public"); $this->getSession()->getPage()->fillField('edit-path', "derp.mov"); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); // Create a context and add the action as a derivative reaction. @@ -66,7 +66,7 @@ class GenerateVideoDerivativeTest extends GenerateDerivativeTestBase { 'field_media_use[0][target_id]' => $this->preservationMasterTerm->label(), ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $expected = [ 'source_uri' => 'test_file.txt', diff --git a/tests/src/Functional/ContentEntityTypeTest.php b/tests/src/Functional/ContentEntityTypeTest.php index 5ed22948..b753852a 100644 --- a/tests/src/Functional/ContentEntityTypeTest.php +++ b/tests/src/Functional/ContentEntityTypeTest.php @@ -39,7 +39,7 @@ class ContentEntityTypeTest extends IslandoraFunctionalTestBase { $this->addCondition('test', 'content_entity_type'); $this->getSession()->getPage()->checkField("edit-conditions-content-entity-type-types-node"); $this->getSession()->getPage()->findById("edit-conditions-content-entity-type-context-mapping-node")->selectOption("@node.node_route_context:node"); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->addPresetReaction('test', 'index', 'hello_world'); // Create a new node confirm Hello World! is printed to the screen. diff --git a/tests/src/Functional/DerivativeReactionTest.php b/tests/src/Functional/DerivativeReactionTest.php index 00e0e5ae..7c0cedb3 100644 --- a/tests/src/Functional/DerivativeReactionTest.php +++ b/tests/src/Functional/DerivativeReactionTest.php @@ -53,7 +53,7 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase { 'field_media_of[0][target_id]' => 'Test Node', ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); // field_media_of is set and there's a file, so derivatives should fire. $this->assertSession()->pageTextContains("Hello World!"); diff --git a/tests/src/Functional/EmitNodeEventTest.php b/tests/src/Functional/EmitNodeEventTest.php index 83f062ae..3ebcc6dd 100644 --- a/tests/src/Functional/EmitNodeEventTest.php +++ b/tests/src/Functional/EmitNodeEventTest.php @@ -44,7 +44,7 @@ class EmitNodeEventTest extends IslandoraFunctionalTestBase { $this->addCondition('test', 'content_entity_type'); $this->getSession()->getPage()->checkField("edit-conditions-content-entity-type-types-node"); $this->getSession()->getPage()->findById("edit-conditions-content-entity-type-context-mapping-node")->selectOption("@node.node_route_context:node"); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->addPresetReaction('test', 'index', $action_id); $this->assertSession()->statusCodeEquals(200); diff --git a/tests/src/Functional/EntityBundleTest.php b/tests/src/Functional/EntityBundleTest.php index bde1ee40..27183826 100644 --- a/tests/src/Functional/EntityBundleTest.php +++ b/tests/src/Functional/EntityBundleTest.php @@ -27,7 +27,7 @@ class EntityBundleTest extends IslandoraFunctionalTestBase { $this->addCondition('test', 'islandora_entity_bundle'); $this->getSession()->getPage()->checkField("edit-conditions-islandora-entity-bundle-bundles-test-type"); $this->getSession()->getPage()->findById("edit-conditions-islandora-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node"); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->addPresetReaction('test', 'index', 'hello_world'); // Create a new test_type confirm Hello World! is printed to the screen. diff --git a/tests/src/Functional/FormDisplayAlterReactionTest.php b/tests/src/Functional/FormDisplayAlterReactionTest.php index d394b728..fe70aa64 100644 --- a/tests/src/Functional/FormDisplayAlterReactionTest.php +++ b/tests/src/Functional/FormDisplayAlterReactionTest.php @@ -49,7 +49,7 @@ class FormDisplayAlterReactionTest extends IslandoraFunctionalTestBase { $this->drupalGet("admin/structure/context/test/reaction/add/form_display_alter"); $this->getSession()->getPage()->findById("edit-reactions-form-display-alter-mode")->selectOption('node.secondary'); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->assertSession()->statusCodeEquals(200); drupal_flush_all_caches(); diff --git a/tests/src/Functional/IndexingTest.php b/tests/src/Functional/IndexingTest.php index ff215281..cf2dbb66 100644 --- a/tests/src/Functional/IndexingTest.php +++ b/tests/src/Functional/IndexingTest.php @@ -66,7 +66,7 @@ class IndexingTest extends IslandoraFunctionalTestBase { $this->drupalGet("$url/delete"); // Delete the node. - $this->submitForm([], $this->t('Delete')); + $this->submitForm([], 'Delete'); $this->assertSession()->statusCodeEquals(200); // Confirm Goodbye, Cruel World! is printed to the screen. diff --git a/tests/src/Functional/IslandoraSettingsFormTest.php b/tests/src/Functional/IslandoraSettingsFormTest.php index 80a327af..18bfcafb 100644 --- a/tests/src/Functional/IslandoraSettingsFormTest.php +++ b/tests/src/Functional/IslandoraSettingsFormTest.php @@ -38,23 +38,23 @@ class IslandoraSettingsFormTest extends IslandoraFunctionalTestBase { $this->assertSession()->fieldValueEquals('edit-jwt-expiry', '+2 hour'); $this->drupalGet('/admin/config/islandora/core'); // Blank is not allowed. - $this->submitForm(['edit-jwt-expiry' => ""], $this->t('Save configuration')); + $this->submitForm(['edit-jwt-expiry' => ""], 'Save configuration'); $this->assertSession()->pageTextContainsOnce('"" is not a valid time or interval expression.'); $this->drupalGet('/admin/config/islandora/core'); // Negative is not allowed. - $this->submitForm(['edit-jwt-expiry' => "-2 hours"], $this->t('Save configuration')); + $this->submitForm(['edit-jwt-expiry' => "-2 hours"], 'Save configuration'); $this->assertSession()->pageTextContainsOnce('Time or interval expression cannot be negative'); $this->drupalGet('/admin/config/islandora/core'); // Must include an integer value. - $this->submitForm(['edit-jwt-expiry' => "last hour"], $this->t('Save configuration')); + $this->submitForm(['edit-jwt-expiry' => "last hour"], 'Save configuration'); $this->assertSession()->pageTextContainsOnce('No numeric interval specified, for example "1 day"'); $this->drupalGet('/admin/config/islandora/core'); // Must have an accepted interval. - $this->submitForm(['edit-jwt-expiry' => "1 fortnight"], $this->t('Save configuration')); + $this->submitForm(['edit-jwt-expiry' => "1 fortnight"], 'Save configuration'); $this->assertSession()->pageTextContainsOnce('No time interval found, please include one of'); $this->drupalGet('/admin/config/islandora/core'); // Test a valid setting. - $this->submitForm(['edit-jwt-expiry' => "2 weeks"], $this->t('Save configuration')); + $this->submitForm(['edit-jwt-expiry' => "2 weeks"], 'Save configuration'); $this->assertSession()->pageTextContainsOnce('The configuration options have been saved.'); } diff --git a/tests/src/Functional/JsonldSelfReferenceReactionTest.php b/tests/src/Functional/JsonldSelfReferenceReactionTest.php index 1b4e24ec..c8acfcc9 100644 --- a/tests/src/Functional/JsonldSelfReferenceReactionTest.php +++ b/tests/src/Functional/JsonldSelfReferenceReactionTest.php @@ -60,7 +60,7 @@ class JsonldSelfReferenceReactionTest extends IslandoraFunctionalTestBase { $this->postNodeAddForm('test_type', ['title[0][value]' => 'Test Node'], - $this->t('Save')); + 'Save'); $this->assertSession()->pageTextContains("Test Node"); $url = $this->getUrl(); diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index 75ae41dd..5ab9037c 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -32,7 +32,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', ], 'Save and continue'); - $this->submitForm([], $this->t('Save field settings')); + $this->submitForm([], 'Save field settings'); } else { $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); @@ -46,7 +46,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { 'new_storage_type' => 'plain_text', 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', - ], $this->t('Continue')); + ], 'Continue'); // Now we can proceed, selecting the plain text (i.e. string) // for the second element now that the element is displayed after @@ -57,16 +57,16 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', 'group_field_options_wrapper' => 'string', - ], $this->t('Continue')); + ], 'Continue'); } - $this->submitForm([], $this->t('Save settings')); + $this->submitForm([], 'Save settings'); $this->assertSession()->responseContains('field_type_predicate'); // Add the test node. $this->postNodeAddForm('test_type', [ 'title[0][value]' => 'Test Node', 'field_type_predicate[0][value]' => 'schema:Organization', - ], $this->t('Save')); + ], 'Save'); $this->assertSession()->pageTextContains("Test Node"); $url = $this->getUrl(); @@ -103,7 +103,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { $this->addCondition('test', 'islandora_entity_bundle'); $this->getSession()->getPage()->checkField("edit-conditions-islandora-entity-bundle-bundles-test-type"); $this->getSession()->getPage()->findById("edit-conditions-islandora-entity-bundle-context-mapping-node")->selectOption("@node.node_route_context:node"); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); // The first time a Context is saved, you need to clear the cache. // Subsequent changes to the context don't need a cache rebuild, though. From 89261c17aefa7c2b6110de57c4f0814e0c572cfc Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 11:06:22 -0400 Subject: [PATCH 05/15] Add some forgotten translateable markup. --- tests/src/Functional/ContentEntityTypeTest.php | 2 +- tests/src/Functional/DerivativeReactionTest.php | 4 ++-- tests/src/Functional/EmitNodeEventTest.php | 4 ++-- tests/src/Functional/IslandoraFunctionalTestBase.php | 2 +- tests/src/Functional/ViewModeAlterReactionTest.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/src/Functional/ContentEntityTypeTest.php b/tests/src/Functional/ContentEntityTypeTest.php index b753852a..2fa9b574 100644 --- a/tests/src/Functional/ContentEntityTypeTest.php +++ b/tests/src/Functional/ContentEntityTypeTest.php @@ -53,7 +53,7 @@ class ContentEntityTypeTest extends IslandoraFunctionalTestBase { 'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file.txt', ]; $this->drupalGet('media/add/' . $this->testMediaType->id()); - $this->submitForm($values, $this->t('Save')); + $this->submitForm($values, 'Save'); $this->assertSession()->pageTextNotContains("Hello World!"); } diff --git a/tests/src/Functional/DerivativeReactionTest.php b/tests/src/Functional/DerivativeReactionTest.php index 7c0cedb3..720b8a45 100644 --- a/tests/src/Functional/DerivativeReactionTest.php +++ b/tests/src/Functional/DerivativeReactionTest.php @@ -71,9 +71,9 @@ class DerivativeReactionTest extends IslandoraFunctionalTestBase { 'files[field_media_file_0]' => __DIR__ . '/../../fixtures/test_file2.txt', ]; $this->drupalGet($media_url . '/edit'); - $this->getSession()->getPage()->pressButton($this->t('Remove')); + $this->getSession()->getPage()->pressButton('Remove'); $this->getSession()->getPage()->fillField('files[field_media_file_0]', __DIR__ . '/../../fixtures/test_file2.txt'); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->pageTextContains("Hello World!"); } diff --git a/tests/src/Functional/EmitNodeEventTest.php b/tests/src/Functional/EmitNodeEventTest.php index 3ebcc6dd..a18ffbc8 100644 --- a/tests/src/Functional/EmitNodeEventTest.php +++ b/tests/src/Functional/EmitNodeEventTest.php @@ -68,7 +68,7 @@ class EmitNodeEventTest extends IslandoraFunctionalTestBase { protected function createEmitAction($entity_type, $event_type) { $this->drupalGet('admin/config/system/actions'); $this->getSession()->getPage()->findById("edit-action")->selectOption("Emit a $entity_type event to a queue/topic"); - $this->getSession()->getPage()->pressButton($this->t('Create')); + $this->getSession()->getPage()->pressButton('Create'); $this->assertSession()->statusCodeEquals(200); $action_id = "emit_" . $entity_type . "_" . lcfirst($event_type); @@ -76,7 +76,7 @@ class EmitNodeEventTest extends IslandoraFunctionalTestBase { $this->getSession()->getPage()->fillField('edit-id', $action_id); $this->getSession()->getPage()->fillField('edit-queue', "emit-$entity_type-" . lcfirst($event_type)); $this->getSession()->getPage()->findById("edit-event")->selectOption($event_type); - $this->getSession()->getPage()->pressButton($this->t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->statusCodeEquals(200); return $action_id; diff --git a/tests/src/Functional/IslandoraFunctionalTestBase.php b/tests/src/Functional/IslandoraFunctionalTestBase.php index 016788d0..b4c0bc95 100644 --- a/tests/src/Functional/IslandoraFunctionalTestBase.php +++ b/tests/src/Functional/IslandoraFunctionalTestBase.php @@ -306,7 +306,7 @@ EOD; ->getPage() ->findById("edit-reactions-$reaction_type-actions") ->selectOption($action_id); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->assertSession()->statusCodeEquals(200); } diff --git a/tests/src/Functional/ViewModeAlterReactionTest.php b/tests/src/Functional/ViewModeAlterReactionTest.php index 19660bda..90441402 100644 --- a/tests/src/Functional/ViewModeAlterReactionTest.php +++ b/tests/src/Functional/ViewModeAlterReactionTest.php @@ -75,7 +75,7 @@ class ViewModeAlterReactionTest extends IslandoraFunctionalTestBase { $this->drupalGet("admin/structure/context/test/reaction/add/view_mode_alter"); $this->getSession()->getPage()->findById("edit-reactions-view-mode-alter-mode")->selectOption('node.teaser'); - $this->getSession()->getPage()->pressButton($this->t('Save and continue')); + $this->getSession()->getPage()->pressButton('Save and continue'); $this->assertSession()->statusCodeEquals(200); drupal_flush_all_caches(); From 9f2277fc51c5e29bea3730e2bef3a0432f20b800 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 11:22:03 -0400 Subject: [PATCH 06/15] Exclude PHP 8.3 with Drupal 10.1. --- .github/workflows/build-2.x.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 4750ba4d..c5d9d66b 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -29,6 +29,9 @@ jobs: drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"] mysql: ["8.0"] allowed_failure: [false] + exclude: + - php-versions: "8.3" + drupal-version: "10.1.x" name: PHP ${{ matrix.php-versions }} | drupal ${{ matrix.drupal-version }} | mysql ${{ matrix.mysql }} | test-suite ${{ matrix.test-suite }} From 13bc15ea43659824f2397a43914efe462a8dd546 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Fri, 8 Mar 2024 16:50:50 -0400 Subject: [PATCH 07/15] Last attempt to not pass translatables as button labels. --- tests/src/Functional/IslandoraFunctionalTestBase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/src/Functional/IslandoraFunctionalTestBase.php b/tests/src/Functional/IslandoraFunctionalTestBase.php index b4c0bc95..1ad8081d 100644 --- a/tests/src/Functional/IslandoraFunctionalTestBase.php +++ b/tests/src/Functional/IslandoraFunctionalTestBase.php @@ -315,7 +315,7 @@ EOD; */ protected function postNodeAddForm($bundle_id, $values, $button_text) { $this->drupalGet("node/add/$bundle_id"); - $this->submitForm($values, $this->t('@text', ['@text' => $button_text])); + $this->submitForm($values, $button_text); $this->assertSession()->statusCodeEquals(200); } @@ -324,7 +324,7 @@ EOD; */ protected function postTermAddForm($taxomony_id, $values, $button_text) { $this->drupalGet("admin/structure/taxonomy/manage/$taxomony_id/add"); - $this->submitForm($values, $this->t('@text', ['@text' => $button_text])); + $this->submitForm($values, $button_text); $this->assertSession()->statusCodeEquals(200); } @@ -333,7 +333,7 @@ EOD; */ protected function postEntityEditForm($entity_url, $values, $button_text) { $this->drupalGet("$entity_url/edit"); - $this->submitForm($values, $this->t('@text', ['@text' => $button_text])); + $this->submitForm($values, $button_text); $this->assertSession()->statusCodeEquals(200); } From 9ed3637339d4aaf1723f775cc9d009d12a3c2e2d Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Wed, 3 Apr 2024 14:16:19 -0300 Subject: [PATCH 08/15] Update islandora.module (#1008) --- islandora.module | 1 + 1 file changed, 1 insertion(+) diff --git a/islandora.module b/islandora.module index d3dfa01d..d715db52 100644 --- a/islandora.module +++ b/islandora.module @@ -615,6 +615,7 @@ function islandora_form_block_form_alter(&$form, FormStateInterface $form_state, unset($form['visibility']['media_is_islandora_media']); unset($form['visibility']['media_uses_filesystem']); unset($form['visibility']['node_had_namespace']); + unset($form['visibility']['node_has_ancestor']); unset($form['visibility']['node_has_parent']); unset($form['visibility']['node_has_term']); unset($form['visibility']['node_is_islandora_object']); From a2c31fcaad87d753ca6725fef47fde39579c3342 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Wed, 3 Apr 2024 14:47:01 -0300 Subject: [PATCH 09/15] @adam-vessey's fix for drupalGet headers. --- tests/src/Functional/LinkHeaderTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/Functional/LinkHeaderTest.php b/tests/src/Functional/LinkHeaderTest.php index 98b36c68..78dd6c99 100644 --- a/tests/src/Functional/LinkHeaderTest.php +++ b/tests/src/Functional/LinkHeaderTest.php @@ -142,7 +142,7 @@ class LinkHeaderTest extends IslandoraFunctionalTestBase { $media_url = $this->media->toUrl('canonical', ['absolute' => TRUE])->toString(); // Perform a GET request as anonymous. - $this->drupalGet($media_url, [], ['Cache-Control: no-cache']); + $this->drupalGet($media_url, [], ['Cache-Control' => 'no-cache']); // Check link headers. $this->assertTrue( $this->validateLinkHeaderWithUrl('describes', $file_url, '', 'text/plain') == 1, @@ -174,7 +174,7 @@ class LinkHeaderTest extends IslandoraFunctionalTestBase { $this->drupalLogin($account); // Perform a GET request with update media permissions. - $this->drupalGet($media_url, [], ['Cache-Control: no-cache']); + $this->drupalGet($media_url, [], ['Cache-Control' => 'no-cache']); // Check link headers again, the edit-media link header should be present. $this->assertTrue( From cde2c133e1b06f90f5f9cce949e32d4ab0bffb2a Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 4 Apr 2024 09:56:45 -0300 Subject: [PATCH 10/15] Update tests for D10.3's new field selector form. --- .../JsonldTypeAlterReactionTest.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index 5ab9037c..90036048 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -34,11 +34,11 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { ], 'Save and continue'); $this->submitForm([], 'Save field settings'); } - else { + elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt'){ $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); - // First need to submit the form with the elements displayed - // on initial page load. The form is using AJAX to send a second element - // after we selected the radio button above + // For Drupal 10.2, we first need to submit the form with the elements + // displayed on initial page load. The form is using AJAX to send a + // second element after we selected the radio button above // we can instead get the second element by submitting the form // and having it throw an error since the required field is missing. // @todo refactor this as a functional javascript test. @@ -59,6 +59,25 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { 'group_field_options_wrapper' => 'string', ], 'Continue'); } + else { + $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); + // For Drupal 10.3 the label is not visible at first. + // @todo refactor this as a functional javascript test. + $this->submitForm([ + 'new_storage_type' => 'plain_text', + ], 'Continue'); + + // Now we can proceed, entering a label and selecting Text (plain) + // for the second element now that the elements are displayed after + // the initial form submission. + $this->getSession()->getPage()->selectFieldOption('group_field_options_wrapper', 'string'); + $this->submitForm([ + 'new_storage_type' => 'plain_text', + 'label' => 'Typed Predicate', + 'field_name' => 'type_predicate', + 'group_field_options_wrapper' => 'string', + ], 'Continue'); + } $this->submitForm([], 'Save settings'); $this->assertSession()->responseContains('field_type_predicate'); From 95c2d6c0c9970f48f44b579d19f76a3f87ed8767 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 4 Apr 2024 10:04:05 -0300 Subject: [PATCH 11/15] Syntax. --- tests/src/Functional/JsonldTypeAlterReactionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index 90036048..edefd77a 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -34,7 +34,7 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { ], 'Save and continue'); $this->submitForm([], 'Save field settings'); } - elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt'){ + elseif (version_compare(\Drupal::VERSION, '10.3.x-dev', 'lt')) { $this->getSession()->getPage()->selectFieldOption('new_storage_type', 'plain_text'); // For Drupal 10.2, we first need to submit the form with the elements // displayed on initial page load. The form is using AJAX to send a From 263666f5fcf305e0fe8ee86fda03959e4db4bde7 Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 4 Apr 2024 14:51:20 -0300 Subject: [PATCH 12/15] Remove new_storage_type from form part 2. --- tests/src/Functional/JsonldTypeAlterReactionTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/src/Functional/JsonldTypeAlterReactionTest.php b/tests/src/Functional/JsonldTypeAlterReactionTest.php index edefd77a..6ac70d7d 100644 --- a/tests/src/Functional/JsonldTypeAlterReactionTest.php +++ b/tests/src/Functional/JsonldTypeAlterReactionTest.php @@ -72,7 +72,6 @@ class JsonldTypeAlterReactionTest extends JsonldSelfReferenceReactionTest { // the initial form submission. $this->getSession()->getPage()->selectFieldOption('group_field_options_wrapper', 'string'); $this->submitForm([ - 'new_storage_type' => 'plain_text', 'label' => 'Typed Predicate', 'field_name' => 'type_predicate', 'group_field_options_wrapper' => 'string', From 9b2661696db027867061f237639167ed3684c6b5 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Fri, 19 Apr 2024 11:13:21 -0400 Subject: [PATCH 13/15] Add hOCR functionality (#1006) * Add hOCR functionality * Fix wording in Islandora IIIF View Style config form. * Islandora IIIF: Attempt to fix broken config schema. * Islandora IIIF: Remove labels from config schema. * Islandora IIIF: Add labels to config schema items. * Update IIIFManifest.php * Move to memorized term lookup, instead of polluting method call. * Deal explicitly with URIs, instead of attempting to put the entity in config. * hocr Islandora IIIF: Add missing null check. --------- Co-authored-by: Alexander O'Neill Co-authored-by: Alexander O'Neill Co-authored-by: Rosie Le Faive Co-authored-by: Adam Vessey --- .../config/schema/islandora_iiif.schema.yml | 12 ++ .../src/Plugin/views/style/IIIFManifest.php | 135 ++++++++++++++++-- 2 files changed, 136 insertions(+), 11 deletions(-) diff --git a/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml b/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml index 1f91450f..11fff4c7 100644 --- a/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml +++ b/modules/islandora_iiif/config/schema/islandora_iiif.schema.yml @@ -17,5 +17,17 @@ views.style.iiif_manifest: mapping: iiif_tile_field: type: sequence + label: "Tile source field(s)" sequence: type: string + iiif_ocr_file_field: + type: sequence + label: "Structured OCR data file field" + sequence: + type: string + structured_text_term_uri: + type: string + label: "Structured text term" + search_endpoint: + type: string + label: "Search endpoint path" diff --git a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php index 2fc8a431..f0aca47d 100644 --- a/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php +++ b/modules/islandora_iiif/src/Plugin/views/style/IIIFManifest.php @@ -11,6 +11,8 @@ use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Url; +use Drupal\islandora\IslandoraUtils; +use Drupal\taxonomy\TermInterface; use Drupal\views\Plugin\views\style\StylePluginBase; use Drupal\views\ResultRow; use GuzzleHttp\Client; @@ -35,6 +37,13 @@ use Symfony\Component\HttpFoundation\Request; */ class IIIFManifest extends StylePluginBase { + /** + * Islandora utility functions. + * + * @var \Drupal\islandora\IslandoraUtils + */ + protected $utils; + /** * {@inheritdoc} */ @@ -108,10 +117,24 @@ class IIIFManifest extends StylePluginBase { */ protected $moduleHandler; + /** + * Memoized structured text term. + * + * @var \Drupal\taxonomy\TermInterface|null + */ + protected ?TermInterface $structuredTextTerm; + + /** + * Flag to track if we _have_ attempted a lookup, as the value is nullable. + * + * @var bool + */ + protected bool $structuredTextTermMemoized = FALSE; + /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, ModuleHandlerInterface $moduleHandler) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, SerializerInterface $serializer, Request $request, ImmutableConfig $iiif_config, EntityTypeManagerInterface $entity_type_manager, FileSystemInterface $file_system, Client $http_client, MessengerInterface $messenger, ModuleHandlerInterface $moduleHandler, IslandoraUtils $utils) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->serializer = $serializer; @@ -121,6 +144,7 @@ class IIIFManifest extends StylePluginBase { $this->fileSystem = $file_system; $this->httpClient = $http_client; $this->messenger = $messenger; + $this->utils = $utils; $this->moduleHandler = $moduleHandler; } @@ -139,7 +163,8 @@ class IIIFManifest extends StylePluginBase { $container->get('file_system'), $container->get('http_client'), $container->get('messenger'), - $container->get('module_handler') + $container->get('module_handler'), + $container->get('islandora.utils') ); } @@ -217,6 +242,9 @@ class IIIFManifest extends StylePluginBase { $content_type = 'json'; + // Add a search endpoint if one is defined. + $this->addSearchEndpoint($json, $url_components); + // Give other modules a chance to alter the manifest. $this->moduleHandler->alter('islandora_iiif_manifest', $json, $this); @@ -300,7 +328,7 @@ class IIIFManifest extends StylePluginBase { ], ]; - if ($ocr_url = $this->getOcrUrl($entity, $row, $i)) { + if ($ocr_url = $this->getOcrUrl($entity)) { $tmp_canvas['seeAlso'] = [ '@id' => $ocr_url, 'format' => 'text/vnd.hocr+html', @@ -380,30 +408,38 @@ class IIIFManifest extends StylePluginBase { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity at the current row. - * @param \Drupal\views\ResultRow $row - * Result row. - * @param int $delta - * The delta in case there are multiple canvases on one media. * * @return string|false * The absolute URL of the current row's structured text, * or FALSE if none. */ - protected function getOcrUrl(EntityInterface $entity, ResultRow $row, $delta) { + protected function getOcrUrl(EntityInterface $entity) { $ocr_url = FALSE; $iiif_ocr_file_field = !empty($this->options['iiif_ocr_file_field']) ? array_filter(array_values($this->options['iiif_ocr_file_field'])) : []; $ocrField = count($iiif_ocr_file_field) > 0 ? $this->view->field[$iiif_ocr_file_field[0]] : NULL; if ($ocrField) { - $ocr_entity = $ocrField->getEntity($row); + $ocr_entity = $entity; $ocr_field_name = $ocrField->definition['field_name']; if (!is_null($ocr_field_name)) { $ocrs = $ocr_entity->{$ocr_field_name}; - $ocr = isset($ocrs[$delta]) ? $ocrs[$delta] : FALSE; + $ocr = $ocrs[0] ?? FALSE; if ($ocr) { $ocr_url = $ocr->entity->createFileUrl(FALSE); } } } + elseif ($structured_text_term = $this->getStructuredTextTerm()) { + $parent_node = $this->utils->getParentNode($entity); + $ocr_entity_array = $this->utils->getMediaReferencingNodeAndTerm($parent_node, $structured_text_term); + $ocr_entity_id = is_array($ocr_entity_array) ? array_shift($ocr_entity_array) : NULL; + $ocr_entity = $ocr_entity_id ? $this->entityTypeManager->getStorage('media')->load($ocr_entity_id) : NULL; + if ($ocr_entity) { + $ocr_file_source = $ocr_entity->getSource(); + $ocr_fid = $ocr_file_source->getSourceFieldValue($ocr_entity); + $ocr_file = $this->entityTypeManager->getStorage('file')->load($ocr_fid); + $ocr_url = $ocr_file->createFileUrl(FALSE); + } + } return $ocr_url; } @@ -448,6 +484,29 @@ class IIIFManifest extends StylePluginBase { return $options; } + /** + * Add the configured search endpoint to the manifest. + * + * @param array $json + * The IIIF manifest. + * @param array $url_components + * The search endpoint URL as array. + */ + protected function addSearchEndpoint(array &$json, array $url_components) { + $url_base = $this->getRequest()->getSchemeAndHttpHost(); + $hocr_search_path = $this->options['search_endpoint']; + $hocr_search_url = $url_base . '/' . ltrim($hocr_search_path, '/'); + + $hocr_search_url = str_replace('%node', $url_components[1], $hocr_search_url); + + $json['service'][] = [ + "@context" => "http://iiif.io/api/search/0/context.json", + "@id" => $hocr_search_url, + "profile" => "http://iiif.io/api/search/0/search", + "label" => t("Search inside this work"), + ]; + } + /** * {@inheritdoc} */ @@ -504,10 +563,27 @@ class IIIFManifest extends StylePluginBase { '#title' => $this->t('Structured OCR data file field'), '#type' => 'checkboxes', '#default_value' => $this->options['iiif_ocr_file_field'], - '#description' => $this->t('The source of structured OCR text for each entity.'), + '#description' => $this->t("If the hOCR is a field on the same entity as the image source field above, select it here. If it's found in a related entity via the term below, leave this blank."), '#options' => $field_options, '#required' => FALSE, ]; + + $form['structured_text_term'] = [ + '#type' => 'entity_autocomplete', + '#target_type' => 'taxonomy_term', + '#title' => $this->t('Structured OCR text term'), + '#default_value' => $this->getStructuredTextTerm(), + '#required' => FALSE, + '#description' => $this->t('Term indicating the media that holds structured text, such as hOCR, for the given object. Use this if the text is on a separate media from the tile source.'), + ]; + + $form['search_endpoint'] = [ + '#type' => 'textfield', + '#title' => $this->t("Search endpoint path."), + '#description' => $this->t("If there is a search endpoint to search within the book that returns IIIF annotations, put it here. Use %node substitution where needed.
E.g., paged-content-search/%node"), + '#default_value' => $this->options['search_endpoint'], + '#required' => FALSE, + ]; } /** @@ -520,4 +596,41 @@ class IIIFManifest extends StylePluginBase { return ['json' => 'json']; } + /** + * Submit handler for options form. + * + * Used to store the structured text media term by URL instead of Ttid. + * + * @param array $form + * The form. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state object. + */ + // @codingStandardsIgnoreStart + public function submitOptionsForm(&$form, FormStateInterface $form_state) { + // @codingStandardsIgnoreEnd + $style_options = $form_state->getValue('style_options'); + $tid = $style_options['structured_text_term']; + unset($style_options['structured_text_term']); + $term = $this->entityTypeManager->getStorage('taxonomy_term')->load($tid); + $style_options['structured_text_term_uri'] = $this->utils->getUriForTerm($term); + $form_state->setValue('style_options', $style_options); + parent::submitOptionsForm($form, $form_state); + } + + /** + * Get the structured text term. + * + * @return \Drupal\taxonomy\TermInterface|null + * The term if it could be found; otherwise, NULL. + */ + protected function getStructuredTextTerm() : ?TermInterface { + if (!$this->structuredTextTermMemoized) { + $this->structuredTextTermMemoized = TRUE; + $this->structuredTextTerm = $this->utils->getTermForUri($this->options['structured_text_term_uri']); + } + + return $this->structuredTextTerm; + } + } From 54206de71204691ef67a28b1036a8d5f7df0ad0a Mon Sep 17 00:00:00 2001 From: Adam <607975+adam-vessey@users.noreply.github.com> Date: Wed, 24 Apr 2024 14:13:41 -0300 Subject: [PATCH 14/15] Fix Functional Javascript CI tests (#1004) * Fixup js tests * Move MINK env var into phpunit for easier local testing * Fix xpath for 10.3 --------- Co-authored-by: Joe Corall --- .github/workflows/build-2.x.yml | 42 ++-- phpunit.xml | 2 +- .../views.view.test_integer_weight.yml | 221 ++++++++++-------- .../IntegerWeightTest.php | 39 ++-- 4 files changed, 165 insertions(+), 139 deletions(-) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index c5d9d66b..8cd9f1d1 100644 --- a/.github/workflows/build-2.x.yml +++ b/.github/workflows/build-2.x.yml @@ -1,30 +1,26 @@ -# This is a basic workflow to help you get started with Actions - name: CI -# Controls when the action will run. on: - # Triggers the workflow on push or pull request events but only for the 2.x branch push: branches: [ 2.x ] pull_request: branches: [ 2.x ] - - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" build: - # The type of runner that the job will run on + env: + DRUPAL_VERSION: ${{ matrix.drupal-version }} + SCRIPT_DIR: ${{ github.workspace }}/islandora_ci + DRUPAL_DIR: /opt/drupal + PHPUNIT_FILE: ${{ github.workspace }}/build_dir/phpunit.xml + runs-on: ubuntu-latest continue-on-error: ${{ matrix.allowed_failure }} strategy: fail-fast: false matrix: php-versions: ["8.1", "8.2", "8.3"] - # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver. test-suite: ["kernel", "functional", "functional-javascript"] drupal-version: ["10.1.x", "10.2.x", "10.3.x-dev"] mysql: ["8.0"] @@ -51,17 +47,15 @@ jobs: - 61616:61616 - 61613:61613 - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: build_dir - name: Checkout islandora_ci - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: islandora/islandora_ci ref: github-actions @@ -79,13 +73,6 @@ jobs: sudo apt-get remove -y mysql-client mysql-common sudo apt-get install -y mysql-client - - name: Set environment variables - run: | - echo "DRUPAL_VERSION=${{ matrix.drupal-version }}" >> $GITHUB_ENV - echo "SCRIPT_DIR=$GITHUB_WORKSPACE/islandora_ci" >> $GITHUB_ENV - echo "DRUPAL_DIR=/opt/drupal" >> $GITHUB_ENV - echo "PHPUNIT_FILE=$GITHUB_WORKSPACE/build_dir/phpunit.xml" >> $GITHUB_ENV - - name: Cache Composer dependencies uses: actions/cache@v3 with: @@ -118,8 +105,21 @@ jobs: - name: Test scripts run: $SCRIPT_DIR/travis_scripts.sh + + - name: Start chromedriver + if: matrix.test-suite == 'functional-javascript' + run: |- + /usr/local/share/chromedriver-linux64/chromedriver \ + --log-path=/tmp/chromedriver.log \ + --verbose \ + --allowed-ips= \ + --allowed-origins=* & - name: PHPUNIT tests run: | cd $DRUPAL_DIR/web/core $DRUPAL_DIR/vendor/bin/phpunit --verbose --testsuite "${{ matrix.test-suite }}" + + - name: Print chromedriver logs + if: matrix.test-suite == 'functional-javascript' + run: cat /tmp/chromedriver.log diff --git a/phpunit.xml b/phpunit.xml index 46e82e78..bc0609fb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -47,7 +47,7 @@ - + diff --git a/tests/modules/integer_weight_test_views/test_views/views.view.test_integer_weight.yml b/tests/modules/integer_weight_test_views/test_views/views.view.test_integer_weight.yml index 08dc4912..9ccb76a8 100644 --- a/tests/modules/integer_weight_test_views/test_views/views.view.test_integer_weight.yml +++ b/tests/modules/integer_weight_test_views/test_views/views.view.test_integer_weight.yml @@ -4,6 +4,7 @@ dependencies: config: - node.type.repo_item module: + - islandora - node - user id: test_integer_weight @@ -13,87 +14,36 @@ description: '' tag: '' base_table: node_field_data base_field: nid -core: 8.x display: default: - display_plugin: default id: default display_title: Master + display_plugin: default position: 0 display_options: - access: - type: perm - options: - perm: 'access content' - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: mini - options: - items_per_page: 10 - offset: 0 - id: 0 - total_pages: null - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - tags: - previous: ‹‹ - next: ›› - style: - type: table - row: - type: fields + title: 'test weight' fields: title: id: title table: node_field_data field: title + relationship: none + group_type: group + admin_label: '' entity_type: node entity_field: title + plugin_id: field + label: Title + exclude: false alter: alter_text: false make_link: false absolute: false - trim: false word_boundary: false ellipsis: false strip_tags: false + trim: false html: false - hide_empty: false - empty_zero: false - settings: - link_to_entity: true - plugin_id: field - relationship: none - group_type: group - admin_label: '' - label: Title - exclude: false element_type: '' element_class: '' element_label_type: '' @@ -103,9 +53,13 @@ display: element_wrapper_class: '' element_default_classes: true empty: '' + hide_empty: false + empty_zero: false hide_alter_empty: true click_sort_column: value type: string + settings: + link_to_entity: true group_column: value group_columns: { } group_rows: true @@ -123,7 +77,8 @@ display: relationship: none group_type: group admin_label: '' - label: 'Integer weight selector (field_integer_weight)' + plugin_id: integer_weight_selector + label: 'Integer Weight Selector (field_integer_weight)' exclude: false alter: alter_text: false @@ -164,44 +119,57 @@ display: hide_empty: false empty_zero: false hide_alter_empty: true - range: '20' - plugin_id: integer_weight_selector - filters: - status: - value: '1' - table: node_field_data - field: status - plugin_id: boolean - entity_type: node - entity_field: status - id: status + pager: + type: mini + options: + offset: 0 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: ›› + previous: ‹‹ expose: - operator: '' - group: 1 - type: - id: type - table: node_field_data - field: type - value: - repo_item:repo_item - entity_type: node - entity_field: type - plugin_id: bundle + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access content' + cache: + type: tag + options: { } + empty: { } sorts: created: id: created table: node_field_data field: created - order: DESC - entity_type: node - entity_field: created - plugin_id: date relationship: none group_type: group admin_label: '' - exposed: false + entity_type: node + entity_field: created + plugin_id: date + order: DESC expose: label: '' + exposed: false granularity: second field_integer_weight_value: id: field_integer_weight_value @@ -210,17 +178,82 @@ display: relationship: none group_type: group admin_label: '' + plugin_id: standard order: ASC + expose: + label: '' + field_identifier: '' + exposed: false + arguments: { } + filters: + status: + id: status + table: node_field_data + field: status + entity_type: node + entity_field: status + plugin_id: boolean + value: '1' + group: 1 + expose: + operator: '' + type: + id: type + table: node_field_data + field: type + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: type + plugin_id: bundle + operator: in + value: + repo_item: repo_item + group: 1 exposed: false expose: + operator_id: '' label: '' - plugin_id: standard - title: 'test weight' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + style: + type: table + row: + type: fields + query: + type: views_query + options: + query_comment: '' + disable_sql_rewrite: false + distinct: false + replica: false + query_tags: { } + relationships: { } header: { } footer: { } - empty: { } - relationships: { } - arguments: { } display_extenders: { } cache_metadata: max-age: -1 @@ -232,9 +265,9 @@ display: - user.permissions tags: { } page_1: - display_plugin: page id: page_1 display_title: Page + display_plugin: page position: 1 display_options: display_extenders: { } diff --git a/tests/src/FunctionalJavascript/IntegerWeightTest.php b/tests/src/FunctionalJavascript/IntegerWeightTest.php index 2572c191..5e10133c 100644 --- a/tests/src/FunctionalJavascript/IntegerWeightTest.php +++ b/tests/src/FunctionalJavascript/IntegerWeightTest.php @@ -8,6 +8,7 @@ use Drupal\Tests\field_ui\Traits\FieldUiTestTrait; use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; use Drupal\node\Entity\Node; +use Drupal\views\Tests\ViewTestData; /** * Test integer weight selector. @@ -30,6 +31,7 @@ class IntegerWeightTest extends WebDriverTestBase { 'views', 'field_ui', 'integer_weight_test_views', + 'islandora', ]; /** @@ -82,27 +84,16 @@ class IntegerWeightTest extends WebDriverTestBase { */ public function setUp(): void { parent::setUp(); + $this->drupalCreateContentType([ + 'type' => 'repo_item', + 'name' => 'Repository Item', + ]); - $this->adminUser = $this->drupalCreateUser( - [ - 'administer content types', - 'administer node fields', - 'administer node display', - ] - ); - - // Create dummy repo_item type to sort (since we don't have - // repository_object without islandora_defaults). - $type = $this->container->get('entity_type.manager')->getStorage('node_type') - ->create([ - 'type' => 'repo_item', - 'name' => 'Repository Item', - ]); - $type->save(); - $this->container->get('router.builder')->rebuild(); + $account = $this->createUser(['edit any repo_item content'], 'test', TRUE); + $this->drupalLogin($account); $fieldStorage = FieldStorageConfig::create([ - 'fieldName' => static::$fieldName, + 'field_name' => static::$fieldName, 'entity_type' => 'node', 'type' => static::$fieldType, ]); @@ -124,16 +115,18 @@ class IntegerWeightTest extends WebDriverTestBase { $this->nodes[] = $node; } - ViewsTestData::createTestViews(get_class($this), ['integer_weight_test_views']); + ViewTestData::createTestViews(get_class($this), ['integer_weight_test_views']); } /** * Test integer weight selector. */ public function testIntegerWeightSelector() { - $this->drupalGet('test-integer-weight'); - $page = $this->getSession()->getPage(); + $web_assert = $this->assertSession(); + $this->drupalGet('/test-integer-weight'); + $web_assert->pageTextContains('Item 1'); + $page = $this->getSession()->getPage(); $weight_select1 = $page->findField("field_integer_weight[0][weight]"); $weight_select2 = $page->findField("field_integer_weight[1][weight]"); $weight_select3 = $page->findField("field_integer_weight[2][weight]"); @@ -153,8 +146,8 @@ class IntegerWeightTest extends WebDriverTestBase { $this->assertSession()->pageTextNotContains('You have unsaved changes.'); // Drag and drop 'Item 1' over 'Item 2'. - $dragged = $this->xpath("//tr[@class='draggable'][1]//a[@class='tabledrag-handle']")[0]; - $target = $this->xpath("//tr[@class='draggable'][2]//a[@class='tabledrag-handle']")[0]; + $dragged = $this->xpath("//tr[contains(@class, 'draggable')][1]//a[contains(@class, 'tabledrag-handle')]")[0]; + $target = $this->xpath("//tr[contains(@class, 'draggable')][2]//a[contains(@class, 'tabledrag-handle')]")[0]; $dragged->dragTo($target); // Pause for javascript to do it's thing. From c80769580cdc8e722b9d28be0b87beef4f803d70 Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Wed, 24 Apr 2024 18:46:01 +0000 Subject: [PATCH 15/15] Do not have a fatal error on a missing action (#1014) --- src/PresetReaction/PresetReaction.php | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/PresetReaction/PresetReaction.php b/src/PresetReaction/PresetReaction.php index 98aa6946..4ebd6823 100644 --- a/src/PresetReaction/PresetReaction.php +++ b/src/PresetReaction/PresetReaction.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -21,12 +22,20 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto */ protected $actionStorage; + /** + * The logger. + * + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + /** * {@inheritdoc} */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $action_storage) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityStorageInterface $action_storage, LoggerInterface $logger) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->actionStorage = $action_storage; + $this->logger = $logger; } /** @@ -37,7 +46,8 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto $configuration, $plugin_id, $plugin_definition, - $container->get('entity_type.manager')->getStorage('action') + $container->get('entity_type.manager')->getStorage('action'), + $container->get('logger.factory')->get('islandora') ); } @@ -56,7 +66,20 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto $action_ids = $config['actions']; foreach ($action_ids as $action_id) { $action = $this->actionStorage->load($action_id); - $action->execute([$entity]); + if (empty($action)) { + $this->logger->warning('Action "@action" not found.', ['@action' => $action_id]); + continue; + } + try { + $action->execute([$entity]); + } + catch (\Exception $e) { + $this->logger->error('Error executing action "@action" on entity "@entity": @message', [ + '@action' => $action->label(), + '@entity' => $entity->label(), + '@message' => $e->getMessage(), + ]); + } } }