Inline generateToken for clarity
The only thing Security::generateToken was providing was a default value for the $action, which created a pattern of using the same $action everywhere, which may not be the best way to go. Since it was essentially a wrapper for WP's built-in nonce functions, it seemed clearer to use those functions directly to be more explicit about how we're handling tokens. [MAILPOET-2030]
This commit is contained in:
committed by
Veljko V
parent
ed87d1cace
commit
fc1f3e6dc2
@ -73,11 +73,15 @@ class APITest extends \MailPoetTest {
|
||||
expect($api instanceof JSONAPI)->true();
|
||||
}
|
||||
);
|
||||
$wpStub = Stub::make(new WPFunctions, [
|
||||
'wpVerifyNonce' => asCallable(function() {
|
||||
return true;
|
||||
})]);
|
||||
$api = Stub::makeEmptyExcept(
|
||||
$this->api,
|
||||
'setupAjax',
|
||||
[
|
||||
'wp' => new WPFunctions,
|
||||
'wp' => $wpStub,
|
||||
'processRoute' => Stub::makeEmpty(new SuccessResponse),
|
||||
'settings' => $this->container->get(SettingsController::class),
|
||||
]
|
||||
|
Reference in New Issue
Block a user