Manual UI Testing Steps for Pathologic

1. Enabl the module on D10 using the latest patched version
2. Add a new "base path" for the site at admin/config/content/pathologic
3. Add Pathologic to the text format filters on Drupal core's "Basic HTML" text format.
4. Create a "Basic page" node with a link using the base path added in Step 2.
5. Verify that the text format filter correctly rewrites the path to match the testing site domain when viewed.
6. Verify that a text-format specific setting also works.

Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 10.

To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects

Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.

The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated patches until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.

    If the issue is reopened, then new automated patches will be posted.

    If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Providing feedback

If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.

Issue fork pathologic-3289033

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Project Update Bot created an issue. See original summary.

project update bot’s picture

Status: Active » Needs review
StatusFileSize
new12.95 KB

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.12.0, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #127

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.9
  2. palantirnet/drupal-rector: 0.12.0
project update bot’s picture

StatusFileSize
new5.28 KB
new17.96 KB

This is an automated patch generated by Drupal Rector. Please see the issue summary for more details.

It is important that any automated tests available are run with this patch and that you manually test this patch.

Drupal 10 Compatibility

According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.

Currently Drupal Rector, version 0.13.0, cannot fix all Drupal 10 compatibility problems.

This patch does not update the info.yml file for Drupal 10 compatibility.

Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.

Debug info

Bot run #139

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 1.1.24
  2. palantirnet/drupal-rector: 0.13.0
taniachque’s picture

Issue summary: View changes
StatusFileSize
new18.38 KB
new2.4 KB

Changing pathologic.info.yml.

taniachque’s picture

Adding composer.json file.

reenaraghavan’s picture

Assigned: Unassigned » reenaraghavan

I will review this patch.

reenaraghavan’s picture

Assigned: reenaraghavan » Unassigned
StatusFileSize
new48.17 KB

I have used the latest patch and tested using upgrade status.
Getting error after scanning using upgrade Status, I have attached the screenshot of it.

libbna’s picture

Assigned: Unassigned » libbna

I will work on this.

libbna’s picture

Assigned: libbna » Unassigned
StatusFileSize
new19.33 KB

Solved the last deprecate code issue.

Status: Needs review » Needs work

The last submitted patch, 9: 3289033-drupal-10-compatibilities-9.patch, failed testing. View results

omkar-pd’s picture

Status: Needs work » Needs review
StatusFileSize
new19.62 KB

According to https://www.drupal.org/node/2940031. file_create_url($uri) should be replaced with \Drupal::service('file_url_generator')->generateAbsoluteString($uri)

project update bot’s picture

mark_fullmer’s picture

Assigned: Unassigned » mark_fullmer
Issue summary: View changes

Reviewing this today!

mark_fullmer’s picture

Static analysis check

Running the latest version of mglaman/drupal-check, I see no remaining D10 deprecations. There are two "PHPDoc tag @return has invalid value" warnings, although this wouldn't cause an issue per se, so that is probably out of scope for this D10 compatibility issue. For the record, the changes to fix those notices would be:

