You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-39Lines changed: 52 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,12 @@
12
12
## What does this plugin do?
13
13
It adds WooCommerce functionality to the WPGraphQL schema using WooCommerce's [CRUD](https://github.com/woocommerce/woocommerce/wiki/CRUD-Objects-in-3.0) objects.
- Add items to cart and process user store session using HTTP header defined by WooGraphQL's built-in session handler
18
+
- Create/process user checkout with the `checkout` mutation.
17
19
18
-
## Upcoming Features
20
+
## Future Features
19
21
- Adminstrator mutations. Eg. Creating and deleting products, coupons, and refunds.
20
22
21
23
## Playground
@@ -31,42 +33,47 @@ Until the documentation is in full effect, it's recommended that a [GraphiQL](ht
31
33
32
34
### Setup
33
35
1. Make sure all dependencies are install by running `composer install` from the CMD/Terminal in the project directory.
34
-
2. Next the copy 5 distributed files with the `.dist` in there filenames. For instance `.env.dist` becomes `.env` and `wpunit.suite.dist.yml` becomes `wpunit.suite.yml`. The distributed files and what their copied names should are as follows.
2. Next the copy 2 distributed files with the `.dist` in there filenames. For instance `.env.dist` becomes `.env` and `wpunit.suite.dist.yml` becomes `wpunit.suite.yml`. The distributed files and what their copied names should are as follows.
- `Shared` variables are as the comment implies, variables shared in both the `install-wp-tests` script and the **Codeception** configuration. The variable names should tell you what they mean.
66
-
- `Install script` variables are specified to the `install-wp-tests` script, and most likely won't changed. I've listed their meaning below.
67
-
- `WP_VERSION` WordPress version used for testing
68
-
- `SKIP_DB_CREATE` Should database creation be skipped?
69
-
- `Codeception` variables are specified to the **Codeception** configuration. View the config files and Codeception's [Docs](https://codeception.com/docs/reference/Configuration#Suite-Configuration) for more info on them.
73
+
- `docker ENV variables`: variables defined for use in the Docker/Docker-Compose setups. These are also used in `codeception.dist.yml` for testing within a Docker container. It's recommend that this file be left unchanged and a `codeception.yml` be created for local codeception unit testing.
74
+
- `local codeception/install-wp-tests ENV variables`: variable defined for use with codeception testing w/o docker and the `install-wp-tests` script in the `bin` directory. As mentioned above a `codeception.yml` should be created from `codeception.dist.yml` and the variables in the `WPLoader` config should be set accordingly.
75
+
- `install-wp-tests ENV variables`: variables specific to the `install-wp-tests` script. The script can be run using `composer install-wp-tests` in the terminal from project directory.
76
+
- `codeception ENV variables`: variables used by codeception. This includes within the docker container as well.
70
77
71
78
4. Once you have finish modifying the `.env` file. Run `composer install-wp-tests` from the project directory.
72
79
5. Upon success you can begin running the tests.
@@ -81,12 +88,18 @@ To learn more about the usage of Codeception with WordPress view the [Documentat
81
88
It's possible to run functional and acceptance tests, but is very limited at the moment. The script docker entrypoint script runs all three suites (acceptance, functional, and wpunit) at once. This will change eventually, however as of right now, this is the limitation.
82
89
83
90
### Running tests
84
-
Even though the two suite use a Docker environment to run, the docker environment relies on a few environmental variables defined in `.env` and a volume source provided by the test install script.
85
-
0. Ensure that you can copy `.env.dist` to `.env`.
86
-
1. First you must run `composer install-wp-tests` to ensure the required dependencies are available.
87
-
2. Next run `docker-compose build` from the terminal in the project root directory, to build the docker image for test environment.
88
-
3. And now you're ready to run the tests. Running `docker-compose run --rm wpbrowser` does just that.
89
-
You can rerun the tests by simply repeating step 3.
91
+
Even though the two suite use a Docker environment to run, the docker environment relies on a few environmental variables defined in `.env.dist` and a volume source provided by the test install script and the configuration `codeception.dist.yml`. If you have created a `codeception.yml` file ensure it is identical to `codeception.dist.yml` or delete it.
92
+
Run the following in the terminal to run all three suites. Isolating specific suites should be simple to figure out.
- The `COVERAGE`, and `DEBUG` vars are optional flags for toggle codecoverage and debug output.
97
+
-`--scale app=0` ensures that the service running a local app doesn't create any instances. It must be added or a collision with `mysql` will occur. More on this service in the next section
98
+
99
+
## Using docker-compose to run a local installation for live testing.
100
+
This is rather simple just like with testing using docker ensure that `env.dist` and `codeception.dist.yml` are untouched and run `docker-compose up --scale testing=0 app` and wait for `app_1 | Success: Exported to '/var/www/html/wp-content/plugins/wp-graphql-woocommerce/tests/_data/dump.sql'.` to print to the terminal, then navigate to `http://localhost:8091`. And that's it. You can view the configuration for the installation in the `docker-compose.yml`. Note if you get redirected to `http://localhost` run `docker-compose down` to remove any existing containers related to the project, then re-run the `docker-compose up --scale testing=0 app` command.
101
+
- For more information about the docker-image uses in the service, it's on [Docker Hub](https://hub.docker.com/r/kidunot89/woographql-app).
102
+
90
103
91
104
## HTTP Error 500 :construction:
92
105
If you get HTTP 500 error upon activation or accessing the `endpoint` and have **CMD/Terminal** access with **Composer** installed.
0 commit comments