This plugin allows to define shipping rates with using weight tables.
-
Run
composer require webgriffe/sylius-table-rate-shipping-plugin
. -
Add the plugin to the
config/bundles.php
file:Webgriffe\SyliusTableRateShippingPlugin\WebgriffeSyliusTableRateShippingPlugin::class => ['all' => true],
-
Add the plugin's config to by creating the file
config/packages/webgriffe_sylius_table_rate_shipping_plugin.yaml
with the following content:imports: - { resource: "@WebgriffeSyliusTableRateShippingPlugin/Resources/config/config.yml" }
-
Add the plugin's routing by creating the file
config/routes/webgriffe_sylius_table_rate_shipping_plugin.yaml
with the following content:webgriffe_sylius_table_rate_shipping_plugin_shop: resource: "@WebgriffeSyliusTableRateShippingPlugin/Resources/config/shop_routing.yml" prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ webgriffe_sylius_table_rate_shipping_plugin_admina: resource: "@WebgriffeSyliusTableRateShippingPlugin/Resources/config/admin_routing.yml" prefix: /admin
-
Finish the installation by updating the database schema and installing assets:
bin/console doctrine:migrations:diff bin/console doctrine:migrations:migrate bin/console assets:install bin/console sylius:theme:assets:install
To contribute you need to:
-
Clone this repository into you development environment
-
Copy the
.env.test.dist
file inside the test application directory to the.env
file:cp tests/Application/.env.test.dist tests/Application/.env
-
Edit the
tests/Application/.env
file by setting configuration specific for your development environment. For example, if you want to use SQLite as database driver during testing you can set theDATABASE_URL
environment variable as follows:DATABASE_URL=sqlite:///%kernel.project_dir%/var/%kernel.environment%_db.sql
-
Then, from the plugin's root directory, run the following commands:
(cd tests/Application && yarn install) (cd tests/Application && yarn build) (cd tests/Application && bin/console assets:install public) (cd tests/Application && bin/console doctrine:database:create) (cd tests/Application && bin/console doctrine:schema:create) (cd tests/Application && bin/console server:run localhost:8080 -d public)
-
Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin
After your changes you must ensure that the tests are still passing. The current CI suite runs the following tests:
-
Easy Coding Standard
vendor/bin/ecs check src/ tests/Behat/
-
PHPStan
vendor/bin/phpstan analyse -c phpstan.neon -l max src/
-
PHPUnit
vendor/bin/phpunit
-
PHPSpec
vendor/bin/phpspec run
-
Behat
vendor/bin/behat --strict -vvv --no-interaction || vendor/bin/behat --strict -vvv --no-interaction --rerun
To run them all with a single command run:
composer suite
To run Behat's JS scenarios you need to setup Selenium and Chromedriver. Do the following:
-
Download Chromedriver
-
Download Selenium Standalone Server
-
Run Selenium with Chromedriver
java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone.jar
-
Remember that the test application webserver must be up and running as described above:
cd tests/Application && bin/console server:run localhost:8080 -d public
This library is under the MIT license. See the complete license in the LICENSE file.
Developed by Webgriffe®.