Skip to content

Commit 6436ea8

Browse files
committed
Merge branch 'release-v0.2.1' of github.com:wp-graphql/wp-graphql-woocommerce into bugfix/checkout-mutation
2 parents a6bc2d3 + 1772464 commit 6436ea8

File tree

2 files changed

+53
-40
lines changed

2 files changed

+53
-40
lines changed

README.md

Lines changed: 52 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
## What does this plugin do?
1313
It adds WooCommerce functionality to the WPGraphQL schema using WooCommerce's [CRUD](https://github.com/woocommerce/woocommerce/wiki/CRUD-Objects-in-3.0) objects.
1414

15-
## Working Features
16-
- Query product, customers, coupons, order, refund, product variations.
15+
## Features
16+
- Query product, customers, coupons, order, refund, product variations with complex filtering options.
17+
- 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.
1719

18-
## Upcoming Features
20+
## Future Features
1921
- Adminstrator mutations. Eg. Creating and deleting products, coupons, and refunds.
2022

2123
## Playground
@@ -31,42 +33,47 @@ Until the documentation is in full effect, it's recommended that a [GraphiQL](ht
3133

3234
### Setup
3335
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.
35-
- `tests/acceptance.suite.dist.yml` => `tests/acceptance.suite.yml`
36-
- `tests/functional.suite.dist.yml` => `tests/functional.suite.yml`
37-
- `tests/wpunit.suite.dist.yml` => `tests/wpunit.suite.yml`
36+
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.
3837
- `codeception.dist.yml` => `codeception.yml`
3938
- `.env.dist` => `.env`
4039
3. Next open `.env` and alter to make you usage.
4140
```
42-
# Shared
43-
TEST_DB_NAME="wpgraphql_woocommerce_test"
44-
TEST_DB_HOST="127.0.0.1"
45-
TEST_DB_USER="root"
46-
TEST_DB_PASSWORD=""
47-
48-
# Install script
41+
# docker ENV variables
42+
DB_NAME=wordpress
43+
DB_HOST=app_db
44+
DB_USER=wordpress
45+
DB_PASSWORD=wordpress
46+
WP_TABLE_PREFIX=wp_
47+
WP_URL=http://localhost
48+
WP_DOMAIN=localhost
49+
50+
ADMIN_USERNAME=admin
51+
ADMIN_PASSWORD=password
52+
ADMIN_PATH=/wp-admin
53+
54+
# local codeception/install-wp-tests ENV variables
55+
TEST_DB_NAME=woographql_tests
56+
TEST_DB_HOST=127.0.0.1
57+
TEST_DB_USER=wordpress
58+
TEST_DB_PASSWORD=wordpress
59+
TEST_WP_TABLE_PREFIX=wp_
60+
61+
# install-wp-tests ENV variables
4962
SKIP_DB_CREATE=false
50-
51-
# Codeception
52-
TEST_SITE_WP_ADMIN_PATH="/wp-admin"
53-
TEST_SITE_DB_NAME="wpgraphql_woocommerce_test"
54-
TEST_SITE_DB_HOST="127.0.0.1"
55-
TEST_SITE_DB_USER="root"
56-
TEST_SITE_DB_PASSWORD=""
57-
TEST_SITE_TABLE_PREFIX="wp_"
58-
TEST_TABLE_PREFIX="wp_"
59-
TEST_SITE_WP_URL="http://localhost"
60-
TEST_SITE_WP_DOMAIN="localhost"
61-
TEST_SITE_ADMIN_EMAIL="admin@localhost"
62-
TEST_SITE_ADMIN_USERNAME="admin"
63-
TEST_SITE_ADMIN_PASSWORD="password"
63+
TEST_WP_ROOT_FOLDER=/tmp/wordpress
64+
65+
66+
# codeception ENV variables
67+
TESTS_DIR=tests
68+
TESTS_OUTPUT=tests/_output
69+
TESTS_DATA=tests/_data
70+
TESTS_SUPPORT=tests/_support
71+
TESTS_ENVS=tests/_envs
6472
```
65-
- `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.
7077

7178
4. Once you have finish modifying the `.env` file. Run `composer install-wp-tests` from the project directory.
7279
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
8188
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.
8289

8390
### 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.
93+
```
94+
docker-compose run --rm -e SUITE=acceptance;wpunit;functional -e DEBUG=1 -e COVERAGE=1 testing --scale app=0
95+
```
96+
- 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+
90103

91104
## HTTP Error 500 :construction:
92105
If you get HTTP 500 error upon activation or accessing the `endpoint` and have **CMD/Terminal** access with **Composer** installed.

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
=== WP GraphQL WooCommerce ===
2-
Contributors: kidunot89
2+
Contributors: kidunot89, ranaaterning
33
Tags: GraphQL, WooCommerce, WPGraphQL
44
Requires at least: 4.9
55
Tested up to: 5.2

0 commit comments

Comments
 (0)