From d5556f445d3834c074428e774273fd37d7f2effb Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Wed, 1 Nov 2023 14:40:25 -0300 Subject: [PATCH] Add PHP 8.2 and Drupal 10.2 to testing matrix (#987) * Add PHP 8.2 and Drupal 10.2 to testing matrix * Use `name` key when creating test content type. * Remove `gemini_url` from schema. * Remove gemini_url from islandora.settings.yml * Update OcrTextFormatter.php * Remove Drupal 10.2 from matrix, known fail. --- .github/workflows/build-2.x.yml | 4 ++-- config/install/islandora.settings.yml | 1 - config/schema/islandora.schema.yml | 3 --- .../src/Plugin/Field/FieldFormatter/OcrTextFormatter.php | 5 +++-- tests/src/Kernel/EventGeneratorTest.php | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-2.x.yml b/.github/workflows/build-2.x.yml index 041eca7a..396b9a0b 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"] + php-versions: ["8.1", "8.2"] # test-suite functional-javascript will appear to pass but will skip tests; missing chromedriver. test-suite: ["kernel", "functional", "functional-javascript"] - drupal-version: ["9.5.x", "10.0.x", "10.1.x"] + drupal-version: ["10.0.x", "10.1.x"] # Fails on 10.2 until https://github.com/Islandora/islandora/issues/989 is resolved. mysql: ["8.0"] allowed_failure: [false] diff --git a/config/install/islandora.settings.yml b/config/install/islandora.settings.yml index 179d4213..1497c291 100644 --- a/config/install/islandora.settings.yml +++ b/config/install/islandora.settings.yml @@ -1,5 +1,4 @@ broker_url: 'tcp://localhost:61613' jwt_expiry: '+2 hour' -gemini_url: '' delete_media_and_files: TRUE gemini_pseudo_bundles: [] diff --git a/config/schema/islandora.schema.yml b/config/schema/islandora.schema.yml index 89c1b58a..49de998b 100644 --- a/config/schema/islandora.schema.yml +++ b/config/schema/islandora.schema.yml @@ -26,9 +26,6 @@ islandora.settings: upload_form_allowed_mimetypes: type: string label: 'Upload Form Allowed Extensions' - gemini_url: - type: uri - label: 'Url to Gemini microservice' gemini_pseudo_bundles: type: sequence label: 'List of node, media and taxonomy terms that should include the linked Fedora URI' diff --git a/modules/islandora_text_extraction/src/Plugin/Field/FieldFormatter/OcrTextFormatter.php b/modules/islandora_text_extraction/src/Plugin/Field/FieldFormatter/OcrTextFormatter.php index 2e066943..055e76d9 100644 --- a/modules/islandora_text_extraction/src/Plugin/Field/FieldFormatter/OcrTextFormatter.php +++ b/modules/islandora_text_extraction/src/Plugin/Field/FieldFormatter/OcrTextFormatter.php @@ -132,8 +132,9 @@ class OcrTextFormatter extends FormatterBase implements ContainerFactoryPluginIn $fileItem = $item->getValue(); $file = $this->entityTypeManager->getStorage('file')->load($fileItem['target_id']); $contents = file_get_contents($file->getFileUri()); - if (mb_detect_encoding($contents) != 'UTF-8') { - $contents = utf8_encode($contents); + $detected_encoding = mb_detect_encoding($contents); + if ($detected_encoding != 'UTF-8') { + $contents = mb_convert_encoding($contents, 'UTF-8', $detected_encoding); } $contents = nl2br($contents); return $contents; diff --git a/tests/src/Kernel/EventGeneratorTest.php b/tests/src/Kernel/EventGeneratorTest.php index 28a4ec03..34a5ae92 100644 --- a/tests/src/Kernel/EventGeneratorTest.php +++ b/tests/src/Kernel/EventGeneratorTest.php @@ -49,7 +49,7 @@ class EventGeneratorTest extends IslandoraKernelTestBase { $test_type = NodeType::create([ 'type' => 'test_type', - 'label' => 'Test Type', + 'name' => 'Test Type', ]); $test_type->save();