Bulk patching with stubs()
stubs()
stubs()Functions\stubs(
[
'is_user_logged_in' => true,
'current_user_can' => false,
]
);Functions\stubs(
[
'is_user_logged_in' => true, // will return `true` as provided
'wp_get_current_user' => function () { // will return the WP_User mock
return \Mockery::mock(\WP_User::class);
},
'__' => null, // will return the 1st argument received
]
);Pre-defined stubs for escaping functions
Pre-defined stubs for translation functions
Gotcha for Functions\stubs
Functions\stubsFunctions that returns null
Functions that returns callbacks
Last updated