@@ -279,9 +279,8 @@ public function test_set_no_request() {
279
279
public function test_set_with_request () {
280
280
Functions \expect ( 'wp_is_post_revision ' )->once ()->andReturn ( false );
281
281
Functions \expect ( 'filter_has_var ' )->once ()->with ( INPUT_POST , MslsFields::FIELD_MSLS_NONCENAME )->andReturnTrue ();
282
- // Functions\expect( 'filter_input' )->once()->with( INPUT_POST, MslsFields::FIELD_MSLS_NONCENAME )->andReturn( 'random_nonce' );
283
- Functions \expect ( 'wp_verify_nonce ' )->once ()->andReturn ( true );
284
- Functions \expect ( 'current_user_can ' )->once ()->andReturn ( true );
282
+ Functions \expect ( 'wp_verify_nonce ' )->once ()->andReturnTrue ();
283
+ Functions \expect ( 'current_user_can ' )->once ()->andReturnTrue ();
285
284
Functions \expect ( 'get_option ' )->atLeast ()->once ()->andReturn ( array () );
286
285
Functions \expect ( 'delete_option ' )->atLeast ()->once ();
287
286
Functions \expect ( 'switch_to_blog ' )->once ();
@@ -290,4 +289,14 @@ public function test_set_with_request() {
290
289
$ this ->expectNotToPerformAssertions ();
291
290
$ this ->test ->set ( 13 );
292
291
}
292
+
293
+ public function test_set_with_request_current_user_cannot () {
294
+ Functions \expect ( 'wp_is_post_revision ' )->once ()->andReturn ( false );
295
+ Functions \expect ( 'filter_has_var ' )->once ()->with ( INPUT_POST , MslsFields::FIELD_MSLS_NONCENAME )->andReturnTrue ();
296
+ Functions \expect ( 'wp_verify_nonce ' )->once ()->andReturnTrue ();
297
+ Functions \expect ( 'current_user_can ' )->once ()->andReturnFalse ();
298
+
299
+ $ this ->expectNotToPerformAssertions ();
300
+ $ this ->test ->set ( 13 );
301
+ }
293
302
}
0 commit comments