Problem/Motivation

Once Simpletest module is available in contrib, we can deprecate it in core. However if we just remove Simpletest from the code base in 9.x sites, it could break sites that have simpletest enabled for whatever reason.

Proposed resolution

In Drupal 9, have an update requirement to ensure the core simpletest module is not installed.

In Drupal 8, have a hook_requirements() runtime/install to notify users that the simpletest module is deprecated and they should uninstall / use the contrib version.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

The SimpleTest module (labeled Testing in the Drupal core user interface) has been deprecated in Drupal core. Developers are encouraged to run tests via run-tests.sh or the PHPUnit CLI, or to use the SimpleTest contributed module in Drupal 9.

Note that the final decision to deprecate SimpleTest still has some dependencies on the in-progress Drupal 9 issue so exact details of the deprecation may be revised.

Comments

catch created an issue. See original summary.

mile23’s picture

mile23’s picture

Status: Active » Postponed
catch’s picture

Issue summary: View changes
catch’s picture

Status: Postponed » Active

Thought about this some more and new proposal in the issue summary, this can probably have a patch on it for the 8.x part before there's a contrib module, although we'd need the contrib module to actually commit it, but unpostponing.

xjm’s picture

Priority: Normal » Major
mile23’s picture

Issue tags: +Needs change record
StatusFileSize
new664 bytes
new408.55 KB

This is two patches. One is for 8.8.x, and one is for 9.x.

The 9.x patch starts with @lendude’s patch from #3075490-38: Move simpletest module to contrib, and then adds hook_requirements().

The 8.8.x patch only adds hook_requirements() to the existing module with some explanation.

Todo: Figure out the language, add CR, link to it from hook_requirements().

mile23’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: 3084493_7_for_d9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new1.31 KB
new1.53 KB

Updated the text a bit, and we need to uninstall the simpletest module before running updates in update tests or they will be blocked.

Status: Needs review » Needs work

The last submitted patch, 11: 3084493-11.patch, failed testing. View results

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new1.57 KB
new2.75 KB

This should clear up some fails.

Status: Needs review » Needs work

The last submitted patch, 13: 3084493-13.patch, failed testing. View results

lendude’s picture

Status: Needs work » Needs review
StatusFileSize
new660 bytes
new2.79 KB

So we need to rebuild the container inside the test after uninstalling stuff.

lendude’s picture

Issue tags: -Needs change record

Added a CR, https://www.drupal.org/node/3091784, so now we just need to point to that in the requirements message.

lendude’s picture

StatusFileSize
new794 bytes
new2.83 KB

Added the ref to the CR.

catch’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Needs review » Reviewed & tested by the community

Now that we have a 9.x-compatible simpletest module in contrib, this is unblocked.

xjm’s picture

StatusFileSize
new2.83 KB
new917 bytes

Just grammar fixes.

mile23’s picture

Issue is targeted at 8.8.x, but the last patch ran against 8.9.x.

The patch applies to both, and to 9.0.x. I'm pretty sure the D9 part of this issue will require a different patch to remove everything but the hook_requirements() part. That should maybe be a follow-up since its such a different scope?

Adding an 8.8.x test to #19.

xjm’s picture

I think #3075490: Move simpletest module to contrib covers the scope for the 9.0.x-only patch. This would be committed first prior to the 8.8 beta; that other can be done any time prior to the 9.0 beta.

dww’s picture

Thanks to everyone working on this, and especially to those willing to maintain simpletest in contrib!

Patch mostly looks good. A few concerns:

A)

+++ b/core/modules/simpletest/simpletest.install
@@ -22,6 +22,12 @@
+    'value' => t('The Drupal core Simpletest module is deprecated for removal in Drupal 9. You will need to uninstall the module before continuing. You should use the contributed Simpletest module instead. See https://www.drupal.org/node/3091784.'),

Shall we link directly to the project page, too? Or we're intentionally only linking to the CR here?

B) Shouldn't we have some kind of official release for 8.x at https://www.drupal.org/project/simpletest before we do this? Right now, all that's available is 8.x-3.x-dev.

