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

Issue #3368689 by tbsiqueira: Update behat tests to use the new compatible php 8.1 images #3439

Merged
merged 6 commits into from
Jul 13, 2023

Conversation

tbsiqueira
Copy link
Contributor

@tbsiqueira tbsiqueira commented Jun 26, 2023

🚀 🔥 Related PRs 🔥 🚀

This is a PR from a series of 5 PRs that should be merged in the following order:

  1. Issue #3373075 by tbsiqueira: Update dev/test dependencies open_social_dev#70
  2. Issue #3373172 by tbsiqueira: Update our tugboat docker image with one supporting PHP 8.1 #3460
  3. Issue #3373075 by tbsiqueira: Update from drupal/core-recommended to drupal/core #3457
  4. Update our Doocker setup to use PHP 8.1 images drupal_social#392 ( this is just a private repository that we use for development, this will not be available for public users )
  5. Issue #3368689 by tbsiqueira: Update behat tests to use the new compatible php 8.1 images #3439

Problem

We are now officially adding php 8.1 support, but our behat tests are still running on PHP 8.0, this is not an issue because PHPStan guarantees the compatibility, but we want to run our behat tests using PHP 8.1,

After we fixed the behat tests, a couple of issues raised:

$extensions = explode(' ', mb_strtolower(trim($config->get('download_count_excluded_file_extensions') ?? "")));

Unresolved variation cache module dependencies during hook updates fixed here and other places, this errors were found during the upgrade path check, and since they are green, they should all be resolved now.

 // Add variationcache hook update from group as required to fix update path.
  $dependencies['social_core'][11402] = [
    'group' => 8020,
  ];

  // Add variationcache hook update from group as required to fix update path.
  $dependencies['social_core'][11900] = [
    'group' => 8020,
  ];

Missing UUID on configuration created during hook updates, as a result of not using the correct Drupal APIs to generate configs from yml files, as seen here:

  $config_storage = \Drupal::service('config.storage');
  $config_path = \Drupal::service('extension.list.module')->getPath('social_core') . '/config/static';
  $source = new FileStorage($config_path);
  $config_storage->write('core.entity_view_mode.node.email_card', (array) $source->read('core.entity_view_mode.node.email_card_11401'));

This last issue required an update hook, to create a proper for those configuration files, change is available at this link

I also noticed there some explode() functions were .... blowing up 💥 ( pun intended ) due to the "string" argument being NULL, so I added checks to avoid that, and they are all verified with PHPStan, the ones that don't have it is because we don't need.

Solution

Update docker images used for Behat tests to feature PHP 8.1 compatible images

Issue tracker

https://www.drupal.org/project/social/issues/3368689

Theme issue tracker

N/A

How to test

  • Green tests

Definition of done

Before merge

  • Code/peer review is completed
  • All commit messages are clear and clean. If applicable a rebase was performed
  • All automated tests are green
  • Functional/manual tests of the acceptance criteria are approved
  • All acceptance criteria were met
  • New features or changes to existing features are covered by tests, either unit (preferably) or behat
  • Update path is tested. New hook_updates should respect update order, right naming convention and consider hook_post_update code
  • Module can be safely uninstalled. Update/implement hook_uninstall and make sure that removed configuration or dependencies are removed/uninstalled
  • This pull request has all required labels (team/type/priority)
  • This pull request has a milestone
  • This pull request has an assignee (if applicable)
  • Any front end changes are tested on all major browsers
  • New UI elements, or changes on UI elements are approved by the design team
  • New features, or feature changes are approved by the product owner

After merge

  • Code is tested on all branches that it has been cherry-picked
  • Update hook number might need adjustment, make sure they have the correct order
  • The Drupal.org ticket(s) are updated according to this pull request status

Screenshots

Release notes

Change Record

Translations

@mergeable
Copy link

mergeable bot commented Jun 26, 2023

Thanks for contributing towards Open Social! A maintainer from the @goalgorilla/maintainers group might not review all changes from all teams/contributors. Please don't be discouraged if it takes a while. In the meantime, we have some automated checks running and it might be that you will see our comments with some tips or requests to speed up the review process. 😊

@tbsiqueira tbsiqueira force-pushed the issue/3368689-php-8-1-compatibility-behat branch from feb30e3 to 7fe309d Compare June 26, 2023 12:58
@tbsiqueira tbsiqueira closed this Jul 11, 2023
@tbsiqueira tbsiqueira reopened this Jul 11, 2023
@tbsiqueira tbsiqueira force-pushed the issue/3368689-php-8-1-compatibility-behat branch from 7403698 to 4822cf6 Compare July 11, 2023 09:00
@tbsiqueira tbsiqueira force-pushed the issue/3368689-php-8-1-compatibility-behat branch from 9e3cea7 to dd5f7ef Compare July 12, 2023 15:05
@tbsiqueira tbsiqueira force-pushed the issue/3368689-php-8-1-compatibility-behat branch from dd5f7ef to 11fcc8f Compare July 12, 2023 15:17
This was caused due to the new variationcache module being required for 11.0.0
It looks like this was a legacy issue, but now should be solved.
@tbsiqueira tbsiqueira force-pushed the issue/3368689-php-8-1-compatibility-behat branch from e3957e5 to be2867f Compare July 13, 2023 06:24
@ronaldtebrake
Copy link
Contributor

Would be great if you could explain the changes you made, especially for the UUID a bit in here so we have some reference what occurred and why you fixed it this way. I feel like it's great knowledge transfer for others 😊

@zanvidmar
Copy link
Contributor

We can see that if Xss::filter's first argument is NULL, it is now changed to an empty string at
https://github.com/goalgorilla/open_social/pull/3439/files#diff-032a2e5768d4846a91383aed3351d4534dc8469d33d0e949faafbfdbc27150dcR33

As Xss::filter requires first argument to be string, we can improve this here as well

$themevar = Xss::filter(theme_get_setting($setting, $themename));

During review we noticed that we had more config objects without a valid UUID
this was going to cause the same issue, so we added them to the hook updates.
@tbsiqueira tbsiqueira merged commit 5fc8cfe into main Jul 13, 2023
@tbsiqueira tbsiqueira deleted the issue/3368689-php-8-1-compatibility-behat branch July 13, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: critical status: needs review This pull request is waiting for a requested review status: needs work This pull request needs more work before it's ready for review team: guardians type: dependencies Updating a dependency file
Development

Successfully merging this pull request may close these issues.

3 participants