| 1 |
[](https://github.com/Automattic/substack-importer/actions/workflows/test.yml](https://github.com/Automattic/substack-importer/actions/workflows/test.yml](https://github.com/Automattic/substack-importer/actions/workflows/test.yml) |
| 2 |
[](https://github.com/Automattic/substack-importer/actions/workflows/cs.yml](https://github.com/Automattic/substack-importer/actions/workflows/cs.yml](https://github.com/Automattic/substack-importer/actions/workflows/cs.yml) |
| 3 |
|
| 4 |
# Substack Importer |
| 5 |
|
| 6 |
The Substack Importer is a WordPress plugin that allows you to import a [](https://substack.comSubstack](https://substack.com](https://substack.com) export into your WordPress site. |
| 7 |
|
| 8 |
|
| 9 |
## Testing instructions |
| 10 |
|
| 11 |
Testing the plugin locally is easiest done by using [](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/wp-env](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/). |
| 12 |
|
| 13 |
## Set up your local environment |
| 14 |
|
| 15 |
The easiest way to run manual and unit tests for the Substack Importer is by using [](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/wp-en](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/](https://make.wordpress.org/core/2020/03/03/wp-env-simple-local-environments-for-wordpress/). |
| 16 |
The instructions here assume you are using wp-env. |
| 17 |
|
| 18 |
Steps: |
| 19 |
|
| 20 |
1. Install wp-env globally and add a .wp-env.json file. You can use the example below. |
| 21 |
|
| 22 |
```json |
| 23 |
{ |
| 24 |
"core": null, |
| 25 |
"plugins": [ |
| 26 |
".", |
| 27 |
"../wxr-generator", |
| 28 |
"WordPress/wordpress-importer" |
| 29 |
], |
| 30 |
"port": 1000, |
| 31 |
"testsPort": 1001, |
| 32 |
"config": { |
| 33 |
"WP_DEBUG_DISPLAY": true |
| 34 |
} |
| 35 |
} |
| 36 |
``` |
| 37 |
2. As the substack importer depends on the wxr-generator and wordpress-importer plugin, make sure you have added both of them to the `plugins` field. This field contains a list of plugins to be loaded and enabled. |
| 38 |
|
| 39 |
3. Run `wp-env start` in the substack-importer plugin directory. This will fire up a couple of Docker containers that give you access to a working WordPress instance. |
| 40 |
|
| 41 |
### Run unit tests |
| 42 |
|
| 43 |
To run unit tests some composer dependencies need to be installed. We can run composer and install the dependencies by running th following command inside the substack-importer directory: |
| 44 |
|
| 45 |
`wp-env run composer install` |
| 46 |
|
| 47 |
Unit tests can now be ran with the following command: |
| 48 |
|
| 49 |
`wp-env run phpunit "phpunit --configuration=html/wp-content/plugins/substack-importer/phpunit.xml.dist"` |
| 50 |
|
| 51 |
## Publishing the plugin |
| 52 |
|
| 53 |
When a new tag is pushed, the tag will be published to SVN. |
| 54 |
|