C) (Partially contradicting myself from point A): The simpletest project page could use some help:

  1. It says "Minimally maintained"
  2. The project is owned by a user named "BR0kEN" (that's funny and all, but a bit scary for people landing here). ;)
  3. The project description starts with talk of D6, then works through a few paragraphs of D7 stuff with "Simpletest is now in core!" with the only mention of D8 below the fold. Maybe we can purge the D6 cruft, re-write the D7 stuff, and move the D8 stuff to the top?
  4. It doesn't appear that @Lendude is listed as an official maintainer, which makes the "Maintainers for SimpleTest" block misleading. It appears that the last commit was 2 years ago, unless you know to click on the "View commits" link and understand the inner workings of git commit authorship and how that relates to d.o project nodes.
    Screenshot of Simpletest contrib project 'Maintainers' block

D) The CR is a bit confusing / incomplete:

The Simpletest module is only available in Drupal core to allow you to uninstall it. Any update will be blocked if you have the core version of the module installed. You will need to uninstall it before you can continue updating a site.

If you require the Simpletest module you are advised to use the contributed version.

Can we get clear instructions on how to do this? When can I install/enable the contrib version? Since they have the same name, wouldn't installing the contrib module also break updates? Which update(s) are broken/prevented? When/how is it safe to actually re-install the contrib version? etc.

Thanks again,
-Derek

catch’s picture

@dww

#22.A:

I think we should link to the change notice, there's a remote possibility that someone will create a new UI test runner or similar, and we can easily update the change record to say that but not the simpletest project node. Also in the change record we should probably direct people to simplytest.me, the phpunit cli runner and other alternatives.

#22.B:

For API deprecations I think we need a stable release in contrib, but the API deprecations for Simpletest have already happened with replacements in core, all that's left is a UI development tool which should never be installed on a production site, so in this case a dev release seems fine.

#22.D: the contrib version is only really needed in Drupal 9, the main thing with updates is that it shouldn't be installed on a site running updates anyway - can still be uninstalled/reinstalled.

catch’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new865 bytes
new2.78 KB

Here's an updated patch which makes the deprecation message slightly more broad.

Edit: updated the change record

dww’s picture

Re: #23:

Re: #22.A: Yup, a level of indirection is often a good thing. ;)

Re: #22B: Hrm, okay, fair enough. But I'd still feel better with *something*, but if it's just the UI test runner, yeah, cool. But I thought it also held the deprecated test base class (I forget what it's called) and some folks might still have a bunch of tests that they can't sink the time/$ into updating. I'm sure they'd appreciate at least an 8.x-3.0-alpha1 or something to target...

Re: #22D: Okay. When it's not 4am (and if no one beats me to it) I'll update the CR with that.

Re: #24: Generally agree with the generalizations. But we lost "You will need to uninstall the module before continuing." which seems like really important, concrete info that needs to be said in the status warning. Can we split the difference?

t('The Drupal core Simpletest module is deprecated for removal in Drupal 9. It should not be enabled on production sites. You will need to uninstall the module before continuing. See https://www.drupal.org/node/3091784 for alternatives.')

?

Thanks,
-Derek

catch’s picture

StatusFileSize
new868 bytes
new2.83 KB

I went for 'You will need to uninstall the module before updating' - because technically what we want them to do is to restore their old code base, uninstall there, then come back and run the updates.

