Turning on phpstan evaluation of the test cases (see #3486525: Add declare(strict_types=1) to all test modules) 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.

Issue fork flag-3486527

Command icon 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

tr created an issue. See original summary.

tr’s picture

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 ...

ivnish’s picture

Assigned: Unassigned » ivnish
ivnish’s picture

Yes, the test with this function doesn't execute. Let's remove it

  • ivnish committed 82b1accf on 8.x-4.x
    Issue #3486527 by ivnish, tr: drupalPostAjaxForm() does not exist...
ivnish’s picture

Assigned: ivnish » Unassigned
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.