@@ -377,14 +377,46 @@ public function removeLastSemicolonWithSemicolonAfterLastRuleDisabledRemovesLast
377
377
self ::assertSame ($ expected , $ result );
378
378
}
379
379
380
+ /**
381
+ * @test
382
+ */
383
+ public function commentsWithEmptyCommentableAndRenderCommentsDisabledDoesNotReturnSpaceBetweenBlocks (): void
384
+ {
385
+ $ this ->outputFormat ->setRenderComments (false );
386
+ $ spaceBetweenBlocks = ' between-space ' ;
387
+ $ this ->outputFormat ->setSpaceBetweenBlocks ($ spaceBetweenBlocks );
388
+
389
+ $ commentable = $ this ->createMock (Commentable::class);
390
+ $ commentable ->method ('getComments ' )->willReturn ([]);
391
+
392
+ $ result = $ this ->subject ->comments ($ commentable );
393
+
394
+ self ::assertStringNotContainsString ($ spaceBetweenBlocks , $ result );
395
+ }
396
+
397
+ /**
398
+ * @test
399
+ */
400
+ public function commentsWithEmptyCommentableAndRenderCommentsDisabledDoesNotReturnSpaceAfterBlocks (): void
401
+ {
402
+ $ this ->outputFormat ->setRenderComments (false );
403
+ $ spaceAfterBlocks = ' after-space ' ;
404
+ $ this ->outputFormat ->setSpaceAfterBlocks ($ spaceAfterBlocks );
405
+
406
+ $ commentable = $ this ->createMock (Commentable::class);
407
+ $ commentable ->method ('getComments ' )->willReturn ([]);
408
+
409
+ $ result = $ this ->subject ->comments ($ commentable );
410
+
411
+ self ::assertStringNotContainsString ($ spaceAfterBlocks , $ result );
412
+ }
413
+
380
414
/**
381
415
* @test
382
416
*/
383
417
public function commentsWithEmptyCommentableAndRenderCommentsDisabledReturnsEmptyString (): void
384
418
{
385
419
$ this ->outputFormat ->setRenderComments (false );
386
- $ this ->outputFormat ->setSpaceBetweenBlocks (' between-space ' );
387
- $ this ->outputFormat ->setSpaceAfterBlocks (' after-space ' );
388
420
389
421
$ commentable = $ this ->createMock (Commentable::class);
390
422
$ commentable ->method ('getComments ' )->willReturn ([]);
@@ -394,14 +426,46 @@ public function commentsWithEmptyCommentableAndRenderCommentsDisabledReturnsEmpt
394
426
self ::assertSame ('' , $ result );
395
427
}
396
428
429
+ /**
430
+ * @test
431
+ */
432
+ public function commentsWithEmptyCommentableAndRenderCommentsEnabledDoesNotReturnSpaceBetweenBlocks (): void
433
+ {
434
+ $ this ->outputFormat ->setRenderComments (true );
435
+ $ spaceBetweenBlocks = ' between-space ' ;
436
+ $ this ->outputFormat ->setSpaceBetweenBlocks ($ spaceBetweenBlocks );
437
+
438
+ $ commentable = $ this ->createMock (Commentable::class);
439
+ $ commentable ->method ('getComments ' )->willReturn ([]);
440
+
441
+ $ result = $ this ->subject ->comments ($ commentable );
442
+
443
+ self ::assertStringNotContainsString ($ spaceBetweenBlocks , $ result );
444
+ }
445
+
446
+ /**
447
+ * @test
448
+ */
449
+ public function commentsWithEmptyCommentableAndRenderCommentsEnabledDoesNotReturnSpaceAfterBlocks (): void
450
+ {
451
+ $ this ->outputFormat ->setRenderComments (true );
452
+ $ spaceAfterBlocks = ' after-space ' ;
453
+ $ this ->outputFormat ->setSpaceAfterBlocks ($ spaceAfterBlocks );
454
+
455
+ $ commentable = $ this ->createMock (Commentable::class);
456
+ $ commentable ->method ('getComments ' )->willReturn ([]);
457
+
458
+ $ result = $ this ->subject ->comments ($ commentable );
459
+
460
+ self ::assertStringNotContainsString ($ spaceAfterBlocks , $ result );
461
+ }
462
+
397
463
/**
398
464
* @test
399
465
*/
400
466
public function commentsWithEmptyCommentableAndRenderCommentsEnabledReturnsEmptyString (): void
401
467
{
402
468
$ this ->outputFormat ->setRenderComments (true );
403
- $ this ->outputFormat ->setSpaceBetweenBlocks (' between-space ' );
404
- $ this ->outputFormat ->setSpaceAfterBlocks (' after-space ' );
405
469
406
470
$ commentable = $ this ->createMock (Commentable::class);
407
471
$ commentable ->method ('getComments ' )->willReturn ([]);
@@ -417,8 +481,6 @@ public function commentsWithEmptyCommentableAndRenderCommentsEnabledReturnsEmpty
417
481
public function commentsWithCommentableWithOneCommentAndRenderCommentsDisabledReturnsEmptyString (): void
418
482
{
419
483
$ this ->outputFormat ->setRenderComments (false );
420
- $ this ->outputFormat ->setSpaceBetweenBlocks (' between-space ' );
421
- $ this ->outputFormat ->setSpaceAfterBlocks (' after-space ' );
422
484
423
485
$ commentText = 'I am a teapot. ' ;
424
486
$ comment = new Comment ($ commentText );
0 commit comments