mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 06:52:50 +08:00
Update dev env docs
This commit is contained in:
parent
a87a9dcab5
commit
7e121c6a4a
2 changed files with 49 additions and 29 deletions
62
README.md
62
README.md
|
@ -38,38 +38,41 @@ follow these steps:
|
||||||
```
|
```
|
||||||
$ yarn run build
|
$ yarn run build
|
||||||
```
|
```
|
||||||
or if using the Docker setup:
|
or if using the DDEV setup:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ yarn run docker:build-package
|
$ yarn run ddev:build-package
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
You can install WooCommerce PayPal Payments locally using the dev environment of your preference, or you can use the Docker environment which includes WP, WC and all developments tools.
|
You can install WooCommerce PayPal Payments locally using the dev environment of your preference, or you can use the DDEV setup provided in this repository which includes WP, WC and all developments tools.
|
||||||
|
|
||||||
To set up the Docker environment, follow these steps:
|
To set up the DDEV environment, follow these steps:
|
||||||
|
|
||||||
0. Install Docker and Docker Compose.
|
0. Install Docker and [DDEV](https://ddev.readthedocs.io/en/stable/).
|
||||||
1. `$ cp .env.example .env` and edit the configuration in the `.env` file if needed.
|
1. Edit the configuration in the [`.ddev/config.yml`](.ddev/config.yaml) file if needed.
|
||||||
2. `$ yarn run docker:build` (or copy the commands from [package.json](/package.json) if you do not have `yarn`).
|
2. `$ ddev start`
|
||||||
3. `$ yarn run docker:install`
|
3. `$ ddev orchestrate` to install WP/WC.
|
||||||
4. `$ yarn run docker:start`
|
4. Open https://wc-pp.ddev.site
|
||||||
5. Add `127.0.0.1 wc-pp.myhost` to your `hosts` file and open http://wc-pp.myhost (the default value of `WP_DOMAIN` in `.env`).
|
|
||||||
|
|
||||||
### Running tests in the Docker environment
|
Use `$ ddev orchestrate -f` for reinstalattion (will destroy all site data).
|
||||||
|
You may also need `$ ddev restart` to apply the config changes.
|
||||||
|
|
||||||
|
### Running tests and other tasks in the DDEV environment
|
||||||
|
|
||||||
Tests and code style:
|
Tests and code style:
|
||||||
- `$ yarn run docker:test`
|
- `$ yarn ddev:test`
|
||||||
- `$ yarn run docker:lint`
|
- `$ yarn ddev:lint`
|
||||||
|
- `$ yarn ddev:fix-lint` - PHPCBF to fix basic code style issued
|
||||||
After some changes in `.env` (such as PHP, WP versions) you may need to rebuild the Docker image:
|
|
||||||
|
|
||||||
1. `$ yarn run docker:destroy` (all data will be lost)
|
|
||||||
2. `$ yarn run docker:build`
|
|
||||||
|
|
||||||
See [package.json](/package.json) for other useful commands.
|
See [package.json](/package.json) for other useful commands.
|
||||||
|
|
||||||
|
For debugging, see [the DDEV docs](https://ddev.readthedocs.io/en/stable/users/step-debugging/).
|
||||||
|
Enable xdebug via `$ ddev xdebug`, and press `Start Listening for PHP Debug Connections` in PHPStorm.
|
||||||
|
After creating the server in the PHPStorm dialog, you need to set the local project path for the server plugin path.
|
||||||
|
It should look [like this](https://i.imgur.com/ofsF1Mc.png).
|
||||||
|
|
||||||
## Test account setup
|
## Test account setup
|
||||||
|
|
||||||
You will need a PayPal sandbox merchant and customer accounts to configure the plugin and make test purchases with it.
|
You will need a PayPal sandbox merchant and customer accounts to configure the plugin and make test purchases with it.
|
||||||
|
@ -82,20 +85,21 @@ For testing webhooks locally, follow these steps to set up ngrok:
|
||||||
|
|
||||||
0. Install [ngrok](https://ngrok.com/).
|
0. Install [ngrok](https://ngrok.com/).
|
||||||
|
|
||||||
1. Run
|
1.
|
||||||
```
|
- If using DDEV, run our wrapper Bash script which will start `ddev share` and replace the URLs in the WP database:
|
||||||
ngrok http -host-header=rewrite wc-pp.myhost
|
```
|
||||||
```
|
$ .ddev/bin/share
|
||||||
|
```
|
||||||
|
|
||||||
2. In your environment variables (accessible to the web server), add `NGROK_HOST` with the host that you got from `ngrok`, like `abcd1234.ngrok.io`.
|
- For other environments, run
|
||||||
|
```
|
||||||
- For the Docker environment: set `NGROK_HOST` in the `.env` file and restart the web server. (`yarn run docker:stop && yarn run docker:start`)
|
$ ngrok http -host-header=rewrite wc-pp.myhost
|
||||||
|
```
|
||||||
3. Complete onboarding or resubscribe webhooks on the Webhooks Status page.
|
and in your environment variables (accessible to the web server) add `NGROK_HOST` with the host that you got from `ngrok`, like `abcd1234.ngrok.io`. ngrok will be used only for the webhook listening URL.
|
||||||
|
|
||||||
Currently, ngrok is used only for the webhook listening URL.
|
|
||||||
The URLs displayed on the WordPress pages, used in redirects, etc. will still remain local.
|
The URLs displayed on the WordPress pages, used in redirects, etc. will still remain local.
|
||||||
|
|
||||||
|
2. Complete onboarding or resubscribe webhooks on the Webhooks Status page.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[GPL-2.0 License](LICENSE)
|
[GPL-2.0 License](LICENSE)
|
||||||
|
|
16
package.json
16
package.json
|
@ -32,6 +32,22 @@
|
||||||
"docker:fix-lint": "docker-compose run --rm test vendor/bin/phpcbf",
|
"docker:fix-lint": "docker-compose run --rm test vendor/bin/phpcbf",
|
||||||
"docker:build-package": "docker-compose run --rm build yarn run build",
|
"docker:build-package": "docker-compose run --rm build yarn run build",
|
||||||
|
|
||||||
|
"ddev:setup": "ddev start && ddev orchestrate",
|
||||||
|
"ddev:start": "ddev start",
|
||||||
|
"ddev:stop": "ddev stop",
|
||||||
|
"ddev:reset": "ddev orchestrate -f",
|
||||||
|
"ddev:install": "ddev composer install && yarn run ddev:build-js",
|
||||||
|
"ddev:build-js": "ddev yarn build:dev",
|
||||||
|
"ddev:composer-update": "ddev composer update && ddev composer update --lock",
|
||||||
|
"ddev:test": "ddev exec phpunit",
|
||||||
|
"ddev:lint": "yarn ddev:phpcs && yarn ddev:psalm",
|
||||||
|
"ddev:phpcs": "ddev exec phpcs --parallel=8 -s",
|
||||||
|
"ddev:psalm": "ddev exec psalm --show-info=false --threads=8 --diff",
|
||||||
|
"ddev:fix-lint": "ddev exec phpcbf",
|
||||||
|
"ddev:xdebug-on": "ddev xdebug",
|
||||||
|
"ddev:xdebug-off": "ddev xdebug",
|
||||||
|
"ddev:build-package": "ddev yarn build",
|
||||||
|
|
||||||
|
|
||||||
"prebuild": "rm -rf ./vendor && find . -name 'node_modules' -type d -maxdepth 3 -exec rm -rf {} +",
|
"prebuild": "rm -rf ./vendor && find . -name 'node_modules' -type d -maxdepth 3 -exec rm -rf {} +",
|
||||||
"build": "composer install --no-dev && yarn run build:dev && yarn run archive",
|
"build": "composer install --no-dev && yarn run build:dev && yarn run archive",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue