From 2e40af1c5df5bf4c59ae8c084f48682bd27d9d8a Mon Sep 17 00:00:00 2001 From: Hans Mackowiak Date: Mon, 19 Aug 2024 12:46:07 +0200 Subject: [PATCH] ToStringTest: add test for invalid string --- tests/Form/DataTransformer/ToStringTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/Form/DataTransformer/ToStringTest.php b/tests/Form/DataTransformer/ToStringTest.php index 7a20a78..03d2fe7 100644 --- a/tests/Form/DataTransformer/ToStringTest.php +++ b/tests/Form/DataTransformer/ToStringTest.php @@ -12,9 +12,22 @@ class ToStringTest extends TestCase { public function testInvalidReverseTransform(): void + { + $this->invalidReverseTransform(new stdClass()); + } + + public function testInvalidCronReverseTransform(): void + { + $this->invalidReverseTransform("* * * * * *"); + } + + /** + * @param mixed $value + */ + protected function invalidReverseTransform($value): void { $transformer = new CronExpressionToStringTransformer(); $this->expectException(TransformationFailedException::class); - $transformer->reverseTransform(new stdClass()); + $transformer->reverseTransform($value); } }