Skip to content

Commit

Permalink
work around ConstraintValidatorTestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 6, 2024
1 parent 5fe612c commit e89ae05
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Symfony\Cmf\Bundle\RoutingBundle\Validator\Constraints\RouteDefaults;
use Symfony\Cmf\Bundle\RoutingBundle\Validator\Constraints\RouteDefaultsTwigValidator;
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
use Symfony\Component\Validator\Test\ConstraintViolationAssertion;
use Twig\Loader\LoaderInterface;

class RouteDefaultsTwigValidatorTest extends ConstraintValidatorTestCase
Expand Down Expand Up @@ -66,7 +68,7 @@ public function testControllerPathViolation(): void

$this->validator->validate(['_controller' => 'NotExistingBundle:Foo:bar'], new RouteDefaults());

$this->buildViolation('Invalid controller')->assertRaised();
(new ConstraintViolationAssertion($this->context, 'Invalid controller', new NotNull()))->assertRaised();
}

public function testCorrectTemplate(): void
Expand Down Expand Up @@ -94,8 +96,9 @@ public function testTemplateViolation(): void
new RouteDefaults(['message' => 'my message'])
);

$this->buildViolation('my message')
(new ConstraintViolationAssertion($this->context, 'my message', new NotNull()))
->setParameter('%name%', 'NotExistingBundle:Foo:bar.html.twig')
->assertRaised();
->assertRaised()
;
}
}

0 comments on commit e89ae05

Please sign in to comment.