1515
1616use InvalidArgumentException ;
1717use phpDocumentor \Reflection \Fqsen ;
18+ use PHPUnit \Framework \Attributes \CoversClass ;
1819use PHPUnit \Framework \TestCase ;
1920
2021use function sprintf ;
2122
22- /**
23- * @coversDefaultClass Expression
24- * @covers ::__construct
25- * @covers ::<private>
26- */
23+ #[CoversClass(Expression::class)]
2724final class ExpressionTest extends TestCase
2825{
2926 private const EXAMPLE_FQSEN = '\\' . self ::class;
3027 private const EXAMPLE_FQSEN_PLACEHOLDER = '{{ PHPDOC0450ed2a7bac1efcf0c13b6560767954 }} ' ;
3128
32- /** @covers ::generatePlaceholder */
3329 public function testGeneratingPlaceholder (): void
3430 {
3531 $ placeholder = Expression::generatePlaceholder (self ::EXAMPLE_FQSEN );
3632
3733 self ::assertSame (self ::EXAMPLE_FQSEN_PLACEHOLDER , $ placeholder );
3834 }
3935
40- /** @covers ::generatePlaceholder */
4136 public function testGeneratingPlaceholderErrorsUponPassingAnEmptyName (): void
4237 {
4338 $ this ->expectException (InvalidArgumentException::class);
4439
4540 Expression::generatePlaceholder ('' );
4641 }
4742
48- /** @covers ::__construct */
4943 public function testExpressionTemplateCannotBeEmpty (): void
5044 {
5145 $ this ->expectException (InvalidArgumentException::class);
5246
5347 new Expression ('' , []);
5448 }
5549
56- /** @covers ::__construct */
5750 public function testPartsShouldContainFqsensOrTypes (): void
5851 {
5952 $ this ->expectException (InvalidArgumentException::class);
6053
6154 new Expression ('This is an expression ' , [self ::EXAMPLE_FQSEN_PLACEHOLDER => self ::EXAMPLE_FQSEN ]);
6255 }
6356
64- /**
65- * @covers ::__construct
66- * @covers ::getExpression
67- */
6857 public function testGetExpressionTemplateString (): void
6958 {
7059 $ expressionTemplate = sprintf ('This is an %s expression ' , self ::EXAMPLE_FQSEN_PLACEHOLDER );
@@ -76,10 +65,6 @@ public function testGetExpressionTemplateString(): void
7665 self ::assertSame ($ expressionTemplate , $ result );
7766 }
7867
79- /**
80- * @covers ::__construct
81- * @covers ::getParts
82- */
8368 public function testGetExtractedParts (): void
8469 {
8570 $ expressionTemplate = sprintf ('This is an %s expression ' , self ::EXAMPLE_FQSEN_PLACEHOLDER );
@@ -91,7 +76,6 @@ public function testGetExtractedParts(): void
9176 self ::assertSame ($ parts , $ result );
9277 }
9378
94- /** @covers ::__toString */
9579 public function testReplacePlaceholdersWhenCastingToString (): void
9680 {
9781 $ expressionTemplate = sprintf ('This is an %s expression ' , self ::EXAMPLE_FQSEN_PLACEHOLDER );
@@ -103,7 +87,6 @@ public function testReplacePlaceholdersWhenCastingToString(): void
10387 self ::assertSame (sprintf ('This is an %s expression ' , self ::EXAMPLE_FQSEN ), $ result );
10488 }
10589
106- /** @covers ::render */
10790 public function testRenderingExpressionWithoutOverridesIsTheSameAsWhenCastingToString (): void
10891 {
10992 $ expressionTemplate = sprintf ('This is an %s expression ' , self ::EXAMPLE_FQSEN_PLACEHOLDER );
@@ -115,7 +98,6 @@ public function testRenderingExpressionWithoutOverridesIsTheSameAsWhenCastingToS
11598 self ::assertSame ((string ) $ expression , $ result );
11699 }
117100
118- /** @covers ::render */
119101 public function testOverridePartsWhenRenderingExpression (): void
120102 {
121103 $ replacement = 'ExpressionTest ' ;
0 commit comments