|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Sabberworm\CSS\Tests\Functional\Comment; |
| 6 | + |
| 7 | +use PHPUnit\Framework\TestCase; |
| 8 | +use Sabberworm\CSS\Comment\Comment; |
| 9 | +use Sabberworm\CSS\OutputFormat; |
| 10 | + |
| 11 | +/** |
| 12 | + * @covers \Sabberworm\CSS\Comment\Comment |
| 13 | + */ |
| 14 | +final class CommentTest extends TestCase |
| 15 | +{ |
| 16 | + /** |
| 17 | + * @test |
| 18 | + */ |
| 19 | + public function toStringRendersCommentEnclosedInCommentDelimiters(): void |
| 20 | + { |
| 21 | + $comment = 'There is no spoon.'; |
| 22 | + $subject = new Comment(); |
| 23 | + |
| 24 | + $subject->setComment($comment); |
| 25 | + |
| 26 | + self::assertSame('/*' . $comment . '*/', (string) $subject); |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * @test |
| 31 | + */ |
| 32 | + public function renderWithVirginOutputFormatRendersCommentEnclosedInCommentDelimiters(): void |
| 33 | + { |
| 34 | + $comment = 'There is no spoon.'; |
| 35 | + $subject = new Comment(); |
| 36 | + |
| 37 | + $subject->setComment($comment); |
| 38 | + |
| 39 | + self::assertSame('/*' . $comment . '*/', $subject->render(new OutputFormat())); |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * @test |
| 44 | + */ |
| 45 | + public function renderWithDefaultOutputFormatRendersCommentEnclosedInCommentDelimiters(): void |
| 46 | + { |
| 47 | + $comment = 'There is no spoon.'; |
| 48 | + $subject = new Comment(); |
| 49 | + |
| 50 | + $subject->setComment($comment); |
| 51 | + |
| 52 | + self::assertSame('/*' . $comment . '*/', $subject->render(OutputFormat::create())); |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * @test |
| 57 | + */ |
| 58 | + public function renderWithCompactOutputFormatRendersCommentEnclosedInCommentDelimiters(): void |
| 59 | + { |
| 60 | + $comment = 'There is no spoon.'; |
| 61 | + $subject = new Comment(); |
| 62 | + |
| 63 | + $subject->setComment($comment); |
| 64 | + |
| 65 | + self::assertSame('/*' . $comment . '*/', $subject->render(OutputFormat::createCompact())); |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * @test |
| 70 | + */ |
| 71 | + public function renderWithPrettyOutputFormatRendersCommentEnclosedInCommentDelimiters(): void |
| 72 | + { |
| 73 | + $comment = 'There is no spoon.'; |
| 74 | + $subject = new Comment(); |
| 75 | + |
| 76 | + $subject->setComment($comment); |
| 77 | + |
| 78 | + self::assertSame('/*' . $comment . '*/', $subject->render(OutputFormat::createPretty())); |
| 79 | + } |
| 80 | +} |
0 commit comments