Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move getEntityUri to separate utility class. #58

Merged
merged 6 commits into from
Sep 21, 2021

Conversation

whikloj
Copy link
Member

@whikloj whikloj commented Sep 18, 2021

GitHub Issue: Islandora/documentation#1766

What does this Pull Request do?

Creates a new small utility class to provide the getEntityUri to modules implementing the hook_jsonld_alter_normalized_array.

What's new?

Adds a new service jsonld.normalizer_utils and loads this class into the ContentEntityNormalizer and FileEntityNormalizer to use its getEntityUri method.

Passes the new class to modules implementing the above hook inside the $context array with key utils. ie ($context['utils']->getEntityUri($some_entity))

  • Does this change require documentation to be updated? The jsonld.api.php has been updated
  • Does this change add any new dependencies? no
  • Does this change require any other modifications to be made to the repository
    (i.e. Regeneration activity, etc.)? no
  • Could this change impact execution of existing code? no

How should this be tested?

Easiest to test with the PR Islandora/controlled_access_terms#72 on controlled_access_terms. Instructions are on that PR.

Additional Notes:

Any additional information that you think would be helpful when reviewing this
PR.

Interested parties

@Islandora/8-x-committers @seth-shaw-unlv @mdlincoln @kspurgin

@seth-shaw-unlv
Copy link
Contributor

seth-shaw-unlv commented Sep 20, 2021

Applied the patch to a fresh isle-dc local build and encountered a WSOD with this (trimmed) in the logs:

NOTICE: PHP message: TypeError: Argument 6 passed to Drupal\jsonld\Normalizer\FileEntityNormalizer::__construct() must be an instance of Drupal\jsonld\Utils\JsonldNormalizerUtilsInterface, instance of Drupal\Core\Config\ConfigFactory given, called in /var/www/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in /var/www/drupal/web/modules/contrib/jsonld/src/Normalizer/FileEntityNormalizer.php on line 54 #0 /var/www/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php(262): Drupal\jsonld\Normalizer\FileEntityNormalizer->__construct()

Edit: cleared cache to resolve the error. Should have thought of that after applying the patch.

@seth-shaw-unlv
Copy link
Contributor

This appears to work on Drupal 9.2 after clearing the cache based on my manual testing, but the Github Actions' tests aren't happy.

@seth-shaw-unlv
Copy link
Contributor

There it is, the tests need to be updated to use the new service definitions: https://github.com/whikloj/claw-jsonld/blob/issue-1766/tests/src/Kernel/JsonldKernelTestBase.php#L187,L189

Also add --debug to PHPUnit to see what tests are run.
It was not picked up previously and may never have been run.
Copy link
Contributor

@seth-shaw-unlv seth-shaw-unlv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@seth-shaw-unlv seth-shaw-unlv merged commit 7f16912 into Islandora:8.x-1.x Sep 21, 2021
@whikloj whikloj deleted the issue-1766 branch September 23, 2021 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants