Problem/Motivation

Hello project maintainers,
This is an automated issue to help make this module compatible with Drupal 9.

To read more about this effort by the Drupal Association, please read: Accelerating Drupal 9 module and theme readiness with automated patches

Periodically patches will be added to this issue that remove Drupal 9 deprecations. To stop further patches from being posted simply close this issue(any status besides Active, Needs Review or Needs work) or remove the "ProjectUpdateBotD9" tag from the issue.

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 or Needs work) and the "RectorAutoPatches" tag is left on this issue, new patches will be posted periodically if new deprecations are needed.

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

  2. Leave open but stop new automated patches.

    If you want to use this issue as a starting point to remove deprecations but don't want new automated patches simply leave this issue open but remove the "RectorAutoPatches" from the issue.

    You can use Drupal Rector yourself to make these patches.

    If you want to receive automated patches again simply add back the "RectorAutoPatches" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful they can simply close this issue(any status besides Active, Needs Review or Needs work) 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 9 compatibility it may be useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the patch in the comment by Project Update Bot
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.

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 Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear,  use the Infrastructure project issue queue using the component “Bot: Drupal Rector”.

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
new2.13 KB
Patch for Build #1473

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.

This patch was created using these packages:

  1. mglaman/phpstan-drupal: 0.12.3
  2. palantirnet/drupal-rector: 0.5.4
  3. rector/rector-prefixed: dev-master

Debug info: Run #1473

project update bot’s picture

Issue summary: View changes
Issue tags: +Drupal 9 compatibility

Fixing summary

valic’s picture

Issue summary: View changes
StatusFileSize
new4.06 KB

Adding as well core version, and replacing simpletest code

el1_1el’s picture

StatusFileSize
new4.06 KB

Getting

  The 'core_version_requirement' constraint (^8.8 || ^9) requires the 'core' key not be set in modules/contrib/fieldable_path/fieldable_path.info.yml

a small diff from 3 -core: 8.x fixes it

dww credited Sergiu Stici.

dww’s picture

Assigned: Unassigned » dww
Status: Needs review » Needs work

This is going to need to be re-rolled now that #3216809: Automated tests fail due to extending TestBase not BrowserTestBase is done, since that issue already converted the fieldable_path test to use BrowserTestBase.

Also, I just marked #3082231: Deprecated Code Report duplicate with this (even though that was the earlier issue about this topic), since the patch here is more complete. However, crediting @Sergiu Stici for their work on the original issue...

I'll be working on this issue today (after some $day_job meetings), so stay tuned for updates. ;)

Thanks,
-Derek

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new2.49 KB
new1.59 KB

Re-roll for the latest state of the 8.x-1.x branch. Basically, removing the hunks that were already fixed with:

There's some stuff in here I'm not totally thrilled with, but I wanted to upload this as-is to see if the bot is at least happy again.

dww’s picture

Status: Needs review » Needs work

D8 bot is happy, but this would fail on D9. Here are the local results:

% ./vendor/bin/phpunit -c core/phpunit.xml modules/contrib/fieldable_path/tests/src/
PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

Testing modules/contrib/fieldable_path/tests/src/
E                                                                   1 / 1 (100%)R

Time: 8.84 seconds, Memory: 4.00 MB

There was 1 error:

1) Drupal\Tests\fieldable_path\Functional\FieldablePathBasicTest::testNodePath
Exception: Drupal\Tests\BrowserTestBase::$defaultTheme is required. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.

/Applications/MAMP-common/htdocs/drupal-9_1/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:432
/Applications/MAMP-common/htdocs/drupal-9_1/core/tests/Drupal/Tests/BrowserTestBase.php:561
/Applications/MAMP-common/htdocs/drupal-9_1/core/tests/Drupal/Tests/BrowserTestBase.php:381
/Users/dww/drupal/fieldable_path/tests/src/Functional/FieldablePathBasicTest.php:59
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/Framework/TestResult.php:691

--

There was 1 risky test:

1) Drupal\Tests\fieldable_path\Functional\FieldablePathBasicTest::testNodePath
This test did not perform any assertions

/Applications/MAMP-common/htdocs/drupal-9_1/core/tests/Drupal/Tests/Listeners/DrupalListener.php:127
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/Framework/TestResult.php:423
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:360
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:171
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/Framework/TestSuite.php:601
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/Framework/TestSuite.php:601
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:633
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/TextUI/Command.php:204
/Applications/MAMP-common/htdocs/drupal-9_1/vendor/phpunit/phpunit/src/TextUI/Command.php:163

ERRORS!
Tests: 1, Assertions: 0, Errors: 1, Risky: 1.

THE ERROR HANDLER HAS CHANGED!

Remaining self deprecation notices (2)

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\fieldable_path\Functional\FieldablePathBasicTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\fieldable_path\Functional\FieldablePathBasicTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

Stay tuned, I'll have a new patch up in a bit...

dww’s picture

StatusFileSize
new3.41 KB
new997 bytes

Huzzah for tests! Even fixing the above errors, the D9 test still fails. The value is not getting set on new nodes, only when you edit existing nodes. I sprinkled some debugging into into the code, and lo, the D8 and D9 code paths aren't the same for this stuff. Drupal\fieldable_path\Plugin\Field\FieldType\FieldablePath::preSave() gets called twice in D8, and triggers the magic to save the value. In D9, on a new node, it's only called once, and that function doesn't end up doing anything.

I'm totally new to this module, so I'm going to have to figure out what's really going on. But at this point, we shouldn't keep changing the D9 tests, we should fix the module so that the code really works as tested... ;)

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new3.73 KB
new681 bytes

New day, new eyes. This port is going to take more effort than the rector bot can help us with. To keep the Git history clean and the scope reasonable, I'm going to commit the attached (assuming the bot agrees with my local results) as the best effort the bot (and its human assistants in this issue) could come up with. I'm going to open a separate ticket to actually make this work in D9 for everything from comment #9 and later...

  • dww committed b355cc2 on 8.x-1.x
    Issue #3140535 by valic, dww, Project Update Bot, el1_1el, Sergiu Stici...
dww’s picture

Assigned: dww » Unassigned
Status: Needs review » Fixed
Related issues: +#3217038: Port fieldable_path to Drupal 9

Okay, cool. Committed that and pushed to 8.x-1.x.
Moving everything else to #3217038: Port fieldable_path to Drupal 9.
Updated the project page "Drupal 9 is here" field to point over there.
Anyone who wants to keep helping with D9 porting is invited to participate over there.

Thanks, everyone!
-Derek

Status: Fixed » Closed (fixed)

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