Skip to content

Commit f8e6219

Browse files
committed
[TASK] Move some tests for Comment to functional tests
Move the tests that rely on another class (`OutputFormat`) (or might in the future). Part of #757.
1 parent a5d22be commit f8e6219

File tree

3 files changed

+67
-27
lines changed

3 files changed

+67
-27
lines changed

tests/Functional/.gitkeep

Whitespace-only changes.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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 renderWithDefaultOutputFormatRendersCommentEnclosedInCommentDelimiters(): 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 renderWithCompactOutputFormatRendersCommentEnclosedInCommentDelimiters(): void
46+
{
47+
$comment = 'There is no spoon.';
48+
$subject = new Comment();
49+
50+
$subject->setComment($comment);
51+
52+
self::assertSame('/*' . $comment . '*/', $subject->render(new OutputFormat()));
53+
}
54+
55+
/**
56+
* @test
57+
*/
58+
public function renderWithPrettyOutputFormatRendersCommentEnclosedInCommentDelimiters(): void
59+
{
60+
$comment = 'There is no spoon.';
61+
$subject = new Comment();
62+
63+
$subject->setComment($comment);
64+
65+
self::assertSame('/*' . $comment . '*/', $subject->render(new OutputFormat()));
66+
}
67+
}

tests/Unit/Comment/CommentTest.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use PHPUnit\Framework\TestCase;
88
use Sabberworm\CSS\Comment\Comment;
9-
use Sabberworm\CSS\OutputFormat;
109
use Sabberworm\CSS\Renderable;
1110

1211
/**
@@ -78,30 +77,4 @@ public function getLineNoInitiallyReturnsLineNumberPassedToConstructor(): void
7877

7978
self::assertSame($lineNumber, $subject->getLineNo());
8079
}
81-
82-
/**
83-
* @test
84-
*/
85-
public function toStringRendersCommentEnclosedInCommentDelimiters(): void
86-
{
87-
$comment = 'There is no spoon.';
88-
$subject = new Comment();
89-
90-
$subject->setComment($comment);
91-
92-
self::assertSame('/*' . $comment . '*/', (string) $subject);
93-
}
94-
95-
/**
96-
* @test
97-
*/
98-
public function renderRendersCommentEnclosedInCommentDelimiters(): void
99-
{
100-
$comment = 'There is no spoon.';
101-
$subject = new Comment();
102-
103-
$subject->setComment($comment);
104-
105-
self::assertSame('/*' . $comment . '*/', $subject->render(new OutputFormat()));
106-
}
10780
}

0 commit comments

Comments
 (0)