File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -166,9 +166,7 @@ public function render(): void {
166
166
settings_fields ( 'msls ' );
167
167
do_settings_sections ( __CLASS__ );
168
168
169
- $ value = $ this ->options ->is_empty () ?
170
- __ ( 'Configure ' , 'multisite-language-switcher ' ) :
171
- __ ( 'Update ' , 'multisite-language-switcher ' );
169
+ $ value = $ this ->options ->is_empty () ? __ ( 'Configure ' , 'multisite-language-switcher ' ) : __ ( 'Update ' , 'multisite-language-switcher ' );
172
170
173
171
printf (
174
172
'<p class="submit"><input name="Submit" type="submit" class="button button-primary" value="%s" /></p></form></div> ' ,
Original file line number Diff line number Diff line change 10
10
11
11
class TestMslsAdmin extends MslsUnitTestCase {
12
12
13
+ /**
14
+ * @param array $users
15
+ * @return MslsAdmin
16
+ */
13
17
public function get_sut ( array $ users = array () ): MslsAdmin {
14
18
Functions \when ( 'get_option ' )->justReturn ( array () );
15
19
Functions \when ( 'update_option ' )->justReturn ( true );
@@ -348,8 +352,8 @@ function test_set_blog_language(): void {
348
352
function test_render (): void {
349
353
$ obj = $ this ->get_sut ();
350
354
351
- Functions \when ( 'settings_fields ' )->returnArg ();
352
- Functions \when ( 'do_settings_sections ' )->returnArg ();
355
+ Functions \expect ( 'settings_fields ' )->once ();
356
+ Functions \expect ( 'do_settings_sections ' )->once ();
353
357
354
358
$ this ->expectOutputRegex (
355
359
'/^<div class="wrap"><div class="icon32" id="icon-options-general"><br\/><\/div><h1>Multisite Language Switcher Options<\/h1>.*$/ '
@@ -402,4 +406,19 @@ function test_rewrites_section(): void {
402
406
403
407
$ this ->assertEquals ( 2 , $ obj ->rewrites_section () );
404
408
}
409
+
410
+ public function test_register (): void {
411
+ global $ wp_rewrite ;
412
+
413
+ Functions \expect ( 'register_setting ' )->once ();
414
+ Functions \expect ( 'add_settings_section ' )->times ( 4 );
415
+
416
+ $ wp_rewrite = \Mockery::mock ( '\WP_Rewrite ' );
417
+ $ wp_rewrite ->shouldReceive ( 'using_permalinks ' )->andReturnTrue ();
418
+
419
+ $ obj = $ this ->get_sut ();
420
+
421
+ $ this ->expectNotToPerformAssertions ();
422
+ $ obj ->register ();
423
+ }
405
424
}
You can’t perform that action at this time.
0 commit comments