php - How to enable "dev" bundles so that they are available during testing, on the "test" environment?
Get the solution ↓↓↓I was configuring environment of a symfony 5 project, and while testing the test environment (APP_ENV = test) there was an exception because it couldn't find the web-profiler bundle. Which is normal since it's installed by composer with a require --dev. Which is kinda a dilemma since even though I currently don't need this bundle in a test env, I technically might.
Worse : I need the doctrine fixture bundle in dev and in test; but to have it in test too, I'd have to "remove the --dev" option, therefore having it in production too, which is pretty bad.
So I'm wondering what is the common way to handle that issue? I guess it's a common problem.
Answer
Solution:
Simply enable the bundles for multiple environments:
For example:
// config/bundles.php
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class =>
[
'dev' => true,
'test' => true
],
You still install (require
) the packages with the--dev
flag, which simply means that they are not installed when you create the installable version for production (composer install --no-dev
).
If you need dev dependencies while testing, then the "testing" environment can't be identical to production. Either you install those dependencies on production but leave them disabled them onbundles.php
, or you accept that there are going to be slight differences in these environments.
Practically, they are never going to be identical. For example, you require phpunit on dev, but obviously do not want in prod.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: deprecated: directive 'allow_url_include' is deprecated in unknown on line 0
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.