Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions tests/Unit/OutputFormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,17 @@ public function nextLevelReturnsDifferentInstance(): void
self::assertNotSame($this->subject, $this->subject->nextLevel());
}

/**
* @test
*/
public function nextLevelReturnsCloneWithSameProperties(): void
{
$space = ' ';
$this->subject->setSpaceAfterRuleName($space);

self::assertSame($space, $this->subject->nextLevel()->getSpaceAfterRuleName());
}

/**
* @test
*/
Expand All @@ -836,6 +847,16 @@ public function nextLevelReturnsInstanceWithIndentationLevelIncreasedByOne(): vo
self::assertSame($originalIndentationLevel + 1, $this->subject->nextLevel()->getIndentationLevel());
}

/**
* @test
*/
public function nextLevelReturnsInstanceWithDifferentFormatterInstance(): void
{
$formatter = $this->subject->getFormatter();

self::assertNotSame($formatter, $this->subject->nextLevel()->getFormatter());
}

/**
* @test
*/
Expand Down Expand Up @@ -885,4 +906,123 @@ public function createCalledTwoTimesReturnsDifferentInstances(): void

self::assertNotSame($firstCallResult, $secondCallResult);
}

/**
* @test
*/
public function createCompactReturnsNewOutputFormatInstance(): void
{
self::assertInstanceOf(OutputFormat::class, OutputFormat::createCompact());
}

/**
* @test
*/
public function createCompactCalledTwoTimesReturnsDifferentInstances(): void
{
$firstCallResult = OutputFormat::createCompact();
$secondCallResult = OutputFormat::createCompact();

self::assertNotSame($firstCallResult, $secondCallResult);
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceBeforeRulesSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceBeforeRules());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceBetweenRulesSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceBetweenRules());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceAfterRulesSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceAfterRules());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceBeforeBlocksSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceBeforeBlocks());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceBetweenBlocksSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceBetweenBlocks());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceAfterBlocksSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceAfterBlocks());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceAfterRuleNameSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceAfterRuleName());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceBeforeOpeningBraceSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceBeforeOpeningBrace());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithSpaceAfterSelectorSeparatorSetToEmptyString(): void
{
$newInstance = OutputFormat::createCompact();

self::assertSame('', $newInstance->getSpaceAfterSelectorSeparator());
}

/**
* @test
*/
public function createCompactReturnsInstanceWithRenderCommentsDisabled(): void
{
$newInstance = OutputFormat::createCompact();

self::assertFalse($newInstance->getRenderComments());
}
}