Este tutorial utiliza PHPUnit 9, pero funciona perfectamente con PHPUnit 10.
// composer.json
{
"require": {
"php": ">=8.1.0",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.8", // 2.10.2
"doctrine/doctrine-migrations-bundle": "^3.2", // 3.2.4
"doctrine/orm": "^2.14", // 2.16.2
"symfony/asset": "6.3.*", // v6.3.0
"symfony/console": "6.3.*", // v6.3.4
"symfony/dotenv": "6.3.*", // v6.3.0
"symfony/flex": "^2", // v2.3.3
"symfony/framework-bundle": "6.3.*", // v6.3.5
"symfony/http-client": "6.3.*", // v6.3.5
"symfony/mailer": "6.3.*", // v6.3.5
"symfony/messenger": "6.3.*", // v6.3.5
"symfony/monolog-bundle": "^3.0", // v3.8.0
"symfony/runtime": "6.3.*", // v6.3.2
"symfony/security-csrf": "6.3.*", // v6.3.2
"symfony/twig-bundle": "6.3.*", // v6.3.0
"symfony/yaml": "6.3.*" // v6.3.3
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4", // 3.4.4
"phpunit/phpunit": "^9.5", // 9.6.13
"symfony/browser-kit": "6.3.*", // v6.3.2
"symfony/css-selector": "6.3.*", // v6.3.2
"symfony/debug-bundle": "6.3.*", // v6.3.2
"symfony/maker-bundle": "^1.48", // v1.51.1
"symfony/phpunit-bridge": "^6.2", // v6.3.2
"symfony/stopwatch": "6.3.*", // v6.3.0
"symfony/web-profiler-bundle": "6.3.*", // v6.3.2
"zenstruck/foundry": "^1.35", // v1.35.0
"zenstruck/mailer-test": "^1.3", // v1.3.0
"zenstruck/messenger-test": "^1.7" // v1.7.3
}
}
7 Comments
Regarding the lack of a larger exception when the test failed (because the mailer wasn't injected into the handler): by default, messenger-test swallows exceptions when processing. This behavior can be adjusted: https://github.com/zenstruck/messenger-test#processing-exceptions
Hey Kevin!
Thank you for this tip!
Cheers!
Thank you for that course.
But I have a question.
Where is coverage tests report? :) It's second video about testing without it.
BR.
Ruslan.
Hey @Ruslan
Thanks for reaching out, we'll take your request into account for the next tutorial. In the meantime, if you're using PhpStorm you can leverage test coverage easily. Right click on the test folder then click on: more run/debug -> run tests with PHP coverage
It will run your tests and show you a coverage report.
As a recommendation don't aim for 100% coverage that's counterproductive and almost impossible to achieve
Cheers!
Nicely explained the integration tests. Looking forward to seeing the final part on functional tests. Do you have a deadline?
Thanks @Sidi-LEKHAIFA! No deadline yet - probably a couple of months (unfortunately, every January we need to refresh our basic Symfony tutorials). However, just today I released a single chapter on this topic for another tutorial - hopefully it can give you a boost :) https://symfonycasts.com/screencast/last-stack/testing
Cheers!
Great, Thanks
"Houston: no signs of life"
Start the conversation!