diff --git a/src/PathologicSettingsCommon.php b/src/PathologicSettingsCommon.php
index 93efb36..4579be1 100644
--- a/src/PathologicSettingsCommon.php
+++ b/src/PathologicSettingsCommon.php
@@ -16,7 +16,7 @@ class PathologicSettingsCommon {
    *
    * @param array $defaults
    *   An array of default values for the configuration form fields.
-   * @return
+   * @return array
    *   The common form elements
    */
   public function commonSettingsForm(array $defaults) {
diff --git a/tests/src/Functional/PathologicTest.php b/tests/src/Functional/PathologicTest.php
index 590b0bc..15bf839 100644
--- a/tests/src/Functional/PathologicTest.php
+++ b/tests/src/Functional/PathologicTest.php
@@ -205,7 +205,7 @@ function _pathologic_content_url($path, $options) {
  *
  * @param $settings
  *   An array of settings for the Pathologic instance on the format.
- * @return
+ * @return string
  *   A format machine name (consisting of random characters) for the format.
  */
 function _pathologic_build_format($settings) {

Automated testing check
Running the automated tests with D10 locally, it flagged the following:

1) Drupal\Tests\pathologic\Functional\PathologicTest::testPathologic
Unable to install modules: module 'pathologic_test' is incompatible with this version of Drupal core.

The following change fixes that:

diff --git a/tests/modules/pathologic_test/pathologic_test.info.yml b/tests/modules/pathologic_test/pathologic_test.info.yml
index b216117..f3e0df4 100755
--- a/tests/modules/pathologic_test/pathologic_test.info.yml
+++ b/tests/modules/pathologic_test/pathologic_test.info.yml
@@ -1,7 +1,6 @@
 name: Pathologic Test
 description: Module which implements hook_pathologic_alter() for testing that functionality.
-core: 8.x
-core_version_requirement: ^8 || ^9
+core_version_requirement: ^9 || ^10
 package: Testing
 dependencies:
 - drupal:filter

Manual UI Testing

1. I enabled the module on D10 using the latest patched version and added a new "base path" for the site at admin/config/content/pathologic
2. I added Pathologic to the text format filters on Drupal core's "Basic HTML" text format.
3. I created a "Basic page" node with a link using the base path added in Step 1
3. I verified that the text format filter correctly rewrote the path to match the testing site domain when viewed.
4. I verified that a text-format specific setting also worked.

The attached patch includes the fixes above, and the interdiff shows the changes since the patch in #11.

This is in good shape. Maybe one more person involved to officially RTBC it? I've added the manual testing steps to the issue description.

mark_fullmer’s picture

Issue summary: View changes
mark_fullmer’s picture

Assigned: mark_fullmer » Unassigned
yashingole’s picture

I have reviewed and checked Patch #14 this works for drupal 9.5 and drupal 10.0. and 10.0.1
Screenshots of the compatibility on 9.5 and the Config on 10 have been attached for reference:

j_ten_man made their first commit to this issue’s fork.

rajab natshah’s picture

Priority: Normal » Major
svendecabooter’s picture

Status: Needs review » Reviewed & tested by the community

Patch works well. Can a D10 compatible release be created?

neclimdul’s picture

StatusFileSize
new14.21 KB
new16.91 KB

Everything looks good. Here's an updated version of the patch that removes a bunch of the style and white-space changes and makes it easier to review.

rajab natshah’s picture

Thank you, Garrett, Sascha, Derek , for having time to maintain this important module, for needed to correct the path for links in multi-site environments in an editorial workflow on dev, staging, and production sites.

Hoping for a soft commit on the 8.x-1.x branch, to ease testing with Drupal 10
Testing now with git apply for the patch

rajab natshah’s picture

Priority: Major » Critical
rajab natshah’s picture

mark_fullmer’s picture

Just amplifying what others have said before: thanks for this module, which has wide adoption! A soft commit on the default branch for testing would be great, and a release would be even better! (Given the limited amount of change involved for D10, I don't think there is much need to wait to do a release.)

rajab natshah’s picture

rajab natshah’s picture

Thanks, Mark, for the patch in #14
Testing with drupal:filter and CKEditor 5 and CKEditor 4

Correct URLs with Pathologic

rajab natshah’s picture

Had Real physical testing round for Pathologic 1.0.x-dev with Drupal ~10 and Drupal ~9
With CKEditor 5 and CKEditor 4 drupal:filter

Attached the steps for the testing setup
Real-physical-testing-round-for-pathologic-1-0-x-dev--with-d10-and-d9.zip

Build Drupal ~10.0 sandbox test site and have Drush ~11.0

mkdir -p /var/www/html/sandboxes
composer create-project drupal/recommended-project:~10.0 /var/www/html/sandboxes/drupal10pathologic_1__test
cd /var/www/html/sandboxes/drupal10pathologic_1__test/
composer require drush/drush:~11.0;

Change minimum stability to dev for testing on the recommended Drupal 10 project template

composer config minimum-stability dev

Add CKEditor 4 for testing only

composer require drupal/ckeditor:~1.0

Add the Pathologic module

mkdir -p /var/www/html/sandboxes/drupal10pathologic_1__test/web/modules/contrib
cd /var/www/html/sandboxes/drupal10pathologic_1__test/web/modules/contrib/
git clone --branch '8.x-1.x' https://git.drupalcode.org/project/pathologic.git

Git Apply the patch.

cd /var/www/html/sandboxes/drupal10pathologic_1__test/web/modules/contrib/pathologic/
wget https://www.drupal.org/files/issues/2022-12-02/3289033-drupal-10-compatibility-14.patch
git apply 3289033-drupal-10-compatibility-14.patch

Change file/directory mod and ownership of files:

cd /var/www/html/sandboxes/drupal10pathologic_1__test/
sudo chmod 775 -R .;sudo chown www-data:$USER -R .;

Install with Drush

./vendor/drush/drush/drush site:install standard --yes --site-name="Pathologic 1.0.x-dev - Real physical testing with Drupal ~10" --account-name="webmaster" --account-pass="d" --account-mail="test@drupal.org" --db-url="mysql://root:123___@localhost/sandboxes_drupal10pathologic_1__test" -vvv ;

./vendor/drush/drush/drush pm:enable pathologic
./vendor/drush/drush/drush pm:enable ckeditor

Rebuild the cache:

sudo chmod 775 -R .;sudo chown www-data:$USER -R .;
./vendor/drush/drush/drush cache:rebuild

Open a browser and change the address to: http://localhost/sandboxes/drupal10pathologic_1__test/web/





rajab natshah’s picture

Tested, Working well.
Ready to commit #14 and ready for a release.

  • mark_fullmer committed 8bba2799 on 8.x-1.x
    Issue #3289033 by taniachque, mark_fullmer, reenaraghavan, neclimdul,...
mark_fullmer’s picture

Status: Reviewed & tested by the community » Fixed

The original creator of this fundamental Drupal module, Garrett Albright, added me as a maintainer, after I reached out about ongoing support. I've committed the D10-compatibility fix to the 8.x-1.x branch. Marking this issue as "Fixed."

Next step: cutting a new release.

Garrett Albright’s picture

Yep. I'm sorry, everyone, that I haven't kept up on this module for the past half decade, but I just don't work with Drupal that much anymore and don't have much interest in maintaining code projects in my free time anymore either. Thanks to Mark for picking up my slack and I'm glad to see this module is still proving useful to people.

dww’s picture

@Garrett Albright: Indeed, thanks for this extremely useful module! Glad I was able to help it with a D8/D9 release, and give it a burst of attention at the time. No need to apologize for moving on. Grateful you contributed all your work when you did!

Welcome aboard, @mark_fullmer! I just was pulling a bunch of git repos on my machine and noticed a commit in here, which I didn't expect. ;) Glad to see why. Thanks for stepping in to help!

It's too bad this is the only change to the module, and the only thing that breaks D8 compatibility:

-    $new_parts = parse_url(file_create_url(\Drupal::config('system.file')->get('default_scheme') . '://' . $parts['path']));
+    $uri = \Drupal::config('system.file')->get('default_scheme') . '://' . $parts['path'];
+    $new_parts = parse_url(\Drupal::service('file_url_generator')->generateAbsoluteString($uri));

but oh well, life moves on. 😉 D8 is EOL, so we might as well cut a new release for D9/D10.

I wonder if we should call that 2.0.0-alpha1 and switch to semver now, instead of 8.x-1.0-alpha4 or something. 😅

Regardless, I think it'd be wise to sort out #2418369: Internal URL handling (language prefixes, base://, ...) and #3270030: 8.x-1.0-alpha3 breaks images in multi-language sites. before we really call this "stable".

Probably we should move this to a new issue about the next release...

Although I'm glad to see the tests changed to use assertEquals(), I found the original formatting a lot easier to read and make sense of. What do you think about reverting that (and using assertEquals()) before we cut a new release?

Thanks again!
-Derek

dww’s picture

Status: Fixed » Needs review

Yeah, honestly, I think we should make a new 2.0.x branch with what you committed, revert the commit to 8.x-1.x branch, and leave the possibility of a 8.x-1.0-whatever release that fixes the known bugs for people still stuck on D8, and allow us to move to semver for everything else D9+ moving forward. Sound good?

Thanks to everyone who worked on this issue doing reviews and testing! Nice to see so many folks interested in this module...

mark_fullmer’s picture

Thanks, Derek, for this! I wholeheartedly agree that this is an opportune time to switch to semver and make the D10 compatible version a new major version release, and that it would be sensible to have the first release be 2.0.0-alpha1, given the other issues you flagged.

The main implication with this change would be that sites in the process of updating to Drupal 10 would now need to manually change their Composer requirement to some variation of "drupal/pathologic: ^2", rather than automatically getting a compatible version with composer update. But that's standard practice, so we don't need to call out anything in particular.

I also agree that the syntax in the tests should be switched to multi-line parameters.

As far as reverting this commit for the 8.x-1.x branch, I suggest we create a new commit that performs that, rather than rewriting commit history, just for transparency.

I'll wait a few days for response/action from the community before taking initiative myself.

  • dww committed fda6a37c on 8.x-1.x
    Revert "Issue #3289033 by taniachque, mark_fullmer, reenaraghavan,...
dww’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Fixed

Created 2.0.x branch with the D10 port committed, reverted the commit from 8.x-1.x branch, created a 2.0.x-dev release, and pushed commit faea7caf to fix the test formatting in the 2.0.x branch. Not totally sure why d.o didn't see the follow-up commit, since it had the right issue number. Maybe it's because the 2.0.x release didn't yet exist and d.o didn't know it should care. ;)

Anyway, I think this issue is now done. Let's discuss future release plans at #3343541: Plan for new Pathologic releases.

Thanks again!
-Derek

svendecabooter’s picture

Could you also create a release for the 2.0.x branch, that would support Drupal 10?

mark_fullmer’s picture

Could you also create a release for the 2.0.x branch, that would support Drupal 10?

A new alpha release from the 2.0.x branch is called out in #3343541: Plan for new Pathologic releases as part of the plan, and I agree that this would is valuable and time-sensitive for people looking to update to D10, and that first alpha release doesn't need to wait until the other fixes called out are resolved. I'm a co-maintainer, but it looks like don't have the permission to create releases; that said, I think you can expect a new release pretty soon!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rajab natshah’s picture

Tested the dev version. Good to release.