Issue Bug Closed

#100183Mock calls in DatabaseUserPermissionCheckTest do not match the called method's types

Oliver Klee 03/16/23, 09:40 updated 07/09/24, 12:46

Description

In \TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseUserPermissionCheckTest, two tests call BackendUserAuthentication::check with a string and and int, while the method’s contract states that it should be called with two strings. One of them must be wrong. :-)

The two tests are:

- addDataThrowsExceptionIfCommandIsEditTableIsPagesAndUserHasNoDoktypePermissions
- addDataAddsUserPermissionsOnPageIfTableIsPagesAndUserHasPagePermissions

Reviews 1

History 34

  1. Oliver Klee commented 04/20/23, 15:16

    Some more thoughts:

    The tests pass the “doktype” page data as an int value, while the method expects a string.

    We probably need to debug what type is passed when BackendUserAuthentication::check is called in production, and then either

    a) change the test data from int to string, and change string|int in the anonymous function to string, or
    b) change the BackendUserAuthentication::check and its called methods from string to string|int

  2. Gerrit Code Review pushed patch set 1 for main to change 78778 status New Under Review 04/20/23, 19:15

  3. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 04/21/23, 05:05

    Applied in changeset commit:f49ee3f6af8fca8e49a1ab7719df570c2bb1e0fe.

  4. Benni Mack changed status Resolved Closed 07/09/24, 12:46