[wp-trac] [WordPress Trac] #47439: wp-phpunit: go_to() does not unset current_screen
WordPress Trac
noreply at wordpress.org
Fri May 31 00:41:16 UTC 2019
#47439: wp-phpunit: go_to() does not unset current_screen
------------------------------+-----------------------------
Reporter: mauteri | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version: trunk
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
`current_screen` should be added to this array for unsetting:
https://github.com/wp-phpunit/wp-phpunit/blob/master/includes/abstract-
testcase.php#L710
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
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47439>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list