-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tools: Try adding infrastructure for PHPUnit tests #299
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
8f4d7f6
Add PHPUnit bootstrapping
dd32 f41db37
Install deps correctly.
dd32 89adf06
Fix composer deps
dd32 ce6bc80
Setup wp-env too
dd32 60de590
Update to gutenberg bootstrap
dd32 cc54dc3
Add phpunit deps
dd32 9829ed6
Set the WP_RUN_CORE_TESTS constant so that we can test the wp_environ…
dd32 a106e41
Force phpunits config file not to be forced to local environment, to …
dd32 9094567
Attempt to work around phpunit-wp-config.php permissions
dd32 a2c0bb0
Revert "Attempt to work around phpunit-wp-config.php permissions"
dd32 a179d7b
Attempt to workaround wp-env permissions and limitations.
dd32 7a81272
Simplify the phpunit bootstrapping
dd32 89f2db3
Move @wordpress/env to a devDep
dd32 24077e1
Update WP version for unit test install
ryelle 0aa8ebc
Use the files from wp-env if available
ryelle de301b4
Set a null `WP_ENVIRONMENT_TYPE` for the test environment
ryelle 91e7d0a
Update workflow to use yarn, cache yarn deps, remove `WP_ENVIRONMENT_…
ryelle c042610
Update test test to passing tests only
ryelle 5814c7d
Update testing branch name
ryelle d94b235
Fix workflow file indentation
ryelle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ trunk, try/phpunit-tests ] | ||
pull_request: | ||
branches: [ trunk ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # v3.3.0 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: yarn | ||
|
||
- name: Install dependencies & setup configs | ||
run: | | ||
yarn setup:tools | ||
|
||
- name: Install dependencies | ||
run: | | ||
yarn | ||
composer install | ||
yarn build | ||
yarn wp-env start | ||
|
||
- name: Run PHP unit tests | ||
run: | | ||
yarn test:php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"core": "WordPress/WordPress#master", | ||
"mappings": { | ||
"wp-content/mu-plugins": "./mu-plugins" | ||
}, | ||
"env": { | ||
"tests": { | ||
"config": { | ||
"WP_ENVIRONMENT_TYPE": false | ||
}, | ||
"mappings": { | ||
"vendor": "./vendor", | ||
"phpunit": "./phpunit", | ||
"phpunit.xml.dist": "./phpunit.xml.dist" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,15 @@ | |
"url": "[email protected]:WordPress/wporg-repo-tools.git" | ||
} | ||
], | ||
"require": { | ||
"composer/installers": "~1.0" | ||
}, | ||
"require-dev": { | ||
"composer/installers": "~1.0", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", | ||
"phpcompatibility/phpcompatibility-wp": "*", | ||
"phpunit/phpunit": "^9.5", | ||
"wp-coding-standards/wpcs": "2.*", | ||
"wporg/wporg-repo-tools": "dev-trunk" | ||
"wp-phpunit/wp-phpunit": "~6.0", | ||
"wporg/wporg-repo-tools": "dev-trunk", | ||
"yoast/phpunit-polyfills": "^1.0" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure we don't need
phpunit/phpunit
orwp-phpunit/wp-phpunit
since it's using thewp-env
container & wp installation, but I've left it in from #204 in case it's necessary for running phpunit locally.