Skip to content

Commit 310081a

Browse files
committed
Add tests with two comments for one rule.
Also add line-breaks in test methods to separate the three phases: - set up; - obtain results; - make assertions.
1 parent 11264f9 commit 310081a

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

tests/ParserTest.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,24 +1091,62 @@ public function flatCommentExtractingOneComment(): void
10911091
{
10921092
$parser = new Parser('div {/*Find Me!*/left:10px; text-align:left;}');
10931093
$document = $parser->parse();
1094+
10941095
$contents = $document->getContents();
10951096
$divRules = $contents[0]->getRules();
10961097
$comments = $divRules[0]->getComments();
1098+
10971099
self::assertCount(1, $comments);
10981100
self::assertSame('Find Me!', $comments[0]->getComment());
10991101
}
11001102

11011103
/**
11021104
* @test
11031105
*/
1104-
public function flatCommentExtractingTwoComments(): void
1106+
public function flatCommentExtractingTwoConjoinedCommentsForOneRule(): void
1107+
{
1108+
$parser = new Parser('div {/*Find Me!*//*Find Me Too!*/left:10px; text-align:left;}');
1109+
$document = $parser->parse();
1110+
1111+
$contents = $document->getContents();
1112+
$divRules = $contents[0]->getRules();
1113+
$comments = $divRules[0]->getComments();
1114+
1115+
self::assertCount(2, $comments);
1116+
self::assertSame('Find Me!', $comments[0]->getComment());
1117+
self::assertSame('Find Me Too!', $comments[1]->getComment());
1118+
}
1119+
1120+
/**
1121+
* @test
1122+
*/
1123+
public function flatCommentExtractingTwoSpaceSeparatedCommentsForOneRule(): void
1124+
{
1125+
$parser = new Parser('div { /*Find Me!*/ /*Find Me Too!*/ left:10px; text-align:left;}');
1126+
$document = $parser->parse();
1127+
1128+
$contents = $document->getContents();
1129+
$divRules = $contents[0]->getRules();
1130+
$comments = $divRules[0]->getComments();
1131+
1132+
self::assertCount(2, $comments);
1133+
self::assertSame('Find Me!', $comments[0]->getComment());
1134+
self::assertSame('Find Me Too!', $comments[1]->getComment());
1135+
}
1136+
1137+
/**
1138+
* @test
1139+
*/
1140+
public function flatCommentExtractingCommentsForTwoRules(): void
11051141
{
11061142
$parser = new Parser('div {/*Find Me!*/left:10px; /*Find Me Too!*/text-align:left;}');
11071143
$document = $parser->parse();
1144+
11081145
$contents = $document->getContents();
11091146
$divRules = $contents[0]->getRules();
11101147
$rule1Comments = $divRules[0]->getComments();
11111148
$rule2Comments = $divRules[1]->getComments();
1149+
11121150
self::assertCount(1, $rule1Comments);
11131151
self::assertCount(1, $rule2Comments);
11141152
self::assertSame('Find Me!', $rule1Comments[0]->getComment());

0 commit comments

Comments
 (0)