- π¬π§United Kingdom longwave UK
SimpleTest was deprecated and moved to contrib, closing as outdated.
Calls to \Drupal::
within core module test classes need to be replace so that they use the $this->container
fixture.
This issue is the child of parent issue: π± Use \Drupal consistently in tests Needs work
Replace \Drupal
with $this->container
in the simpletest module.
Use this grep to find occurrences of \Drupal within the test classes: git grep '\Drupal::' core/modules/simpletest/src/Tests/*
Add --name-only to find files: git grep --name-only '\Drupal::' core/modules/simpletest/src/Tests/*
Replace these usages of \Drupal with $this->container, except for some very special cases for the simpletest module.
In many instances, it's possible to get a reference to a service and then use it multiple times within a test method. This is preferable to calling $this->container
multiple times.
Do not turn the services into class properties of the test class. Access them within the test method only.
Run tests for your module locally to make sure they work and pass. You can use the Testing/Simpletest UI within the installed site, or use ./core/scripts/run-tests.sh, like this: php ./core/scripts/run-tests.sh simpletest
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
SimpleTest was deprecated and moved to contrib, closing as outdated.