Merge pull request #3611 from woocommerce/PCP-5179-validate-and-update-developer-section-readme-md
Some checks failed
CI / PHP 7.4 (push) Has been cancelled
CI / PHP 8.0 (push) Has been cancelled
CI / PHP 8.1 (push) Has been cancelled
CI / PHP 8.2 (push) Has been cancelled
CI / PHP 8.3 (push) Has been cancelled
CI / PHP 8.4 (push) Has been cancelled
PR Playground Demo / prepare_version (push) Has been cancelled
PR Playground Demo / build_plugin (push) Has been cancelled
PR Playground Demo / create_archive (push) Has been cancelled
PR Playground Demo / Comment on PR with Playground details (push) Has been cancelled

Validate and update Developer section README.md (5179)
This commit is contained in:
Emili Castells 2025-08-26 14:25:37 +02:00 committed by GitHub
commit af71409850
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -52,26 +52,56 @@ Visit our [official documentation](https://woocommerce.com/document/woocommerce-
## Development
### Install dependencies & build
### Setup using DDEV (recommended)
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 WordPress, WooCommerce and all development tools.
To set up the DDEV environment, follow these steps:
0. Install Docker and [DDEV](https://ddev.readthedocs.io/en/stable/).
1. Edit the [configuration](https://docs.ddev.com/en/stable/users/configuration/config/#managing-configuration) in the [`.ddev/config.yml`](.ddev/config.yaml) file if needed.
2. `$ ddev setup` to setup and orchestrate the plugin, WooCommerce and WordPress
3. Open https://woocommerce-paypal-payments.ddev.site
Use `$ ddev reset` for reinstallation (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:
- `$ yarn ddev:unit-tests`
- `$ yarn ddev:lint`
- `$ yarn ddev:fix-lint`
- `$ yarn ddev:lint-js`
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 enable`, 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.
Check [this article](https://docs.ddev.com/en/stable/users/debugging-profiling/step-debugging/#phpstorm-debugging-setup) for a detailed guide.
## Setup in other environments
#### Install dependencies & build
- `$ composer install`
- `$ yarn install`
Optionally, change the `PAYPAL_INTEGRATION_DATE` constant to `gmdate( 'Y-m-d' )` to run the latest PayPal JavaScript SDK
### Unit tests and code style
#### Unit tests and code style
1. `$ composer install`
2. `$ ./vendor/bin/phpunit`
3. `$ ./vendor/bin/phpcs`
4. `$ ./vendor/bin/psalm`
5. `$ wp-scripts lint-js`
6. `$ yarn run test:unit-js` - Ensure node version is `18` or above
1. `$ ./vendor/bin/phpunit`
2. `$ ./vendor/bin/phpcs`
3. `$ ./vendor/bin/psalm`
4. `$ yarn run lint-js`
5. `$ yarn run test:unit-js` - Ensure node version is `18` or above
### Building a release package
If you want to build a release package
(that can be used for deploying a new version on wordpress.org or manual installation on a WP website via ZIP uploading),
(that can be used for deploying a new version on wordpress.org or manual installation on a WordPress website via ZIP uploading),
follow these steps:
1. Clone the repository and `cd` into it.
@ -88,38 +118,6 @@ or if using the DDEV setup:
$ yarn run ddev:build-package
```
## Setup
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 DDEV environment, follow these steps:
0. Install Docker and [DDEV](https://ddev.readthedocs.io/en/stable/).
1. Edit the configuration in the [`.ddev/config.yml`](.ddev/config.yaml) file if needed.
2. `$ ddev start`
3. `$ ddev orchestrate` to install WP/WC.
4. Open https://wc-pp.ddev.site
Use `$ ddev orchestrate -f` for reinstallation (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:
- `$ yarn ddev:test`
- `$ yarn ddev:lint`
- `$ yarn ddev:fix-lint`
- `$ yarn ddev:lint-js`
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).
See [tests/playwright](tests/playwright) for e2e (browser-based) tests.
## Test account setup
You will need a PayPal sandbox merchant and customer accounts to configure the plugin and make test purchases with it.
@ -133,7 +131,7 @@ For testing webhooks locally, follow these steps to set up ngrok:
0. Install [ngrok](https://ngrok.com/).
1.
- If using DDEV, run our wrapper Bash script which will start `ddev share` and replace the URLs in the WP database:
- If using DDEV, run our wrapper Bash script which will start `ddev share` and replace the URLs in the WordPress database:
```
$ .ddev/bin/share
```