Problem/Motivation
We are currently trying to remove dependencies between the PHPUnit-based testing system and the Simpletest module: #2863044: [plan] Remove simpletest dependencies from PHPUnit-based tests
This was accomplished for BrowserTestBase
in #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits
Let's do it for KernelTestBase
now.
KernelTestBase
uses these two classes from the simpletest namespace:
Drupal\simpletest\AssertContentTrait
Drupal\simpletest\TestServiceProvider
Drupal\simpletest\TestServiceProvider
itself has a dependency on Drupal\simpletest\RouteProvider
, which should also be moved.
Proposed resolution
Similar to #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits
- Break these dependencies by moving the traits and classes somewhere under core/tests.
- Ensure that we don't have a class loading problem within simpletest.
- Ensure BC for existing simpletest-based tests.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#21 | interdiff.txt | 6 KB | Mile23 |
#21 | 2907169_21.patch | 73.14 KB | Mile23 |
#20 | interdiff.txt | 1.23 KB | Mile23 |
#20 | 2907169_20.patch | 67.42 KB | Mile23 |
#8 | 2907169_8.patch | 67.32 KB | Mile23 |
Comments
Comment #2
dawehnerNice catch! Thank you for opening up this issue @Mile23! We are getting somewhere, one day :)
Comment #3
Mile23Since #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits is good for 8.4.x I filed this one for 8.4.x as well. Obviously maintainers may disagree.
This is a first pass to see what I missed.
We can update the change record from #2803621: Break BrowserTestBase & children dependency on Simpletest, deprecate stub BC traits to reflect the changes here, if 8.4.x is our target. Otherwise we'll need to add one for 8.5.x.
Comment #4
Mile23Comment #5
Mile23After 8.4.0 release, this should be in 8.5.x.
Comment #6
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-rolled.
Comment #7
Mile23No longer applies.
Comment #8
Mile23Re-rolled.
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedRevert status after random fail. Great work!
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commented+1 to RTBC.
Comment #13
Samvel CreditAttribution: Samvel at DrupalJedi commentedRun retest for 8.6.x
Comment #14
Mile23Once an issue is marked RTBC the last patch will be tested once daily.
Comment #16
Samvel CreditAttribution: Samvel at DrupalJedi commented@mile23 ok, i only want process it after deploy new drupal core version.
And i think it's not good process to set RTBC after deploy 8.6.x without test
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedUnrelated fails. See #2906317: Random fail due to problems with database.
Comment #18
Mile23Added change record: https://www.drupal.org/node/2943146
Comment #19
alexpottThese should have @see's to the change record to follow our policy. We can't add @trigger_error though because we're still using Simpletest tests.
Also in TestServiceProvider (now not part of Simpletest) we still have code referring to Simpletest and its namespace. I.e:
So we need to do something about \Drupal\simpletest\RouteProvider which has it's own @todo to move out of simpletest linking to #2672762: Move core/modules/simpletest/src/RouteProvider.php to the Drupal\Tests namespace/folder
Comment #20
Mile23OK, so we have a related of #2672762: Move core/modules/simpletest/src/RouteProvider.php to the Drupal\Tests namespace/folder Should we postpone on that or make it a follow-up?
There's also a @todo for #2911498: Make TestServiceProvider more readable (cleanup) which is lower priority but still worth doing.
This patch adds @see for the change record.
Even though this patch itself isn't very disruptive and is a test change eligible for 8.5.x, we also have #2672762: Move core/modules/simpletest/src/RouteProvider.php to the Drupal\Tests namespace/folder which is more disruptive and should be 8.6.x. So the extent to which they're related means we should target this issue to 8.6.x. Deprecation messages changed.
The
foreach
inTestServiceProvider::addRouteProvider()
comes from #2605684-26: Routing silently fails in kernel tests when there were more services being registered.Comment #21
Mile23OK, maybe #2672762: Move core/modules/simpletest/src/RouteProvider.php to the Drupal\Tests namespace/folder isn't that disruptive. Here's a patch rolling it in.
As you can see from above, the foreach is unneeded and left over from when there were multiple services being changed: #2605684-26: Routing silently fails in kernel tests
Comment #22
Mile23Updated IS and change record to include RouteProvider.
Marking #2672762: Move core/modules/simpletest/src/RouteProvider.php to the Drupal\Tests namespace/folder as a duplicate of this one.
Comment #23
dawehnerI doubt we treat them as real APIs, but sure, let's not overthink this.
Thank you for making this code more readable!
Comment #24
alexpottCommitted 0858e93 and pushed to 8.6.x. Thanks!