-
Notifications
You must be signed in to change notification settings - Fork 144
[TASK] Add accessor tests for OutputFormat
(part 1)
#847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,307 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sabberworm\CSS\Tests\Unit; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sabberworm\CSS\OutputFormat; | ||
|
||
/** | ||
* @covers \Sabberworm\CSS\OutputFormat | ||
*/ | ||
final class OutputFormatTest extends TestCase | ||
{ | ||
/** | ||
* @var OutputFormat | ||
*/ | ||
private $subject; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->subject = new OutputFormat(); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getStringQuotingTypeInitiallyReturnsDoubleQuote(): void | ||
{ | ||
self::assertSame('"', $this->subject->getStringQuotingType()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setStringQuotingTypeSetsStringQuotingType(): void | ||
{ | ||
$value = "'"; | ||
$this->subject->setStringQuotingType($value); | ||
|
||
self::assertSame($value, $this->subject->getStringQuotingType()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setStringQuotingTypeProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setStringQuotingType('"')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getRGBHashNotationInitiallyReturnsTrue(): void | ||
{ | ||
self::assertTrue($this->subject->getRGBHashNotation()); | ||
} | ||
|
||
/** | ||
* @return array<string, array{0: bool}> | ||
*/ | ||
public static function provideBooleans(): array | ||
{ | ||
return [ | ||
'true' => [true], | ||
'false' => [false], | ||
]; | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
* @dataProvider provideBooleans | ||
*/ | ||
public function setRGBHashNotationSetsRGBHashNotation(bool $value): void | ||
{ | ||
$this->subject->setRGBHashNotation($value); | ||
|
||
self::assertSame($value, $this->subject->getRGBHashNotation()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setRGBHashNotationProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setRGBHashNotation(true)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSemicolonAfterLastRuleInitiallyReturnsTrue(): void | ||
{ | ||
self::assertTrue($this->subject->getSemicolonAfterLastRule()); | ||
} | ||
|
||
/** | ||
* @test | ||
* | ||
* @dataProvider provideBooleans | ||
*/ | ||
public function setSemicolonAfterLastRuleSetsSemicolonAfterLastRule(bool $value): void | ||
{ | ||
$this->subject->setSemicolonAfterLastRule($value); | ||
|
||
self::assertSame($value, $this->subject->getSemicolonAfterLastRule()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSemicolonAfterLastRuleProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSemicolonAfterLastRule(true)); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceAfterRuleNameInitiallyReturnsSingleSpace(): void | ||
{ | ||
self::assertSame(' ', $this->subject->getSpaceAfterRuleName()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceAfterRuleNameSetsSpaceAfterRuleName(): void | ||
{ | ||
$value = "\n"; | ||
$this->subject->setSpaceAfterRuleName($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceAfterRuleName()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceAfterRuleNameProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceAfterRuleName("\n")); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceBeforeRulesInitiallyReturnsEmptyString(): void | ||
{ | ||
self::assertSame('', $this->subject->getSpaceBeforeRules()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBeforeRulesSetsSpaceBeforeRules(): void | ||
{ | ||
$value = ' '; | ||
$this->subject->setSpaceBeforeRules($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceBeforeRules()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBeforeRulesProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceBeforeRules(' ')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceAfterRulesInitiallyReturnsEmptyString(): void | ||
{ | ||
self::assertSame('', $this->subject->getSpaceAfterRules()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceAfterRulesSetsSpaceAfterRules(): void | ||
{ | ||
$value = ' '; | ||
$this->subject->setSpaceAfterRules($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceAfterRules()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceAfterRulesProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceAfterRules(' ')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceBetweenRulesInitiallyReturnsEmptyString(): void | ||
{ | ||
self::assertSame('', $this->subject->getSpaceBetweenRules()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBetweenRulesSetsSpaceBetweenRules(): void | ||
{ | ||
$value = ' '; | ||
$this->subject->setSpaceBetweenRules($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceBetweenRules()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBetweenRulesProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceBetweenRules(' ')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceBeforeBlocksInitiallyReturnsEmptyString(): void | ||
{ | ||
self::assertSame('', $this->subject->getSpaceBeforeBlocks()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBeforeBlocksSetsSpaceBeforeBlocks(): void | ||
{ | ||
$value = ' '; | ||
$this->subject->setSpaceBeforeBlocks($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceBeforeBlocks()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBeforeBlocksProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceBeforeBlocks(' ')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceAfterBlocksInitiallyReturnsEmptyString(): void | ||
{ | ||
self::assertSame('', $this->subject->getSpaceAfterBlocks()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceAfterBlocksSetsSpaceAfterBlocks(): void | ||
{ | ||
$value = ' '; | ||
$this->subject->setSpaceAfterBlocks($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceAfterBlocks()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceAfterBlocksProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceAfterBlocks(' ')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getSpaceBetweenBlocksInitiallyReturnsNewline(): void | ||
{ | ||
self::assertSame("\n", $this->subject->getSpaceBetweenBlocks()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBetweenBlocksSetsSpaceBetweenBlocks(): void | ||
{ | ||
$value = ' '; | ||
$this->subject->setSpaceBetweenBlocks($value); | ||
|
||
self::assertSame($value, $this->subject->getSpaceBetweenBlocks()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function setSpaceBetweenBlocksProvidesFluentInterface(): void | ||
{ | ||
self::assertSame($this->subject, $this->subject->setSpaceBetweenBlocks(' ')); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.