[wp-trac] [WordPress Trac] #56681: Failing unit tests on PHP 8.1 and 8.2

WordPress Trac noreply at wordpress.org
Mon Oct 3 16:36:21 UTC 2022


#56681: Failing unit tests on PHP 8.1 and 8.2
-------------------------------------------------+-------------------------
 Reporter:  desrosj                              |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  6.1
Component:  Build/Test Tools                     |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-patch has-unit-    |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:10 SergeyBiryukov]:
 > The test was added in [50717] and has to do with allowing authenticated
 users to read the contents of password protected posts if they have the
 `edit_post` meta capability for the post. As you've noted, the test could
 indeed be improved to check specifically for the expected result, which in
 this case appears to be `'This content is password protected.'` string, as
 the test creates a password protected post as an Editor and then tries to
 view it as a Contributor, which is (correctly) not allowed.

 Thinking about this some more, the test actually looks correct, as it
 specifically checks that the content of a password protected post created
 by an Editor is not viewable by a Contributor.

 While we could check for the `'This content is password protected.'`
 string instead, the test would fail if that string is ever updated.

 I think we can just add a comment here to clarify the assertion, see
 [attachment:"56681.diff"].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56681#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list