If you liked what you've learned so far, dive in!
Subscribe to get access to this tutorial plus
video, code and script downloads.
With a Subscription, click any sentence in the script to jump to that part of the video!
Login SubscribeLet's see what recipes we have left:
composer recipes
Next up is phpunit-bridge
. Copy its name and run:
composer recipes:install symfony/phpunit-bridge --force -v
It says it created - probably updated - 5 files. You know the process:
git add -p
The first is .env.test
with two changes. This fix is a silly typo on the APP_SECRET
variable - that's not important - and the second is a new PANTHER_APP_ENV
variable. If you're using Symfony Panther - a cool testing tool - then this variable is used to tell Panther which environment to launch. If you're not, then you don't technically need this... but it doesn't hurt anything. You also might install Panther in the future.
As a challenge, let's see if we can just add the second change. To do that, type "s", which means "split". The tool will then try to ask you about each change independently. Say "n" to the first and "y" to the second.
The next update is inside .gitignore: it ignores a new .phpunit.result.cache
file. This is why I love updating recipes. Since version 7.3, PHPUnit outputs this file under certain conditions as a way to remember which tests failed. It should be ignored, and this takes care of that. Enter "y".
Woh! The next change looks bigger - this is bin/phpunit
: a script that this packages adds to help execute PHPUnit. It has a number of subtle updates... and since you've almost definitely not made any custom tweaks to this file, let's add the change.
The last update is for phpunit.xml.dist
- PHPUnit's configuration file. You may have some customizations here that you want to keep - so be careful. The recipe updates are tiny: these changed from <env
to <server
- a mostly meaningless change to how environment variables are added - and it looks like something about these two SYMFONY_PHPUNIT
variables got tweaked a bit.
Hit "y" to accept this patch. The last change is for symfony.lock
- hit "y" for this one too.
Done! The next recipe on the list is symfony/routing. Let's jump straight to update it:
composer recipes:install symfony/routing --force -v
And then get into:
git add -p
Bah! Duh! I should have committed my changes before starting this and then reverted the stuff we did not want - like this. We'll do that in a minute. Hit "n" to ignore the .env.test
change.
The first real change is in config/packages/routing.yaml
: strict_requirements
is gone and utf8: true
was added. If you dug into the recipe history, you could find the reason behind both of these. utf8
is a new feature in routing. By setting this to true, you're activating that feature. We may not need it, but I'm going to say yes to this.
The second change - strict_requirements
- is thanks to a little reorganization of the routing config files that, actually, I am responsible for. The short story is that: you want this key to be set to a different value in different environments. I moved some config around to get that done with less files.
Hit "y" to add these changes. And... yep! This is symfony.lock
, so accept this too. Phew! Let's see how things look:
git status
Woh! A new routing.yaml
file for the prod
environment! If you open that - config/packages/prod/routing.yaml
- it has strict_requirements: null
:
framework: | |
router: | |
strict_requirements: null |
It's part of that reorganization I was just talking about. Add that change:
git add config/packages/prod/routing.yaml
The last change - which we need to do manually - is to delete config/packages/test/routing.yaml
:
framework: | |
router: | |
strict_requirements: true |
It's another file with strict_requirements
and it is gone from the new recipe. Why? It's just not needed anymore: if you followed the logic, you'd find that strict_requirements
is already true
in the test
environment. Delete it:
git rm config/packages/test/routing.yaml
Oh... I apparently modified that file? Whoops! Yep, I added a "g"! Not helpful. Remove it and... delete the file:
git rm config/packages/test/routing.yaml
Let's see how things look:
git status
A lot of progress from those two recipe updates. Let's commit:
git commit -m "upgrading phpunit & routing recipes"
The one change left - that we decided we didn't care about - is in .env.test
. Revert it with:
git checkout .env.test
Woo! Let's find out what recipes we have left:
composer recipes
Woh! Only 3 main Symfony repositories left: security-bundle
, translation
and validator
. Let's do those next.
"Houston: no signs of life"
Start the conversation!
// composer.json
{
"require": {
"php": "^7.3.0",
"ext-iconv": "*",
"antishov/doctrine-extensions-bundle": "^1.4", // v1.4.2
"aws/aws-sdk-php": "^3.87", // 3.110.11
"composer/package-versions-deprecated": "^1.11", // 1.11.99
"doctrine/doctrine-bundle": "^2.0", // 2.0.6
"doctrine/doctrine-migrations-bundle": "^1.3|^2.0", // 2.1.2
"doctrine/orm": "^2.5.11", // v2.7.2
"doctrine/persistence": "^1.3.7", // 1.3.8
"easycorp/easy-log-handler": "^1.0", // v1.0.9
"http-interop/http-factory-guzzle": "^1.0", // 1.0.0
"knplabs/knp-markdown-bundle": "^1.7", // 1.8.1
"knplabs/knp-paginator-bundle": "^5.0", // v5.0.0
"knplabs/knp-snappy-bundle": "^1.6", // v1.7.0
"knplabs/knp-time-bundle": "^1.8", // v1.11.0
"league/flysystem-aws-s3-v3": "^1.0", // 1.0.23
"league/flysystem-cached-adapter": "^1.0", // 1.0.9
"league/html-to-markdown": "^4.8", // 4.8.2
"liip/imagine-bundle": "^2.1", // 2.3.0
"nexylan/slack-bundle": "^2.1", // v2.2.1
"oneup/flysystem-bundle": "^3.0", // 3.3.0
"php-http/guzzle6-adapter": "^2.0", // v2.0.1
"sensio/framework-extra-bundle": "^5.1", // v5.5.3
"symfony/asset": "5.0.*", // v5.0.2
"symfony/console": "5.0.*", // v5.0.2
"symfony/dotenv": "5.0.*", // v5.0.2
"symfony/flex": "^1.0", // v1.17.6
"symfony/form": "5.0.*", // v5.0.2
"symfony/framework-bundle": "5.0.*", // v5.0.2
"symfony/mailer": "5.0.*", // v5.0.2
"symfony/messenger": "5.0.*", // v5.0.2
"symfony/monolog-bundle": "^3.5", // v3.5.0
"symfony/security-bundle": "5.0.*", // v5.0.2
"symfony/sendgrid-mailer": "5.0.*", // v5.0.2
"symfony/serializer-pack": "^1.0", // v1.0.2
"symfony/twig-bundle": "5.0.*", // v5.0.2
"symfony/twig-pack": "^1.0", // v1.0.0
"symfony/validator": "5.0.*", // v5.0.2
"symfony/webpack-encore-bundle": "^1.4", // v1.7.2
"symfony/yaml": "5.0.*", // v5.0.2
"twig/cssinliner-extra": "^2.12", // v2.12.0
"twig/extensions": "^1.5", // v1.5.4
"twig/inky-extra": "^2.12" // v2.12.0
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0", // 3.3.0
"fzaninotto/faker": "^1.7", // v1.8.0
"symfony/browser-kit": "5.0.*", // v5.0.2
"symfony/debug-bundle": "5.0.*", // v5.0.2
"symfony/maker-bundle": "^1.0", // v1.14.3
"symfony/phpunit-bridge": "5.0.*", // v5.0.2
"symfony/profiler-pack": "^1.0", // v1.0.4
"symfony/var-dumper": "5.0.*" // v5.0.2
}
}