16
16
*/
17
17
class ElementTest extends TestCase
18
18
{
19
- public function testCanSerializeValidElementToJson ()
19
+ public function testCanSerializeValidElementToJson (): void
20
20
{
21
21
$ element = $ this ->getMockElement ();
22
22
@@ -26,14 +26,14 @@ public function testCanSerializeValidElementToJson()
26
26
]);
27
27
}
28
28
29
- public function testThrowsErrorElementIsInvalid ()
29
+ public function testThrowsErrorElementIsInvalid (): void
30
30
{
31
31
$ this ->expectException (Exception::class);
32
32
$ element = $ this ->getMockElement (false );
33
33
$ this ->jsonEncode ($ element );
34
34
}
35
35
36
- public function testCanSetParentWithFluidInterfaceAndGetParentBack ()
36
+ public function testCanSetParentWithFluidInterfaceAndGetParentBack (): void
37
37
{
38
38
$ parent = $ this ->getMockElement ();
39
39
$ element = $ this ->getMockElement ();
@@ -42,14 +42,14 @@ public function testCanSetParentWithFluidInterfaceAndGetParentBack()
42
42
$ this ->assertSame ($ parent , $ element ->getParent ());
43
43
}
44
44
45
- public function testCanUseNewAsFactoryForChildClasses ()
45
+ public function testCanUseNewAsFactoryForChildClasses (): void
46
46
{
47
47
$ element = Section::new ();
48
48
$ this ->assertEquals (Type::SECTION , $ element ->getType ());
49
49
$ this ->assertInstanceOf (Section::class, $ element );
50
50
}
51
51
52
- public function testCanSetExtraFieldsForArbitraryData ()
52
+ public function testCanSetExtraFieldsForArbitraryData (): void
53
53
{
54
54
$ element = $ this ->getMockElement ();
55
55
@@ -62,7 +62,7 @@ public function testCanSetExtraFieldsForArbitraryData()
62
62
]);
63
63
}
64
64
65
- public function testCanTapIntoElementForChaining ()
65
+ public function testCanTapIntoElementForChaining (): void
66
66
{
67
67
$ element = $ this ->getMockElement ()->tap (function (Element $ e ) {
68
68
$ e ->setExtra ('fizz ' , 'buzz ' );
@@ -76,7 +76,7 @@ public function testCanTapIntoElementForChaining()
76
76
]);
77
77
}
78
78
79
- public function testCanConditionallyTapIntoElementForChaining ()
79
+ public function testCanConditionallyTapIntoElementForChaining (): void
80
80
{
81
81
$ callable = function (Element $ e ) {
82
82
$ e ->setExtra ('fizz ' , 'buzz ' );
@@ -100,8 +100,8 @@ public function testCanConditionallyTapIntoElementForChaining()
100
100
private function getMockElement (bool $ valid = true ): Element
101
101
{
102
102
return new class ($ valid ) extends Element {
103
- private $ text ;
104
- private $ valid ;
103
+ private string $ text ;
104
+ private bool $ valid ;
105
105
106
106
public function __construct (bool $ valid )
107
107
{
@@ -128,7 +128,7 @@ public function toArray(): array
128
128
};
129
129
}
130
130
131
- public function testHydration ()
131
+ public function testHydration (): void
132
132
{
133
133
$ beforeJson = <<<JSON
134
134
{
@@ -180,13 +180,13 @@ public function testHydration()
180
180
$ this ->assertJsonStringEqualsJsonString ($ beforeJson , $ afterJson );
181
181
}
182
182
183
- public function testFromJsonThrowsExceptionOnBadJson ()
183
+ public function testFromJsonThrowsExceptionOnBadJson (): void
184
184
{
185
185
$ this ->expectException (HydrationException::class);
186
186
Modal::fromJson ('{"foo":"Bar",} ' );
187
187
}
188
188
189
- public function testCanExportToJsonWithPrettyPrint ()
189
+ public function testCanExportToJsonWithPrettyPrint (): void
190
190
{
191
191
$ element = $ this ->getMockElement ();
192
192
$ json = $ element ->toJson (true );
0 commit comments