First step is upgrading Sylius with composer
composer require sylius/sylius:~1.4.0
If you provide migrations with your plugin, take a look at following changes:
- Change base
AbstractMigrationnamespace toDoctrine\Migrations\AbstractMigration - Add
: voidreturn types to bothupanddownfunctions
If you don't use migrations, just run (cd tests/Application && bin/console doctrine:schema:update --force) to update the test application's database schema.
composer require symfony/dotenv:^4.2 --dev- Follow Symfony dotenv update guide to incorporate required changes in
.envfiles structure. Remember - they should be done ontests/Application/level! Optionally, you can take a look at corresponding PR introducing these changes in PluginSkeleton (this PR also includes changes with Behat - see below)
Don't forget to clear the cache (tests/Application/bin/console cache:clear) to be 100% everything is loaded properly.
The kernel of the test application needs to be replaced with this file.
The location of the kernel is: tests/Application/Kernel.php (replace the content with the content of the file above).
The container cleanup method is removed in the new version and keeping it will cause problems with for example the TagAwareAdapter which will call commit() on its pool from its destructor. If its pool is TraceableAdapter with pool ArrayAdapter, then the pool property of TraceableAdapter will be nullified before the destructor is executed and cause an error.
If you're using Behat and want to be up-to-date with our configuration
- Update required extensions with
composer require friends-of-behat/symfony-extension:^2.0 friends-of-behat/page-object-extension:^0.3 --dev - Remove extensions that are not needed yet with
composer remove friends-of-behat/context-service-extension friends-of-behat/cross-container-extension friends-of-behat/service-container-extension --dev - Update your
behat.yml- look at the diff here - Add
SymfonyExtensionBundleto yourtests/Application/config/bundles.php:return [ //... FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true], ];
- If you use our Travis CI configuration, follow these changes introduced in
.travis.ymlfile - Create
tests/Application/config/services_test.yamlfile with the following code and add these your own Behat services as well:imports: - { resource: "../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" }
- Remove all
__symfony__prefixes in your Behat services - Remove all
<tag name="fob.context_service" />tags from your Behat services - Make your Behat services public by default with
<defaults public="true" /> - Change
contexts_servicesin your suite definitions tocontexts - Take a look at SymfonyExtension UPGRADE guide if you have any more problems
- Fix the container XML path parameter in the
phpstan.neonfile as done here
Firstly, check out the PluginSkeleton 1.3 upgrade guide to update Sylius version step by step. To upgrade to Sylius 1.4 follow instructions from the previous section with following changes:
- Change namespaces of copied migrations to
Sylius\Migrations
- These changes are not required, but can be done as well, if you've changed application directory structure in
1.2.xto1.3update
- Add
\FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle()to your bundles lists intests/Application/AppKernel.php(preferably only intestenvironment) - Import Sylius Behat services in
tests/Application/config/config_test.ymland your own Behat services as well:imports: - { resource: "../../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml" }
- Specify test application's kernel path in
behat.yml:FriendsOfBehat\SymfonyExtension: kernel: class: AppKernel path: tests/Application/app/AppKernel.php
-
Run
composer require sylius/sylius:~1.3.0 --no-update -
Add the following code in your
behat.yml(.dist)file:default: extensions: FriendsOfBehat\SymfonyExtension: env_file: ~
-
Incorporate changes from the following files into plugin's test application:
-
Update PHP and JS dependencies by running
composer updateand(cd tests/Application && yarn upgrade) -
Clear cache by running
(cd tests/Application && bin/console cache:clear) -
Install assets by
(cd tests/Application && bin/console assets:install web)and(cd tests/Application && yarn build) -
optionally, remove the build for PHP 7.1. in
.travis.yml