wp-graphql / wp-graphql-testcase
Codeception module for WPGraphQL API testing
Installs: 137 331
Dependents: 9
Suggesters: 0
Security: 0
Stars: 8
Watchers: 6
Forks: 6
Open Issues: 0
Requires
Requires (Dev)
- automattic/vipwpcs: ^2.3
- composer/installers: ^1.9
- johnpbloch/wordpress: ^6.1
- php-coveralls/php-coveralls: 2.4.3
- squizlabs/php_codesniffer: ^3.5
- wp-coding-standards/wpcs: ^2.3
- wpackagist-plugin/wp-graphql: ^1.26
Suggests
- codeception/module-asserts: Needed for \Tests\WPGraphQL\TestCase\WPGraphQLTestcase to work.
- codeception/util-universalframework: Needed for \Tests\WPGraphQL\TestCase\WPGraphQLTestcase to work.
- guzzlehttp/guzzle: Needed for \Tests\WPGraphQL\Codeception\Module\WPGraphQL to work.
- lucatume/wp-browser: Needed for \Tests\WPGraphQL\TestCase\WPGraphQLTestcase to work.
- phpunit/phpunit: Needed for \Tests\WPGraphQL\TestCase\WPGraphQLUnitTestcase to work.
- wp-phpunit/wp-phpunit: Needed for \Tests\WPGraphQL\TestCase\WPGraphQLUnitTestcase to work.
- yoast/phpunit-polyfills: Needed for \Tests\WPGraphQL\TestCase\WPGraphQLUnitTestcase to work.
- dev-develop
- v3.4.0
- v3.3.0
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.1
- v3.0.0
- v2.4.1
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- dev-master
- dev-fix/composer.json
- dev-fix/phpunit-9.x-compat-fix
- dev-hotfix/typo-in-WPGraphQLTestCommon.php
- dev-bug/fix-static-method-in-wpgraphql-test-case
- dev-feature/php-8-support
- dev-feature/attempt-to-support-php8
- dev-jasonbahl-patch-1
- dev-release/v2.0
- dev-bugfix/removal-unneeded-deps
This package is auto-updated.
Last update: 2024-10-08 19:27:32 UTC
README
Is a library of tools for testing WPGraphQL APIs, designed for both WPGraphQL and WPGraphQL extension development. Currently the library only consisted of a Codeception Testcase built on top wp-browser's WPTestCase class.
Installing
- Run
composer require wp-graphql/wp-graphql-testcase
from your project directory in the terminal.
Codeception Only
- If your didn't already have codeception installed in the project, run
vendor/bin/codecept init wpbrowser
. - To make a test case generate a with
vendor/bin/codecept generate:wpunit wpunit TestName
. Then just change the extending class to\Tests\WPGraphQL\TestCase\WPGraphQLTestCase
🤷♂️
Going Forward
There are plans to add more to this library, and contribution are greatly appreciated 🙏.
Contributing
To contribute, fork this repository and open a PR with your requested changes back into the main repository.
Local Development
To develop locally, you need to have Docker and Composer installed.
Composer Setup
To ensure you have the necessary local dependencies, first run
composer install
.
Docker Setup
This project currently uses a docker-compose.yml
v2 file. To spin this up, run
docker-compose up -d
.
Local Tests
To run the local tests, use composer run-phpunit
or
composer run-codeception
. You should see the tests pass with output generated
in the terminal.
Test Coverage
The CI process uses coveralls.io to store coverage
reports. This is available for free for open-source projects, and is required to
run the CI process. Sign up for free and add your COVERALLS_REPO_TOKEN
value
to GitHub Actions secrets.