Three out of our remaining 5 phpstan errors are because of this.

The problem is that RadioativityFunctionTestTrait uses the getSession() method.

Only Functional and FunctionalJavascript tests have sessions - Unit and Kernel tests don't. So getSession() is only defined on BrowserTestBase and not on UnitTestBase or KernelTestBase.

But we use the RadioativityFunctionTestTrait in three different Kernel tests. Although they are written so that getSession() never gets called, it is still included in the static analysis because it appears in the Trait.

The solution is to move the code that uses getSession() out of the Trait and into the base class for FunctionalJavascript testing, as that's the only place we use it.

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 committed bb16567d on 4.1.x
    Issue #3503246 by tr: phpstan: Call to an undefined method ::getSession...
tr’s picture

Status: Active » Fixed

That solved the phpstan issues without causing any new test failures. Committed.

Status: Fixed » Closed (fixed)

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