Found in #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7.

Problem/Motivation

ViewExecutableTest has mock expectation fails in PHPUnit8 due to callback return type should be bool and not string.
The callback return type is signed for PHPUnit 8, and it currently returns a string being the argument passed in - which is not necessary.

Proposed resolution

Use $this->anything() as expected argument in place of the callback.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 3102899-2.patch1.17 KBmondrake
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mondrake created an issue. See original summary.

mondrake’s picture

Status: Active » Needs review
FileSize
1.17 KB

Patch.

Lendude’s picture

Status: Needs review » Reviewed & tested by the community

This is good.

mondrake’s picture

I have some doubts on these tests... what's the purpose of looping through

     foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) {

to have

       $display->expects($this->atLeastOnce())
         ->method('setOption')
        ->with($this->anything(), [

? In the end, it will just pass if the method is only called once, but I suppose we expect at least to be called once per handler.

Note this is so already in HEAD, this is not related to the change here.

  • catch committed ed88513 on 9.0.x
    Issue #3102899 by mondrake: ViewExecutableTest uses a mocked argument...

  • catch committed 9df9496 on 8.9.x
    Issue #3102899 by mondrake: ViewExecutableTest uses a mocked argument...

  • catch committed 9fe9316 on 8.8.x
    Issue #3102899 by mondrake: ViewExecutableTest uses a mocked argument...
catch’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 9.0.x/8.9.x/8.8.x, thanks! @mondrake could you open a follow-up for the issue noticed in #4, i don't think we should fix it here but worth looking at it properly.

mondrake’s picture

Status: Fixed » Closed (fixed)

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