Skip to content

Commit 5c440f3

Browse files
authored
[TASK] Add more tests for OutputFormat (#893)
1 parent 5e05197 commit 5c440f3

File tree

1 file changed

+141
-2
lines changed

1 file changed

+141
-2
lines changed

tests/Unit/OutputFormatTest.php

Lines changed: 141 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ public function getFormatterCalledTwoTimesReturnsSameInstance(): void
891891
/**
892892
* @test
893893
*/
894-
public function createReturnsNewOutputFormatInstance(): void
894+
public function createReturnsOutputFormatInstance(): void
895895
{
896896
self::assertInstanceOf(OutputFormat::class, OutputFormat::create());
897897
}
@@ -910,7 +910,7 @@ public function createCalledTwoTimesReturnsDifferentInstances(): void
910910
/**
911911
* @test
912912
*/
913-
public function createCompactReturnsNewOutputFormatInstance(): void
913+
public function createCompactReturnsOutputFormatInstance(): void
914914
{
915915
self::assertInstanceOf(OutputFormat::class, OutputFormat::createCompact());
916916
}
@@ -1016,6 +1016,16 @@ public function createCompactReturnsInstanceWithSpaceAfterSelectorSeparatorSetTo
10161016
self::assertSame('', $newInstance->getSpaceAfterSelectorSeparator());
10171017
}
10181018

1019+
/**
1020+
* @test
1021+
*/
1022+
public function createCompactReturnsInstanceWithSpaceAfterListArgumentSeparatorsSetToEmptyArray(): void
1023+
{
1024+
$newInstance = OutputFormat::createCompact();
1025+
1026+
self::assertSame([], $newInstance->getSpaceAfterListArgumentSeparators());
1027+
}
1028+
10191029
/**
10201030
* @test
10211031
*/
@@ -1025,4 +1035,133 @@ public function createCompactReturnsInstanceWithRenderCommentsDisabled(): void
10251035

10261036
self::assertFalse($newInstance->getRenderComments());
10271037
}
1038+
1039+
/**
1040+
* @test
1041+
*/
1042+
public function createPrettyReturnsOutputFormatInstance(): void
1043+
{
1044+
self::assertInstanceOf(OutputFormat::class, OutputFormat::createPretty());
1045+
}
1046+
1047+
/**
1048+
* @test
1049+
*/
1050+
public function createPrettyCalledTwoTimesReturnsDifferentInstances(): void
1051+
{
1052+
$firstCallResult = OutputFormat::createPretty();
1053+
$secondCallResult = OutputFormat::createPretty();
1054+
1055+
self::assertNotSame($firstCallResult, $secondCallResult);
1056+
}
1057+
1058+
/**
1059+
* @test
1060+
*/
1061+
public function createPrettyReturnsInstanceWithSpaceBeforeRulesSetToNewline(): void
1062+
{
1063+
$newInstance = OutputFormat::createPretty();
1064+
1065+
self::assertSame("\n", $newInstance->getSpaceBeforeRules());
1066+
}
1067+
1068+
/**
1069+
* @test
1070+
*/
1071+
public function createPrettyReturnsInstanceWithSpaceBetweenRulesSetToNewline(): void
1072+
{
1073+
$newInstance = OutputFormat::createPretty();
1074+
1075+
self::assertSame("\n", $newInstance->getSpaceBetweenRules());
1076+
}
1077+
1078+
/**
1079+
* @test
1080+
*/
1081+
public function createPrettyReturnsInstanceWithSpaceAfterRulesSetToNewline(): void
1082+
{
1083+
$newInstance = OutputFormat::createPretty();
1084+
1085+
self::assertSame("\n", $newInstance->getSpaceAfterRules());
1086+
}
1087+
1088+
/**
1089+
* @test
1090+
*/
1091+
public function createPrettyReturnsInstanceWithSpaceBeforeBlocksSetToNewline(): void
1092+
{
1093+
$newInstance = OutputFormat::createPretty();
1094+
1095+
self::assertSame("\n", $newInstance->getSpaceBeforeBlocks());
1096+
}
1097+
1098+
/**
1099+
* @test
1100+
*/
1101+
public function createPrettyReturnsInstanceWithSpaceBetweenBlocksSetToTwoNewlines(): void
1102+
{
1103+
$newInstance = OutputFormat::createPretty();
1104+
1105+
self::assertSame("\n\n", $newInstance->getSpaceBetweenBlocks());
1106+
}
1107+
1108+
/**
1109+
* @test
1110+
*/
1111+
public function createPrettyReturnsInstanceWithSpaceAfterBlocksSetToNewline(): void
1112+
{
1113+
$newInstance = OutputFormat::createPretty();
1114+
1115+
self::assertSame("\n", $newInstance->getSpaceAfterBlocks());
1116+
}
1117+
1118+
/**
1119+
* @test
1120+
*/
1121+
public function createPrettyReturnsInstanceWithSpaceAfterRuleNameSetToSpace(): void
1122+
{
1123+
$newInstance = OutputFormat::createPretty();
1124+
1125+
self::assertSame(' ', $newInstance->getSpaceAfterRuleName());
1126+
}
1127+
1128+
/**
1129+
* @test
1130+
*/
1131+
public function createPrettyReturnsInstanceWithSpaceBeforeOpeningBraceSetToSpace(): void
1132+
{
1133+
$newInstance = OutputFormat::createPretty();
1134+
1135+
self::assertSame(' ', $newInstance->getSpaceBeforeOpeningBrace());
1136+
}
1137+
1138+
/**
1139+
* @test
1140+
*/
1141+
public function createPrettyReturnsInstanceWithSpaceAfterSelectorSeparatorSetToSpace(): void
1142+
{
1143+
$newInstance = OutputFormat::createPretty();
1144+
1145+
self::assertSame(' ', $newInstance->getSpaceAfterSelectorSeparator());
1146+
}
1147+
1148+
/**
1149+
* @test
1150+
*/
1151+
public function createPrettyReturnsInstanceWithSpaceAfterListArgumentSeparatorsSetToSpaceForCommaOnly(): void
1152+
{
1153+
$newInstance = OutputFormat::createPretty();
1154+
1155+
self::assertSame([',' => ' '], $newInstance->getSpaceAfterListArgumentSeparators());
1156+
}
1157+
1158+
/**
1159+
* @test
1160+
*/
1161+
public function createPrettyReturnsInstanceWithRenderCommentsEnabled(): void
1162+
{
1163+
$newInstance = OutputFormat::createPretty();
1164+
1165+
self::assertTrue($newInstance->getRenderComments());
1166+
}
10281167
}

0 commit comments

Comments
 (0)