Skip to content

Commit a33f75c

Browse files
Add tests
1 parent 58e3044 commit a33f75c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/unit/TextUI/Configuration/Cli/BuilderTest.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
#[TestDox('CLI Options Parser')]
2222
final class BuilderTest extends TestCase
2323
{
24+
#[TestDox('argument')]
25+
public function testArguments(): void
26+
{
27+
$configuration = (new Builder)->fromParameters(['command', 'argument']);
28+
29+
$this->assertSame(['argument'], $configuration->arguments());
30+
}
31+
2432
#[TestDox('--colors')]
2533
public function testColorsImplicitAuto(): void
2634
{
@@ -1422,6 +1430,10 @@ public function testStopOnDeprecation(): void
14221430

14231431
$this->assertTrue($configuration->hasStopOnDeprecation());
14241432
$this->assertTrue($configuration->stopOnDeprecation());
1433+
1434+
$this->expectException(Exception::class);
1435+
1436+
$configuration->specificDeprecationToStopOn();
14251437
}
14261438

14271439
#[TestDox('--stop-on-deprecation=message')]
@@ -1626,6 +1638,26 @@ public function testTestDoxMayNotBeConfigured(): void
16261638
$configuration->testdoxPrinter();
16271639
}
16281640

1641+
#[TestDox('--testdox-summary')]
1642+
public function testTestDoxPrinterSummary(): void
1643+
{
1644+
$configuration = (new Builder)->fromParameters(['--testdox-summary']);
1645+
1646+
$this->assertTrue($configuration->hasTestDoxPrinterSummary());
1647+
$this->assertTrue($configuration->testdoxPrinterSummary());
1648+
}
1649+
1650+
public function testTestDoxPrinterSummaryMayNotBeConfigured(): void
1651+
{
1652+
$configuration = (new Builder)->fromParameters([]);
1653+
1654+
$this->assertFalse($configuration->hasTestDoxPrinterSummary());
1655+
1656+
$this->expectException(Exception::class);
1657+
1658+
$configuration->testdoxPrinterSummary();
1659+
}
1660+
16291661
#[TestDox('--testdox-html file')]
16301662
public function testTestDoxHtml(): void
16311663
{
@@ -2263,6 +2295,26 @@ public function testDebug(): void
22632295
$this->assertTrue($configuration->debug());
22642296
}
22652297

2298+
#[TestDox('--extension')]
2299+
public function testExtension(): void
2300+
{
2301+
$configuration = (new Builder)->fromParameters(['--extension', 'ExtensionClass']);
2302+
2303+
$this->assertTrue($configuration->hasExtensions());
2304+
$this->assertSame(['ExtensionClass'], $configuration->extensions());
2305+
}
2306+
2307+
public function testExtensionMayNotBeConfigured(): void
2308+
{
2309+
$configuration = (new Builder)->fromParameters([]);
2310+
2311+
$this->assertFalse($configuration->hasExtensions());
2312+
2313+
$this->expectException(Exception::class);
2314+
2315+
$configuration->extensions();
2316+
}
2317+
22662318
public function testInvalidOption(): void
22672319
{
22682320
$this->expectException(Exception::class);

0 commit comments

Comments
 (0)