The test container should be used instead of calling \Drupal directly.
Issue fork easy_breadcrumb-3613131
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
Comment #3
loopduplicate commentedComment #4
csakiistvanComment #5
csakiistvanEnvironment
Prerequisites
drupal/easy_breadcrumb:2.x-devinstalled via Composer.vendor/bin/phpunit).\Drupalcalls in the test.Steps
tests/src/Functional/EasyBreadcrumbInstallUninstallTest.php: it resolves services through the static\Drupal::moduleHandler()and\Drupal::service()helpers instead of the test container.testInstallUninstallReinstall()now goes through$this->container->get()(module_handler,module_installer,config.factory) instead of the static\Drupalhelpers.ddev drush crExpected results
\Drupal::calls; all ten service lookups use the test container.phpcsreports no errors or warnings for the changed file.Actual results
Before the fix the test file contained ten static
\Drupal::moduleHandler()/\Drupal::service()calls and the test passed with 1 test and 11 assertions. After applying MR !178 the same test still passes with 1 test and 11 assertions, the static calls are gone (ten$this->container->get()lookups in their place), andphpcswith the Drupal and DrupalPractice standards is clean. The 17 deprecation notices reported by PHPUnit come from unrelated modules in the test site and appear identically before and after the change.Testing produced with the assistance of an LLM.
Comment #6
loopduplicate commentedrebased with Gitlab
Comment #8
loopduplicate commentedThanks @csakiistvan for the automated report. How can the rest of the Drupal community learn about your process for using AI to review tickets? Maybe you could show us on the AI Learner's channel/podcast? Just an idea.
Comment #10
loopduplicate commentedOh shoot, @csakiistvan, I didn't get your name into the commit message. I did update the contribution records so you get credit. I apologize for that. I'm a bit rusty with the process.
Comment #11
csakiistvanthank you for taking care of it @loopduplicate :)