But I thought it also held the deprecated test base class (I forget what it's called) and some folks might still have a bunch of tests that they can't sink the time/$ into updating.

So it does, but the issue that actually removes simpletest and all the bc layers from core is #3075490: Move simpletest module to contrib. That's the issue that affects developers, this issue affects people using the UI test runner. Even if we were to leave the UI test runner in core, the test classes are still deprecated already and since some time ago, and they're mostly run via run-tests.sh on DrupalCI at the moment.

We might want a tagged contrib release before the actual removal issue lands in 9.0.x for that reason, but I don't think it's an issue for this one which is just informing people of the plan.

alexpott’s picture

All the hooks provided by the module are already deprecated and use \Drupal::moduleHandler()->invokeAllDeprecated() so any contrib module leveraging them is already getting deprecations.

There's also the simpletest/drupal.simpletest library that we could deprecate. However I think that depending on the module and using the library is a very limited use-case. There are the routes too but I don't think anything will be depending on them.

One thing I've noticed is that this change prevents updating from 8.7.whatever to 8.8.0 (if this patch is applied). I think we should probably take a leaf out of the block_place module's deprecation patch and only run the deprecation requirement at runtime and perhaps consider changing it to a notice as well.

catch’s picture

StatusFileSize
new1.9 KB
new1.9 KB

Discussed briefly with @alexpott - let's make it a warning only during runtime, notice elsewhere. This means sites can update without special steps, and we don't need the test change.

Status: Needs review » Needs work

The last submitted patch, 28: 3084493-27.patch, failed testing. View results

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new787 bytes
new1.9 KB

s/REQUIREMENT_NOTICE/REQUIREMENT_INFO/

Status: Needs review » Needs work

The last submitted patch, 30: 3084493-30.patch, failed testing. View results

catch’s picture

Status: Needs work » Needs review

HEAD was broken.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Looks great to me.

dww’s picture

Status: Reviewed & tested by the community » Needs review

#28 and #30 lost the "fix" from #26. Seems accidental, not intentional.

Otherwise, agreed on all points.

Thanks!
-Derek

dww’s picture

StatusFileSize
new1.94 KB
new828 bytes

Since we want to see a clean bot run, anyway, this restores #26 on top of #30

amateescu’s picture

Status: Needs review » Reviewed & tested by the community

Thanks eagle-eyed @dww, I guess it's fine to get it back to RTBC now :)

dww’s picture

Sorry, sleep deprivation. ;) I now understand -- we no longer prevent you from running updates. Duh.

#30 is RTBC after all. Thanks/sorry!

-Derek

p.s. I canceled the test run for #35 on 8.9.x, but there seems to be no way to cancel https://www.drupal.org/pift-ci-job/1465930 since it's still queuing. That'd be really nice to allow...

catch’s picture

StatusFileSize
new1.9 KB

@dww no it didn't lose it, because #30 makes uninstalling before update unnecessary now the warning is only 'info' instead of warning. Re-uploading #30 for clarity.

(edit, cross post, but yes).

dww’s picture

Yup, thanks! Slowly waking up... :)

Re-hiding my patch + interdiff.

edit: and finally was able to cancel the testbot runs against #35

catch’s picture

So #3075490: Move simpletest module to contrib is tagged for product manager review because it removes the developer feature of running tests via the UI, however this is as much the 'decision' issue as that one is, so adding the tag here.

However both webchick and Gabor are off this week, meaning actually getting official on-issue sign off is impossible (although Dries has indicated by e-mail he's in favour of moving to contrib in principle).

Since the best time to get this in is before the 8.8.0-beta, I think we're better off doing that and sorting out product manager review before #3075490: Move simpletest module to contrib lands. If there's some blocker to #3075490: Move simpletest module to contrib landing (whether not actually getting product sign-off or some unforseen technical issue) we'd need to revert or extend to Drupal 10 the deprecation added here, but that is less disruptive than adding it into Drupal 8.9 or an 8.8 rc or patch release.

catch’s picture

Issue summary: View changes
xjm’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

I agree with #40. I've added the same note from the end of the CR to the release note for now. We can remove it if/when product management does sign off on the main issue.

+++ b/core/modules/simpletest/simpletest.install
@@ -22,6 +22,12 @@
+    'value' => t('The Drupal core Simpletest module is deprecated for removal in Drupal 9. It should not be enabled on production sites. See https://www.drupal.org/node/3091784 for alternatives.'),

So the name of the module in the user interface is actually "Testing". A less looped-in site owner might see "Simpletest" and have no idea what they need to do to resolve the warning.

Also, I don't think the message should make it sound as though there are alternatives for production sites?

xjm’s picture

We can say "The Testing module (SimpleTest)" or such. (Note casing on "SimpleTest".)

xjm’s picture

Issue summary: View changes
catch’s picture

What about 'Testing (SimpleTest)' and '.... alternatives for running tests during development' ?

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new956 bytes
new1.95 KB

Here is updated working as per #42
and #43 and #45

dww’s picture

StatusFileSize
new1.94 KB
new831 bytes

Here's a patch for this:

t('The Drupal core <em>SimpleTest</em> (SimpleTest) module is deprecated for removal in Drupal 9. It should not be enabled on production sites. See https://www.drupal.org/node/3091784 for alternative ways to run tests during development.')

Does that address all concerns?
Do we want "SimpleTest" in a placeholder so it can't be translated? Or is this better?

Thanks,
-Derek

edit: eeek, x-post. Oh well, I guess committers can pick which wording they prefer. ;)

