Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
While trying to write a simpletest to check some path aliasing issues, I discovered that drupal_lookup_path()
breaks when called in a test.
Namely, it always returns NULL
. I've tracked down the culprit to current_path()
, which returns path/to/content
in the browser, but instead returns batch
when called from within Simpletest.
Since drupal_lookup_path() uses the output of current_path()
to generate the $cache[map]
variable that it uses to find and store the path alias, this prevents drupal_lookup_path()
from working in tests.
I have no idea how to fix it though.
Comments