Skip to content

Commit 98e82e3

Browse files
committed
Tests: add a case to cover issue #298
1 parent 44e31d1 commit 98e82e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unit/DocBlock/Tags/InvalidTagTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,19 @@ private function throwExceptionWithResourceArgument(): void
108108

109109
$function(fopen(__FILE__, 'r'));
110110
}
111+
112+
public function testCreationWithErrorFromEval(): void
113+
{
114+
$builder = static function (): InvalidArgumentException {
115+
return new InvalidArgumentException();
116+
};
117+
118+
$exception = eval('return $builder();');
119+
$tag = InvalidTag::create('Body', 'name')->withError($exception);
120+
121+
self::assertSame('name', $tag->getName());
122+
self::assertSame('@name Body', $tag->render());
123+
self::assertSame('Body', (string) $tag);
124+
self::assertSame($exception, $tag->getException());
125+
}
111126
}

0 commit comments

Comments
 (0)