Skip to content

Commit d06d72b

Browse files
committed
[TASK] Add some tests for OutputFormatter
Part of #757
1 parent 631c07e commit d06d72b

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

tests/Unit/OutputFormatterTest.php

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Sabberworm\CSS\Tests\Unit;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Sabberworm\CSS\OutputFormat;
9+
use Sabberworm\CSS\OutputFormatter;
10+
11+
/**
12+
* @covers \Sabberworm\CSS\OutputFormatter
13+
*/
14+
final class OutputFormatterTest extends TestCase
15+
{
16+
/**
17+
* @var OutputFormatter
18+
*/
19+
private $subject;
20+
21+
/**
22+
* @var OutputFormat
23+
*/
24+
private $outputFormat;
25+
26+
protected function setUp(): void
27+
{
28+
$this->outputFormat = new OutputFormat();
29+
$this->subject = new OutputFormatter($this->outputFormat);
30+
}
31+
32+
/**
33+
* @test
34+
*/
35+
public function spaceAfterRuleNameReturnsSpaceAfterRuleNameFromOutputFormat(): void
36+
{
37+
$space = ' ';
38+
$this->outputFormat->setSpaceAfterRuleName($space);
39+
40+
self::assertSame($space, $this->subject->spaceAfterRuleName());
41+
}
42+
43+
/**
44+
* @test
45+
*/
46+
public function spaceBeforeRulesReturnsSpaceBeforeRulesFromOutputFormat(): void
47+
{
48+
$space = ' ';
49+
$this->outputFormat->setSpaceBeforeRules($space);
50+
51+
self::assertSame($space, $this->subject->spaceBeforeRules());
52+
}
53+
54+
/**
55+
* @test
56+
*/
57+
public function spaceAfterRulesReturnsSpaceAfterRulesFromOutputFormat(): void
58+
{
59+
$space = ' ';
60+
$this->outputFormat->setSpaceAfterRules($space);
61+
62+
self::assertSame($space, $this->subject->spaceAfterRules());
63+
}
64+
65+
/**
66+
* @test
67+
*/
68+
public function spaceBetweenRulesReturnsSpaceBetweenRulesFromOutputFormat(): void
69+
{
70+
$space = ' ';
71+
$this->outputFormat->setSpaceBetweenRules($space);
72+
73+
self::assertSame($space, $this->subject->spaceBetweenRules());
74+
}
75+
76+
/**
77+
* @test
78+
*/
79+
public function spaceBeforeBlocksReturnsSpaceBeforeBlocksFromOutputFormat(): void
80+
{
81+
$space = ' ';
82+
$this->outputFormat->setSpaceBeforeBlocks($space);
83+
84+
self::assertSame($space, $this->subject->spaceBeforeBlocks());
85+
}
86+
87+
/**
88+
* @test
89+
*/
90+
public function spaceAfterBlocksReturnsSpaceAfterBlocksFromOutputFormat(): void
91+
{
92+
$space = ' ';
93+
$this->outputFormat->setSpaceAfterBlocks($space);
94+
95+
self::assertSame($space, $this->subject->spaceAfterBlocks());
96+
}
97+
98+
/**
99+
* @test
100+
*/
101+
public function spaceBetweenBlocksReturnsSpaceBetweenBlocksFromOutputFormat(): void
102+
{
103+
$space = ' ';
104+
$this->outputFormat->setSpaceBetweenBlocks($space);
105+
106+
self::assertSame($space, $this->subject->spaceBetweenBlocks());
107+
}
108+
109+
/**
110+
* @test
111+
*/
112+
public function spaceBeforeSelectorSeparatorReturnsSpaceBeforeSelectorSeparatorFromOutputFormat(): void
113+
{
114+
$space = ' ';
115+
$this->outputFormat->setSpaceBeforeSelectorSeparator($space);
116+
117+
self::assertSame($space, $this->subject->spaceBeforeSelectorSeparator());
118+
}
119+
120+
/**
121+
* @test
122+
*/
123+
public function spaceAfterSelectorSeparatorReturnsSpaceAfterSelectorSeparatorFromOutputFormat(): void
124+
{
125+
$space = ' ';
126+
$this->outputFormat->setSpaceAfterSelectorSeparator($space);
127+
128+
self::assertSame($space, $this->subject->spaceAfterSelectorSeparator());
129+
}
130+
}

0 commit comments

Comments
 (0)