@@ -17,6 +17,19 @@ final class MarkdownFormatterTest extends TestCase
17
17
{
18
18
private MarkdownFormatter $ formatter ;
19
19
20
+ private function createSniff (): Sniff
21
+ {
22
+ return new Sniff (
23
+ 'Standard.Category.My ' ,
24
+ '' ,
25
+ [],
26
+ new UrlList ([]),
27
+ '' ,
28
+ [],
29
+ []
30
+ );
31
+ }
32
+
20
33
/** @test */
21
34
public function formatDescription (): void
22
35
{
@@ -30,16 +43,14 @@ public function formatDescription(): void
30
43
);
31
44
}
32
45
33
- private function createSniff (): Sniff
46
+ /** @test */
47
+ public function formatDescription_WithBlankString_ReturnBlankString (): void
34
48
{
35
- return new Sniff (
36
- 'Standard.Category.My ' ,
37
- '' ,
38
- [],
39
- new UrlList ([]),
49
+ self ::assertEquals (
40
50
'' ,
41
- [],
42
- []
51
+ $ this ->formatter ->formatDescription (
52
+ $ this ->createSniff ()->withDescription ('' )
53
+ )
43
54
);
44
55
}
45
56
@@ -58,6 +69,17 @@ public function formatDocblock(): void
58
69
);
59
70
}
60
71
72
+ /** @test */
73
+ public function formatDocblock_WithBlankString_ReturnBlankString (): void
74
+ {
75
+ self ::assertEquals (
76
+ '' ,
77
+ $ this ->formatter ->formatDocblock (
78
+ $ this ->createSniff ()->withDocblock ('' )
79
+ )
80
+ );
81
+ }
82
+
61
83
/** @test */
62
84
public function formatComparisons (): void
63
85
{
@@ -84,6 +106,17 @@ public function formatComparisons(): void
84
106
);
85
107
}
86
108
109
+ /** @test */
110
+ public function formatComparisons_WithEmptyList_ReturnBlankString (): void
111
+ {
112
+ self ::assertEquals (
113
+ '' ,
114
+ $ this ->formatter ->formatComparisons (
115
+ $ this ->createSniff ()->withDiffs ([])->getDiffs ()
116
+ )
117
+ );
118
+ }
119
+
87
120
/** @test */
88
121
public function formatPublicProperties (): void
89
122
{
@@ -103,6 +136,17 @@ public function formatPublicProperties(): void
103
136
);
104
137
}
105
138
139
+ /** @test */
140
+ public function formatPublicProperties_WithEmptyList_ReturnBlankString (): void
141
+ {
142
+ self ::assertEquals (
143
+ '' ,
144
+ $ this ->formatter ->formatPublicProperties (
145
+ $ this ->createSniff ()->withProperties ([])->getProperties ()
146
+ )
147
+ );
148
+ }
149
+
106
150
/** @test */
107
151
public function formatSeeAlso (): void
108
152
{
@@ -122,6 +166,17 @@ public function formatSeeAlso(): void
122
166
);
123
167
}
124
168
169
+ /** @test */
170
+ public function formatSeeAlso_WithEmptyList_ReturnBlankString (): void
171
+ {
172
+ self ::assertEquals (
173
+ '' ,
174
+ $ this ->formatter ->formatSeeAlso (
175
+ $ this ->createSniff ()->withUrls (new UrlList ([]))->getUrls ()
176
+ )
177
+ );
178
+ }
179
+
125
180
/** @test */
126
181
public function formatViolations (): void
127
182
{
@@ -164,6 +219,17 @@ public function formatViolations(): void
164
219
);
165
220
}
166
221
222
+ /** @test */
223
+ public function formatViolations_WithEmptyList_ReturnBlankString (): void
224
+ {
225
+ self ::assertEquals (
226
+ '' ,
227
+ $ this ->formatter ->formatViolations (
228
+ $ this ->createSniff ()->withViolations ([])->getViolations ()
229
+ )
230
+ );
231
+ }
232
+
167
233
protected function setUp (): void
168
234
{
169
235
$ this ->formatter = new MarkdownFormatter ();
0 commit comments