|
12 | 12 |
|
13 | 13 | 1. Run `composer require webgriffe/sylius-table-rate-shipping-plugin`. |
14 | 14 |
|
15 | | -2. TODO |
| 15 | +2. Add the plugin to the `config/bundles.php` file: |
| 16 | + |
| 17 | + ```php |
| 18 | + Webgriffe\SyliusTableRateShippingPlugin\WebgriffeSyliusTableRateShippingPlugin::class => ['all' => true], |
| 19 | + ``` |
| 20 | + |
| 21 | +3. Add the plugin's config to by creating the file `config/packages/webgriffe_sylius_table_rate_shipping_plugin.yaml` with the following content: |
| 22 | + |
| 23 | + ```yaml |
| 24 | + imports: |
| 25 | + - { resource: "@WebgriffeSyliusTableRateShippingPlugin/Resources/config/config.yml" } |
| 26 | + ``` |
| 27 | +
|
| 28 | +4. Add the plugin's routing by creating the file `config/routes/webgriffe_sylius_table_rate_shipping_plugin.yaml` with the following content: |
| 29 | + |
| 30 | + ```yaml |
| 31 | + webgriffe_sylius_table_rate_shipping_plugin_shop: |
| 32 | + resource: "@WebgriffeSyliusTableRateShippingPlugin/Resources/config/shop_routing.yml" |
| 33 | + prefix: /{_locale} |
| 34 | + requirements: |
| 35 | + _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ |
| 36 | + |
| 37 | + webgriffe_sylius_table_rate_shipping_plugin_admina: |
| 38 | + resource: "@WebgriffeSyliusTableRateShippingPlugin/Resources/config/admin_routing.yml" |
| 39 | + prefix: /admin |
| 40 | + |
| 41 | + ``` |
| 42 | + |
| 43 | +5. Finish the installation by updating the database schema and installing assets: |
| 44 | + |
| 45 | + ```bash |
| 46 | + bin/console doctrine:migrations:diff |
| 47 | + bin/console doctrine:migrations:migrate |
| 48 | + bin/console assets:install |
| 49 | + bin/console sylius:theme:assets:install |
| 50 | + ``` |
16 | 51 |
|
17 | 52 | ## Contributing |
18 | 53 |
|
19 | | -Refer to the SyliusPluginSkeleton: https://github.com/Sylius/PluginSkeleton |
| 54 | +To contribute you need to: |
| 55 | + |
| 56 | +1. Clone this repository into you development environment |
| 57 | + |
| 58 | +2. Copy the `.env.test.dist` file inside the test application directory to the `.env` file: |
| 59 | + |
| 60 | + ```bash |
| 61 | + cp tests/Application/.env.test.dist tests/Application/.env |
| 62 | + ``` |
| 63 | + |
| 64 | +3. 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 the `DATABASE_URL` environment variable as follows: |
| 65 | + |
| 66 | + ```bash |
| 67 | + DATABASE_URL=sqlite:///%kernel.project_dir%/var/%kernel.environment%_db.sql |
| 68 | + ``` |
| 69 | + |
| 70 | +4. Then, from the plugin's root directory, run the following commands: |
| 71 | + |
| 72 | + ```bash |
| 73 | + (cd tests/Application && yarn install) |
| 74 | + (cd tests/Application && yarn build) |
| 75 | + (cd tests/Application && bin/console assets:install public) |
| 76 | + (cd tests/Application && bin/console doctrine:database:create) |
| 77 | + (cd tests/Application && bin/console doctrine:schema:create) |
| 78 | + (cd tests/Application && bin/console server:run localhost:8080 -d public) |
| 79 | + ``` |
| 80 | + |
| 81 | +5. Now at http://localhost:8080/ you have a full Sylius testing application which runs the plugin |
| 82 | + |
| 83 | +### Testing |
| 84 | + |
| 85 | +After your changes you must ensure that the tests are still passing. The current CI suite runs the following tests: |
| 86 | + |
| 87 | +* Easy Coding Standard |
| 88 | + |
| 89 | + ```bash |
| 90 | + vendor/bin/ecs check src/ tests/Behat/ |
| 91 | + ``` |
| 92 | + |
| 93 | +* PHPStan |
| 94 | + |
| 95 | + ```bash |
| 96 | + vendor/bin/phpstan analyse -c phpstan.neon -l max src/ |
| 97 | + ``` |
| 98 | + |
| 99 | +* PHPUnit |
| 100 | + |
| 101 | + ```bash |
| 102 | + vendor/bin/phpunit |
| 103 | + ``` |
| 104 | + |
| 105 | +* PHPSpec |
| 106 | + |
| 107 | + ```bash |
| 108 | + vendor/bin/phpspec run |
| 109 | + ``` |
| 110 | + |
| 111 | +* Behat |
| 112 | + |
| 113 | + ```bash |
| 114 | + vendor/bin/behat --strict -vvv --no-interaction || vendor/bin/behat --strict -vvv --no-interaction --rerun |
| 115 | + ``` |
| 116 | + |
| 117 | +To run them all with a single command run: |
| 118 | + |
| 119 | +```bash |
| 120 | +composer suite |
| 121 | +``` |
| 122 | + |
| 123 | +To run Behat's JS scenarios you need to setup Selenium and Chromedriver. Do the following: |
| 124 | + |
| 125 | +1. Download [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/) |
| 126 | + |
| 127 | +2. Download [Selenium Standalone Server](https://www.seleniumhq.org/download/) |
| 128 | + |
| 129 | +3. Run Selenium with Chromedriver |
| 130 | + |
| 131 | + ```bash |
| 132 | + java -Dwebdriver.chrome.driver=chromedriver -jar selenium-server-standalone.jar |
| 133 | + ``` |
| 134 | + |
| 135 | +4. Remember that the test application webserver must be up and running as described above: |
| 136 | + |
| 137 | + ```bash |
| 138 | + cd tests/Application && bin/console server:run localhost:8080 -d public |
| 139 | + ``` |
| 140 | + |
| 141 | +License |
| 142 | +------- |
| 143 | +This library is under the MIT license. See the complete license in the LICENSE file. |
| 144 | + |
| 145 | +Credits |
| 146 | +------- |
| 147 | +Developed by [Webgriffe®](http://www.webgriffe.com/). |
0 commit comments