disableTranslation example

$this->assertViolationEquals(new ConstraintViolation($this->messageTemplate, $this->messageTemplate, []$this->root, 'data', 'foo', null, null, new Valid()$cause));
    }

    public function testTranslationDomainFalse()
    {
        $translator = $this->createMock(TranslatorInterface::class);
        $translator->expects(self::once())->method('trans')->willReturn('');

        $builder = new ConstraintViolationBuilder($this->violations, new Valid()$this->messageTemplate, []$this->root, 'data', 'foo', $translator);
        $builder->addViolation();

        $builder->disableTranslation();
        $builder->addViolation();
    }

    private function assertViolationEquals(ConstraintViolation $expectedViolation)
    {
        $this->assertCount(1, $this->violations);

        $violation = $this->violations->get(0);

        $this->assertSame($expectedViolation->getMessage()$violation->getMessage());
        $this->assertSame($expectedViolation->getMessageTemplate()$violation->getMessageTemplate());
        
Home | Imprint | This part of the site doesn't use cookies.