Skip to content

Commit 4a6d0e6

Browse files
authored
Merge pull request #278 from lloc/chore
Chore
2 parents b477253 + 0521ff2 commit 4a6d0e6

File tree

5 files changed

+28
-33
lines changed

5 files changed

+28
-33
lines changed

includes/MslsGetSet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public function reset() {
8181
}
8282

8383
/**
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.
8585
*
8686
* 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
8888
*
8989
* $obj->has_value( $temp )
9090
*

includes/MslsOptionsPost.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ public function get_postlink( $language ) {
5959

6060
/**
6161
* Get current link
62+
*
6263
* @return string
6364
*/
64-
public function get_current_link() {
65+
public function get_current_link(): string {
6566
return (string) get_permalink( $this->get_arg( 0, 0 ) );
6667
}
6768

tests/TestMslsOptionsPost.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,28 @@
88

99
class TestMslsOptionsPost extends MslsUnitTestCase {
1010

11-
public function get_test() {
11+
protected function setUp(): void {
12+
parent::setUp();
13+
1214
Functions\expect( 'get_option' )->once()->andReturn( [ 'de_DE' => 42 ] );
1315

14-
return new MslsOptionsPost();
16+
$this->test = new MslsOptionsPost();
1517
}
1618

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+
}
1922

20-
$obj = $this->get_test();
23+
public function test_get_postlink_post_is_null(): void {
24+
Functions\expect( 'get_post' )->once()->andReturnNull();
2125

22-
$this->assertIsSTring( $obj->get_postlink( 'de_DE' ) );
26+
$this->assertEquals( '', $this->test->get_postlink( 'de_DE' ) );
2327
}
2428

25-
function test_get_current_link_method() {
29+
public function test_get_current_link(): void {
2630
Functions\expect( 'get_permalink' )->once()->andReturn( 'https://example.org/a-post' );
2731

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() );
3133
}
3234

3335
}

tests/TestMslsOptionsQueryAuthor.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,20 @@
88

99
class TestMslsOptionsQueryAuthor extends MslsUnitTestCase {
1010

11-
function get_test() {
11+
protected function setUp(): void {
1212
Functions\expect( 'get_option' )->once()->andReturn( [ 'de_DE' => 42 ] );
1313

14-
return new MslsOptionsQueryAuthor();
14+
$this->test = new MslsOptionsQueryAuthor();
1515
}
1616

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' ) );
2119
}
2220

23-
function test_get_current_link_method() {
21+
public function test_get_current_link_method(): void {
2422
Functions\expect( 'get_author_posts_url' )->once()->andReturn( 'https://example.org/queried-author' );
2523

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() );
2925
}
3026

3127
}

tests/TestMslsOptionsQueryDay.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,20 @@
1111
*/
1212
class TestMslsOptionsQueryDay extends MslsUnitTestCase {
1313

14-
function get_test() {
14+
public function setUp(): void {
1515
Functions\expect( 'get_option' )->once()->andReturn( [ 'de_DE' => 42 ] );
1616

17-
return new MslsOptionsQueryDay();
17+
$this->test = new MslsOptionsQueryDay();
1818
}
1919

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' ) );
2422
}
2523

26-
function test_get_current_link_method() {
24+
public function test_get_current_link(): void {
2725
Functions\expect( 'get_day_link' )->once()->andReturn( 'https://example.org/queried-day' );
2826

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() );
3228
}
3329

3430
}

0 commit comments

Comments
 (0)