File tree Expand file tree Collapse file tree 5 files changed +28
-33
lines changed Expand file tree Collapse file tree 5 files changed +28
-33
lines changed Original file line number Diff line number Diff line change @@ -81,10 +81,10 @@ public function reset() {
81
81
}
82
82
83
83
/**
84
- * Checks if the array has an non empty item with the specified key name.
84
+ * Checks if the array has a non- empty item with the specified key name.
85
85
*
86
86
* This is method is similar to the overloaded __isset-method since
87
- * __set cleans empty properties but I use for example
87
+ * __set cleans empty properties, but I use for example
88
88
*
89
89
* $obj->has_value( $temp )
90
90
*
Original file line number Diff line number Diff line change @@ -59,9 +59,10 @@ public function get_postlink( $language ) {
59
59
60
60
/**
61
61
* Get current link
62
+ *
62
63
* @return string
63
64
*/
64
- public function get_current_link () {
65
+ public function get_current_link (): string {
65
66
return (string ) get_permalink ( $ this ->get_arg ( 0 , 0 ) );
66
67
}
67
68
Original file line number Diff line number Diff line change 8
8
9
9
class TestMslsOptionsPost extends MslsUnitTestCase {
10
10
11
- public function get_test () {
11
+ protected function setUp (): void {
12
+ parent ::setUp ();
13
+
12
14
Functions \expect ( 'get_option ' )->once ()->andReturn ( [ 'de_DE ' => 42 ] );
13
15
14
- return new MslsOptionsPost ();
16
+ $ this -> test = new MslsOptionsPost ();
15
17
}
16
18
17
- function test_get_postlink_method () {
18
- Functions \expect ( 'get_post ' )->once ()->andReturnNull ();
19
+ public function test_get_postlink_not_has_value () {
20
+ $ this ->assertEquals ( '' , $ this ->test ->get_postlink ( 'es_ES ' ) );
21
+ }
19
22
20
- $ obj = $ this ->get_test ();
23
+ public function test_get_postlink_post_is_null (): void {
24
+ Functions \expect ( 'get_post ' )->once ()->andReturnNull ();
21
25
22
- $ this ->assertIsSTring ( $ obj ->get_postlink ( 'de_DE ' ) );
26
+ $ this ->assertEquals ( '' , $ this -> test ->get_postlink ( 'de_DE ' ) );
23
27
}
24
28
25
- function test_get_current_link_method () {
29
+ public function test_get_current_link (): void {
26
30
Functions \expect ( 'get_permalink ' )->once ()->andReturn ( 'https://example.org/a-post ' );
27
31
28
- $ obj = $ this ->get_test ();
29
-
30
- $ this ->assertEquals ( 'https://example.org/a-post ' , $ obj ->get_current_link () );
32
+ $ this ->assertEquals ( 'https://example.org/a-post ' , $ this ->test ->get_current_link () );
31
33
}
32
34
33
35
}
Original file line number Diff line number Diff line change 8
8
9
9
class TestMslsOptionsQueryAuthor extends MslsUnitTestCase {
10
10
11
- function get_test () {
11
+ protected function setUp (): void {
12
12
Functions \expect ( 'get_option ' )->once ()->andReturn ( [ 'de_DE ' => 42 ] );
13
13
14
- return new MslsOptionsQueryAuthor ();
14
+ $ this -> test = new MslsOptionsQueryAuthor ();
15
15
}
16
16
17
- function test_has_value_method () {
18
- $ obj = $ this ->get_test ();
19
-
20
- $ this ->assertIsBool ( $ obj ->has_value ( 'de_DE ' ) );
17
+ public function test_has_value_method (): void {
18
+ $ this ->assertIsBool ( $ this ->test ->has_value ( 'de_DE ' ) );
21
19
}
22
20
23
- function test_get_current_link_method () {
21
+ public function test_get_current_link_method (): void {
24
22
Functions \expect ( 'get_author_posts_url ' )->once ()->andReturn ( 'https://example.org/queried-author ' );
25
23
26
- $ obj = $ this ->get_test ();
27
-
28
- $ this ->assertEquals ( 'https://example.org/queried-author ' , $ obj ->get_current_link () );
24
+ $ this ->assertEquals ( 'https://example.org/queried-author ' , $ this ->test ->get_current_link () );
29
25
}
30
26
31
27
}
Original file line number Diff line number Diff line change 11
11
*/
12
12
class TestMslsOptionsQueryDay extends MslsUnitTestCase {
13
13
14
- function get_test () {
14
+ public function setUp (): void {
15
15
Functions \expect ( 'get_option ' )->once ()->andReturn ( [ 'de_DE ' => 42 ] );
16
16
17
- return new MslsOptionsQueryDay ();
17
+ $ this -> test = new MslsOptionsQueryDay ();
18
18
}
19
19
20
- function test_has_value_method () {
21
- $ obj = $ this ->get_test ();
22
-
23
- $ this ->assertIsBool ( $ obj ->has_value ( 'de_DE ' ) );
20
+ public function test_has_value (): void {
21
+ $ this ->assertTrue ( $ this ->test ->has_value ( 'de_DE ' ) );
24
22
}
25
23
26
- function test_get_current_link_method () {
24
+ public function test_get_current_link (): void {
27
25
Functions \expect ( 'get_day_link ' )->once ()->andReturn ( 'https://example.org/queried-day ' );
28
26
29
- $ obj = $ this ->get_test ();
30
-
31
- $ this ->assertEquals ( 'https://example.org/queried-day ' , $ obj ->get_current_link () );
27
+ $ this ->assertEquals ( 'https://example.org/queried-day ' , $ this ->test ->get_current_link () );
32
28
}
33
29
34
30
}
You can’t perform that action at this time.
0 commit comments