Category: unit-testing

Testing Controllers in Symfony 4.4 while using annotations

I’m facing a problem of testing my Controllers in Symfony 4.4 with FOSRestBundle & JMSSserializer. My controllers are pretty simple, usually containing nothing but call to another services, but I’m using ParamConverter, Serializer, Deserializer etc. I’m never sure if fields…

Mocking custom constraints in test where the constraints are used

I have a class that injects symfony’s validator (and other services) and then uses that validator with some custom constraints. These custom constraints have their own dependencies, including accessing the DB through Repository classes. I have successfully mocked the construction…

Symfony 4.4 deprecation warning for multiple clients in user test is deprecated, still present in documentation

Symfony version(s) affected: 4.4.0 Description After upgrading to Symfony 4.4.0 I got the following deprecation warning: Calling “SymfonyBundleFrameworkBundleTestWebTestCase::createClient()” while a kernel has been booted is deprecated since Symfony 4.4 and will throw in 5.0, ensure the kernel is shut down…