1717use phpDocumentor \Reflection \DocBlock ;
1818use PHPUnit \Framework \TestCase ;
1919
20+ use function str_replace ;
21+
22+ use const PHP_EOL ;
23+
2024/**
2125 * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Serializer
2226 * @covers ::<private>
@@ -63,7 +67,7 @@ public function testReconstructsADocCommentFromADocBlock(): void
6367 ]
6468 );
6569
66- $ this ->assertSame ($ expected , $ fixture ->getDocComment ($ docBlock ));
70+ $ this ->assertSameString ($ expected , $ fixture ->getDocComment ($ docBlock ));
6771 }
6872
6973 /**
@@ -98,7 +102,7 @@ public function testAddPrefixToDocBlock(): void
98102 ]
99103 );
100104
101- $ this ->assertSame ($ expected , $ fixture ->getDocComment ($ docBlock ));
105+ $ this ->assertSameString ($ expected , $ fixture ->getDocComment ($ docBlock ));
102106 }
103107
104108 /**
@@ -133,7 +137,7 @@ public function testAddPrefixToDocBlockExceptFirstLine(): void
133137 ]
134138 );
135139
136- $ this ->assertSame ($ expected , $ fixture ->getDocComment ($ docBlock ));
140+ $ this ->assertSameString ($ expected , $ fixture ->getDocComment ($ docBlock ));
137141 }
138142
139143 /**
@@ -174,7 +178,7 @@ public function testWordwrapsAroundTheGivenAmountOfCharacters(): void
174178 ]
175179 );
176180
177- $ this ->assertSame ($ expected , $ fixture ->getDocComment ($ docBlock ));
181+ $ this ->assertSameString ($ expected , $ fixture ->getDocComment ($ docBlock ));
178182 }
179183
180184 /**
@@ -198,9 +202,16 @@ public function testNoExtraSpacesAfterTagRemoval(): void
198202 $ genericTag = new DocBlock \Tags \Generic ('unknown-tag ' );
199203
200204 $ docBlock = new DocBlock ('' , null , [$ genericTag ]);
201- $ this ->assertSame ($ expected , $ fixture ->getDocComment ($ docBlock ));
205+ $ this ->assertSameString ($ expected , $ fixture ->getDocComment ($ docBlock ));
202206
203207 $ docBlock ->removeTag ($ genericTag );
204- $ this ->assertSame ($ expectedAfterRemove , $ fixture ->getDocComment ($ docBlock ));
208+ $ this ->assertSameString ($ expectedAfterRemove , $ fixture ->getDocComment ($ docBlock ));
209+ }
210+
211+ public function assertSameString (string $ expected , string $ actual ): void
212+ {
213+ $ expected = str_replace (PHP_EOL , "\n" , $ expected );
214+
215+ self ::assertSame ($ expected , $ actual );
205216 }
206217}
0 commit comments