| Total Complexity | 5 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class EmailFactoryTest extends FactoryTestCase |
||
| 13 | { |
||
| 14 | private const ORIGINAL_MESSAGE = 'This value is not a valid email address.'; |
||
| 15 | private const TRANSLATED_MESSAGE = 'This value is not a valid email address.'; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @inheritdoc |
||
| 19 | */ |
||
| 20 | protected function setUpCreate(): void |
||
| 21 | { |
||
| 22 | $this->translator |
||
| 23 | ->expects($this->once()) |
||
| 24 | ->method('trans') |
||
| 25 | ->with(static::ORIGINAL_MESSAGE) |
||
| 26 | ->willReturn(static::TRANSLATED_MESSAGE) |
||
| 27 | ; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @inheritdoc |
||
| 32 | */ |
||
| 33 | protected function getExpectedConstraint(): Constraint |
||
| 34 | { |
||
| 35 | return new ParsleyAssert\Email(['message' => static::TRANSLATED_MESSAGE]); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @inheritdoc |
||
| 40 | */ |
||
| 41 | protected function getOriginalConstraint(): SymfonyConstraint |
||
| 42 | { |
||
| 43 | return new Assert\Email(); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @inheritdoc |
||
| 48 | */ |
||
| 49 | protected function getUnsupportedConstraint(): SymfonyConstraint |
||
| 50 | { |
||
| 51 | return new Assert\Valid(); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @inheritdoc |
||
| 56 | */ |
||
| 57 | protected function createFactory(): FactoryInterface |
||
| 58 | { |
||
| 59 | return new EmailFactory(); |
||
| 60 | } |
||
| 62 |