Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#47439 closed defect (bug) (fixed)

wp-phpunit: go_to() does not unset current_screen

Reported by: mauteri's profile mauteri Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.3
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:


current_screen should be added to this array for unsetting:

As of now, if you set_current_screen (which is automatically done in WP_Ajax_UnitTestCase to set_current_screen( 'ajax' )) is_admin() will be true when you tell your test, for example, $this->go_to( '/' ); A test like this will fail:

$this->go_to( '/' ); // go to homepage
$this->assertFalse( is_admin() ); // fails because is_admin() is true

Attachments (1)

47439.patch (823 bytes) - added by mauteri 5 years ago.

Download all attachments as: .zip

Change History (4)

5 years ago

#1 @mauteri
5 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 45486:

Build/Test Tools: Add $current_screen to the list of globals to unset in WP_UnitTestCase_Base::go_to().

Props mauteri.
Fixes #47439.

Note: See TracTickets for help on using tickets.