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