| Total Complexity | 5 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class GreaterThanFactoryTest extends FactoryTestCase |
||
| 13 | { |
||
| 14 | private const VALUE = 10; |
||
| 15 | private const ORIGINAL_MESSAGE = 'This value should be greater than {{ compared_value }}.'; |
||
| 16 | private const TRANSLATED_MESSAGE = 'This value should be greater than '.self::VALUE.'.'; |
||
| 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\GreaterThan(['value' => static::VALUE, 'message' => static::TRANSLATED_MESSAGE]); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritdoc |
||
| 41 | */ |
||
| 42 | protected function getOriginalConstraint(): SymfonyConstraint |
||
| 43 | { |
||
| 44 | return new Assert\GreaterThan(static::VALUE); |
||
| 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 GreaterThanFactory(); |
||
| 61 | } |
||
| 63 |