Skip to content

Commit 6057847

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

File tree

3 files changed

+80
-27
lines changed

3 files changed

+80
-27
lines changed

tests/Functional/.gitkeep

Whitespace-only changes.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
}

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)