Skip to content

Commit

Permalink
ToStringTest: add test for invalid string (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanmac authored Oct 23, 2024
1 parent 4ce73e3 commit 3b0280d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/Form/DataTransformer/ToStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 3b0280d

Please sign in to comment.