p.s. I was trying to avoid double "for" -- "for alternatives for running..." which is why I went with "for alternative ways to run..."

xjm’s picture

#47 repeats "SimpleTest" twice, so let's use #46. @dww, want to RTBC it?

dww’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.94 KB
new886 bytes

Sorry folks, 4 hours of sleep. I should probably not do *anything* for Drupal today. :/

This fixes the double trouble.

RTBC. Committer discretion for this or #46. I think this is (slightly) better, but I don't trust myself at all right now. ;)

Thanks/sorry,
-Derek

dww’s picture

Title: Fully deprecate and prepare for removal simpletest module » Fully deprecate and prepare for removal of SimpleTest module

(slightly better title for the commit message)

xjm’s picture

Assigned: Unassigned » tedbow

So there's another problem that I was crossposting: The URL is just stuck in the string as plain text. It won't even be clickable because input filters don't run on translated strings. Even if it were clickable, it's not good accessibility to have a link text be a URL, rather than words meaningful out of context. I'd suggest:


The Drupal core <em>Testing</em> (SimpleTest) module is deprecated for removal in Drupal 9. It should not be enabled on production sites. Read <a href="https://www.drupal.org/node/3091784">The Drupal core SimpleTest module is deprecated</a> for alternative ways to run tests during development.

Explicitly assigning to Ted for less crossposts. ;)

tedbow’s picture

Assigned: tedbow » Unassigned
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1016 bytes
new2.02 KB

🤞

dww’s picture

1. I prefer @xjm's:
Read <a href="https://www.drupal.org/node/3091784">The Drupal core SimpleTest module is deprecated</a>
vs.
See <a href="https://www.drupal.org/node/3091784">the change record about the Testing module\'s deprecation</a>

2. I still prefer:
"... for alternative ways to run"
vs.
"...for alternatives for running"

I don't want to hold up progress, but I don't want to call #52 RTBC, either. :/

Sorry,
-Derek

tedbow’s picture

StatusFileSize
new2.01 KB
new1.06 KB

words are hard
🤞🤞🤞🤞🤞🤞🤞🤞🤞🤞

dww’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, thanks!

Meanwhile, updated the CR again now that the dust is settling in here:
https://www.drupal.org/node/3091784/revisions/view/11637799/11638010

Cheers,
-Derek

  • xjm committed 3117503 on 9.0.x
    Issue #3084493 by catch, Lendude, dww, tedbow, Mile23, xjm: Fully...

  • xjm committed 5c5c19e on 8.9.x
    Issue #3084493 by catch, Lendude, dww, tedbow, Mile23, xjm: Fully...

  • xjm committed 109ccc0 on 8.8.x
    Issue #3084493 by catch, Lendude, dww, tedbow, Mile23, xjm: Fully...
xjm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +8.8.0 release notes

Thanks @tedbow and @dww! I committed this without waiting for the final test run, since the same thing with slightly different words passed already, the clock is ticking on the beta release window, we're in a commit freeze anyway, and HEAD tests will prove that this passes.

Marking fixed; we'll reopen or file a followup if the product management decision in #3075490: Move simpletest module to contrib is different from what this issue expects. I'll also publish the CR.

dww’s picture

Yay, thanks!

@xjm: Re: "I'll also publish the CR." I already did. ;)

-Derek

lendude’s picture

Nice! Awesome job all!

Status: Fixed » Closed (fixed)

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