Skip to content

Commit a9eaea4

Browse files
authored
[TASK] Add more tests for OutputFormat (#890)
1 parent c630248 commit a9eaea4

File tree

1 file changed

+140
-0
lines changed

1 file changed

+140
-0
lines changed

tests/Unit/OutputFormatTest.php

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,17 @@ public function nextLevelReturnsDifferentInstance(): void
826826
self::assertNotSame($this->subject, $this->subject->nextLevel());
827827
}
828828

829+
/**
830+
* @test
831+
*/
832+
public function nextLevelReturnsCloneWithSameProperties(): void
833+
{
834+
$space = ' ';
835+
$this->subject->setSpaceAfterRuleName($space);
836+
837+
self::assertSame($space, $this->subject->nextLevel()->getSpaceAfterRuleName());
838+
}
839+
829840
/**
830841
* @test
831842
*/
@@ -836,6 +847,16 @@ public function nextLevelReturnsInstanceWithIndentationLevelIncreasedByOne(): vo
836847
self::assertSame($originalIndentationLevel + 1, $this->subject->nextLevel()->getIndentationLevel());
837848
}
838849

850+
/**
851+
* @test
852+
*/
853+
public function nextLevelReturnsInstanceWithDifferentFormatterInstance(): void
854+
{
855+
$formatter = $this->subject->getFormatter();
856+
857+
self::assertNotSame($formatter, $this->subject->nextLevel()->getFormatter());
858+
}
859+
839860
/**
840861
* @test
841862
*/
@@ -885,4 +906,123 @@ public function createCalledTwoTimesReturnsDifferentInstances(): void
885906

886907
self::assertNotSame($firstCallResult, $secondCallResult);
887908
}
909+
910+
/**
911+
* @test
912+
*/
913+
public function createCompactReturnsNewOutputFormatInstance(): void
914+
{
915+
self::assertInstanceOf(OutputFormat::class, OutputFormat::createCompact());
916+
}
917+
918+
/**
919+
* @test
920+
*/
921+
public function createCompactCalledTwoTimesReturnsDifferentInstances(): void
922+
{
923+
$firstCallResult = OutputFormat::createCompact();
924+
$secondCallResult = OutputFormat::createCompact();
925+
926+
self::assertNotSame($firstCallResult, $secondCallResult);
927+
}
928+
929+
/**
930+
* @test
931+
*/
932+
public function createCompactReturnsInstanceWithSpaceBeforeRulesSetToEmptyString(): void
933+
{
934+
$newInstance = OutputFormat::createCompact();
935+
936+
self::assertSame('', $newInstance->getSpaceBeforeRules());
937+
}
938+
939+
/**
940+
* @test
941+
*/
942+
public function createCompactReturnsInstanceWithSpaceBetweenRulesSetToEmptyString(): void
943+
{
944+
$newInstance = OutputFormat::createCompact();
945+
946+
self::assertSame('', $newInstance->getSpaceBetweenRules());
947+
}
948+
949+
/**
950+
* @test
951+
*/
952+
public function createCompactReturnsInstanceWithSpaceAfterRulesSetToEmptyString(): void
953+
{
954+
$newInstance = OutputFormat::createCompact();
955+
956+
self::assertSame('', $newInstance->getSpaceAfterRules());
957+
}
958+
959+
/**
960+
* @test
961+
*/
962+
public function createCompactReturnsInstanceWithSpaceBeforeBlocksSetToEmptyString(): void
963+
{
964+
$newInstance = OutputFormat::createCompact();
965+
966+
self::assertSame('', $newInstance->getSpaceBeforeBlocks());
967+
}
968+
969+
/**
970+
* @test
971+
*/
972+
public function createCompactReturnsInstanceWithSpaceBetweenBlocksSetToEmptyString(): void
973+
{
974+
$newInstance = OutputFormat::createCompact();
975+
976+
self::assertSame('', $newInstance->getSpaceBetweenBlocks());
977+
}
978+
979+
/**
980+
* @test
981+
*/
982+
public function createCompactReturnsInstanceWithSpaceAfterBlocksSetToEmptyString(): void
983+
{
984+
$newInstance = OutputFormat::createCompact();
985+
986+
self::assertSame('', $newInstance->getSpaceAfterBlocks());
987+
}
988+
989+
/**
990+
* @test
991+
*/
992+
public function createCompactReturnsInstanceWithSpaceAfterRuleNameSetToEmptyString(): void
993+
{
994+
$newInstance = OutputFormat::createCompact();
995+
996+
self::assertSame('', $newInstance->getSpaceAfterRuleName());
997+
}
998+
999+
/**
1000+
* @test
1001+
*/
1002+
public function createCompactReturnsInstanceWithSpaceBeforeOpeningBraceSetToEmptyString(): void
1003+
{
1004+
$newInstance = OutputFormat::createCompact();
1005+
1006+
self::assertSame('', $newInstance->getSpaceBeforeOpeningBrace());
1007+
}
1008+
1009+
/**
1010+
* @test
1011+
*/
1012+
public function createCompactReturnsInstanceWithSpaceAfterSelectorSeparatorSetToEmptyString(): void
1013+
{
1014+
$newInstance = OutputFormat::createCompact();
1015+
1016+
self::assertSame('', $newInstance->getSpaceAfterSelectorSeparator());
1017+
}
1018+
1019+
/**
1020+
* @test
1021+
*/
1022+
public function createCompactReturnsInstanceWithRenderCommentsDisabled(): void
1023+
{
1024+
$newInstance = OutputFormat::createCompact();
1025+
1026+
self::assertFalse($newInstance->getRenderComments());
1027+
}
8881028
}

0 commit comments

Comments
 (0)