drupalPostAjaxForm() does not exist anymore

Created on 10 November 2024, 3 months ago

Turning on phpstan evaluation of the test cases (see πŸ“Œ Add declare(strict_types=1) to all test modules Active ) reveals that we still have code in the tests that uses drupalPostAjaxForm(). This method was part of Simpletest and was removed from Drupal core more than 5 years ago by #2809161: Convert Javascript/AJAX testing to use JavascriptTestBase β†’

This method is called from LinkTypeFieldEntryTest::doFlagUiFieldPlugin() which appears to be a utility function for internal use in Flag tests (but it's not declared protected for some reason). However, this utility function is never called so in practice the non-existent drupalPostAjaxForm() never gets called either. That's why this problem only shows up with static analysis, and not in the PHPUnit test output.

This problem was pointed out years ago in #2751053: Convert Simpletests to PHPUnit β†’ but it seems to have been overlooked in the eventual commits.

The simplest thing would be to just delete doFlagUiFieldPlugin() entirely. My preference would be to first determine what that function was intended to test, and before deleting this ensure that Flag does have a WebDriver test that was ported from this Simpletest method at some point.

πŸ› Bug report
Status

Active

Version

4.0

Component

Flag core

Created by

πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tr
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    LinkTypeFieldEntryTest::doFlagUiFieldPlugin() was first created as LinkTypeFieldEntryTest::doFlagUIfieldPlugin() (different capitalization) back in 2016 by this issue: #2701503: Refactor test classes to take advantage of FlagTestBase. β†’ . While the method was declared, it wasn't used even back then.

    I'm posting this as documentation and to bring it back near the top of my to-do list. My next step will be to see where the code in that method was located in the commit prior to this, and see if it was in use or whether the refactoring just forgot to use it when it was put into the new function. Baby steps ...

Production build 0.71.5 2024